Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (c) 2019, Arm Limited. All rights reserved. |
| 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
| 7 | |
| 8 | # $1 = git remote human readable name |
| 9 | # $2 = git remote URL |
| 10 | sync_repo() |
| 11 | { |
| 12 | local result |
| 13 | echo Pushing to $1... |
| 14 | git push $2 master |
| 15 | result=$? |
| 16 | if [ $result != 0 ] |
| 17 | then |
| 18 | echo Pushing to $1 FAILED! |
| 19 | else |
| 20 | echo Pushing to $1 SUCCEEDED! |
| 21 | fi |
| 22 | return $result |
| 23 | } |
| 24 | |
| 25 | # exit if anything fails |
| 26 | set -e |
| 27 | |
| 28 | source "$CI_ROOT/utils.sh" |
| 29 | |
| 30 | if [ ! -d "trusted-firmware-a" ] |
| 31 | then |
| 32 | # Fresh clone |
| 33 | echo Cloning from trustedfirmware.org... |
| 34 | git clone $tf_src_repo_url |
| 35 | else |
| 36 | echo Using existing repo... |
| 37 | fi |
| 38 | |
| 39 | echo Pulling from trustedfirmware.org... |
| 40 | cd trusted-firmware-a |
| 41 | git remote update --prune |
| 42 | git checkout master |
| 43 | git merge --ff-only origin/master |
| 44 | |
| 45 | # stop exiting automatically |
| 46 | set +e |
| 47 | |
| 48 | sync_repo GitHub https://$GH_USER:$GH_PASSWORD@github.com/ARM-software/arm-trusted-firmware.git |
| 49 | github=$? |
| 50 | sync_repo "internal Arm Gerrit" $tf_arm_gerrit_repo |
| 51 | gerrit=$? |
| 52 | |
| 53 | if [ $github != 0 -o $gerrit != 0 ] |
| 54 | then |
| 55 | exit 1 |
| 56 | fi |