diff options
author | Yvan Roux <yvan.roux@linaro.org> | 2018-06-05 15:21:06 +0200 |
---|---|---|
committer | Yvan Roux <yvan.roux@linaro.org> | 2018-06-06 07:33:25 +0000 |
commit | 47ef5ab0f1afa23872a7f92220ec3060e306b788 (patch) | |
tree | 7d48e26a81d57a4f1c4214fa3b97af0d7e449282 /tcwg-llvm-build.sh | |
parent | 609744cb3b7990126f91e1a8a84adf839dfcd03f (diff) |
tcwg-llvm-build: Add git sha1 handling.
Extends projects selection mechanism to handle the checkout of a
specific git revision. The revisions to use are specified as with the
notation @sha1 in the project list passed by --projects option, for
instance:
--projects=llvm@sha1_1 clang compiler_rt@sha1_2
The priorities for checkout are:
1- The revision passed by @sha1 notation
2- The svn revision passed by --revision option
3- Top of the branch passed by --branch option
4- Top of master branch
Change-Id: Idfbc24bc71b86455c9b41528b38df653750e28df
Diffstat (limited to 'tcwg-llvm-build.sh')
-rwxr-xr-x | tcwg-llvm-build.sh | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/tcwg-llvm-build.sh b/tcwg-llvm-build.sh index 30fda91d..c821bde9 100755 --- a/tcwg-llvm-build.sh +++ b/tcwg-llvm-build.sh @@ -24,7 +24,7 @@ SYN_TOOLCHAIN_FILE="--toolchain-file=<file-name> (file name to copy the produced SYN_COMPILER="--compiler=clang|gcc" SYN_REPOSITORY="--repository=http://url/for/git/repo/" SYN_BRANCH="--branch=branchname" -SYN_PROJECTS="--projects='llvm clang etc'" +SYN_PROJECTS="--projects='llvm[@sha1] clang[@sha1] etc'" SYNTAX="$0 $SYN_WORKSPACE $SYN_REVISION $SYN_ASSERTS $SYN_LINKJOBS $SYN_BUILDJOBS $SYN_TOOLCHAIN $SYN_BUILDID $SYN_TOOLCHAIN_FILE $SYN_CMAKEFLAGS $SYN_COMPILER $SYN_REPOSITORY $SYN_BRANCH $SYN_PROJECTS" # Environment Variables and default values @@ -219,10 +219,18 @@ CLONE_STATUS=0 proj="$(echo "$proj_ref" | cut -d ":" -f 1)" dir="$(echo "$proj_ref" | cut -d ":" -f 2)" - # If project list exists and it's not in there, ignore - if [ ! -z "$PROJECTS" ] && ! is_in_list "$proj" "$PROJECTS"; then - continue - fi + # Check if project is part of the list and get revision if defined + build_proj="" + sha1="" + for p in $PROJECTS ; do + IFS='@' read -r -a v <<< "$p" + if [ "$proj" = "${v[0]}" ] ; then + build_proj="ok" + [ ${#v[@]} -eq 2 ] && sha1="${v[1]}" + break + fi + done + [ -z "$build_proj" ] && continue # Only clone if the branch exists if has_remote_branch "$REPOSITORY/$proj.git" "$BRANCH"; then @@ -230,7 +238,9 @@ CLONE_STATUS=0 --reference "$REFDIR/$proj" \ "$SRCDIR/$dir" |& tee "$LOGBASE-clone.$LOGEXT" # Make sure we are on the right revision - if [ ! -z "$REVISION" ]; then + if [ ! -z "$sha1" ] ; then + git -C "$SRCDIR/$dir" checkout --detach "$sha1" + elif [ ! -z "$REVISION" ]; then # Move down to the right revision update_git "$SRCDIR/$dir" "$REVISION" else |