blob: 65fff79cc9d04125ea855ec81b27881c1a9fd5f0 [file] [log] [blame]
Fathi Boudra422bf772019-12-02 11:10:16 +02001#!/bin/bash
2#
3# Copyright (c) 2019, Arm Limited. All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8set -e
9
10ci_root="$(readlink -f "$(dirname "$0")/../..")"
11source "$ci_root/utils.sh"
12
13declare -A repo_urls=(
14[pdcs-platforms/ap/tf-topics]="name=trusted-firmware url=$tf_src_repo_url"
15[trusted-firmware/tf-a-tests]="name=trusted-firmware-tf url=$tftf_src_repo_url"
16[pdswinf/ci/pdcs-platforms/platform-ci]="name=trusted-firmware-ci url=$tf_ci_repo_url"
17)
18
19project="${GERRIT_PROJECT:-$PROJECT}"
20eval "${repo_urls[$project]?}"
21ref_dir="$project_filer/ref-repos/$name"
22
23# Create/update reference repository.
24mkdir -p "$ref_dir"
25if [ ! -d "$ref_dir" ]; then
26 # Clone afresh
27 mkdir -p "$ref_dir"
28 git clone -q "$url" "$ref_dir"
29else
30 # Update master
31 cd "$ref_dir"
32 git fetch -q origin master
33 git reset -q --hard origin/master
34fi
35
36echo "Updated $name"