aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorGunnar Andersson <gandersson@genivi.org>2018-07-27 14:29:05 +0200
committerOscar Andreasson <oan@frozentux.net>2018-08-08 12:59:43 +0200
commit0ae530b264bc311ce91e5ff7a2b10d940ff1a442 (patch)
tree05d2b6ad65286ec02e8e745958a3dec29d078d87 /scripts
parent855eee8e5ec8a19d8248e9662e506a4df3bbda70 (diff)
downloadmeta-ivi-0ae530b264bc311ce91e5ff7a2b10d940ff1a442.tar.gz
meta-ivi-0ae530b264bc311ce91e5ff7a2b10d940ff1a442.tar.bz2
meta-ivi-0ae530b264bc311ce91e5ff7a2b10d940ff1a442.zip
checkout_layer_hash.sh: Fetch selected branch
The CI system will typically make shallow clones, and it might be set to fetch a specific layer branch. In a transition period, when the README specifies a new branch we might lack the requested commit hash, but since the README lists the branch name, we can use it and make sure it is fetched first. Signed-off-by: Gunnar Andersson <gandersson@genivi.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkout_layer_hash.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/checkout_layer_hash.sh b/scripts/checkout_layer_hash.sh
index 996a2ec..236e9c6 100755
--- a/scripts/checkout_layer_hash.sh
+++ b/scripts/checkout_layer_hash.sh
@@ -77,7 +77,7 @@ EOT
# Get value for item "what" (what = revision, branch, ...)
value=$(
- cat <<EOT | grep "$what" | awk '{print $2}'
+ cat <<EOT | fgrep "$what" | awk '{print $2}'
$layer_info
EOT
)
@@ -96,6 +96,7 @@ checkoutlayer=$1
[ -z "$checkoutlayer" ] && { echo "Usage: $0 <layername, e.g. poky>" ; exit 1 ; }
# Extract revision from README in meta-ivi
+branch=$(get_layer_info $checkoutlayer branch)
revision=$(get_layer_info $checkoutlayer revision)
# Fail if we could not fetch revision
@@ -106,4 +107,9 @@ revision=$(get_layer_info $checkoutlayer revision)
# this script is run. (Not true on full system builds, but typically
# when building baseline only)
cd ../"$checkoutlayer" || fail "Can't cd to layer directory ($checkoutlayer)"
+
+# First fetch the branch - CI system might at first fetch shallow clones and
+# when the selected branch changes we might otherwise lack the needed commit
+git fetch origin $branch
+
git checkout $revision