diff options
author | Renato Golin <renato.golin@linaro.org> | 2017-04-19 21:15:57 +0100 |
---|---|---|
committer | Renato Golin <renato.golin@linaro.org> | 2017-04-20 10:56:35 +0100 |
commit | 806d97531d2d1a4cf2a5da232d358976dfc6a172 (patch) | |
tree | 5c16981af44c2f732e7f47784e8432ec0b29fd5a /tcwg-llvm-build.sh | |
parent | 63a2eaed34053088f2b499ec72d51258d13031cf (diff) |
tcwg-llvm-build.sh: Use --revision argument
The new argument will move the tree to a specific SVN revision on all
repos by finding the nearest Git commit and checking out to it.
This will be merged with https://review.linaro.org/#/c/18783/ for the
flock issue before commit.
The test-suite doesn't need a specific commit, since it doesn't change
much and the only place it really matters is the release, which will be
dealt with separately.
Change-Id: I469c6cfd83e0b1f0c9038b767bf8e07b522df1cd
Diffstat (limited to 'tcwg-llvm-build.sh')
-rwxr-xr-x | tcwg-llvm-build.sh | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/tcwg-llvm-build.sh b/tcwg-llvm-build.sh index fc69b987..420d271e 100755 --- a/tcwg-llvm-build.sh +++ b/tcwg-llvm-build.sh @@ -9,16 +9,19 @@ set -o pipefail # Syntax SYN_WORKSPACE="--workspace=/path/to/workspace" +SYN_REVISION="--revision=rNNNNN (SVN revision, def. tip)" SYN_BUILDTYPE="--buildtype={Release|Debug} (def. Release)" SYN_ASSERTS="--asserts={True|False} (def. True)" SYN_BUILDJOBS="--buildjobs=N (def. CPUS)" SYN_LINKJOBS="--linkjobs=N (def. RAM+1)" SYN_TOOLCHAIN="--toolchain=http://url/for/tarball" SYN_BUILDID="--buildid=<text-to-add-to-tarball>" -SYNTAX="$0 $SYN_WORKSPACE $SYN_ASSERTS $SYN_LINKJOBS $SYN_BUILDJOBS $SYN_TOOLCHAIN $SYN_BUILDID" +SYNTAX="$0 $SYN_WORKSPACE $SYN_REVISION $SYN_ASSERTS $SYN_LINKJOBS $SYN_BUILDJOBS $SYN_TOOLCHAIN $SYN_BUILDID" # Environment Variables and default values +BASEDIR=$(dirname "$(readlink -f $0)") WORKSPACE=$(pwd) +REVISION= BUILDTYPE="Release" ASSERTS="True" CPUS=$(nproc --all) @@ -53,6 +56,17 @@ while [ "$#" -gt 0 ]; do exit 1 fi shift ;; + --revision) + if [ ! -z "$VAL" ]; then + if echo "$VAL" | grep -q "r[0-9]\+"; then + REVISION="$VAL" + else + echo "ERROR: $1" + echo "Syntax: $SYN_REVISION" + exit 1 + fi + fi + shift ;; --buildid) if [ "$VAL" != "" ]; then BUILDID="$VAL" @@ -162,6 +176,7 @@ INSTDIR="$WORKSPACE/install" REFDIR="$HOME/llvm-reference" # Dump +echo "REVISION = $REVISION" echo "BUILDTYPE = $BUILDTYPE" echo "ASSERTS = $ASSERTS" echo "SRCDIR = $SRCDIR" @@ -189,6 +204,26 @@ LOGEXT="txt" "$SRCDIR/tools/clang" |& tee -a "$LOGBASE-clone.$LOGEXT" ) 9>$REFDIR.lock +update_git() { + base=$1 + rev=$2 + + # Find the closest git hash for the SVN revision + pushd "$base" + hash=$("$BASEDIR/svn-git-hash.pl" "$rev" | awk '{print $2}') + + # We don't need to create a branch with the commit, as the clones are new + # Should be ok to stay in a detached head state for this purpose + git checkout "$hash" + popd +} + +# Move down to the right revision +if [ ! -z "$REVISION" ]; then + update_git "$SRCDIR" "$REVISION" + update_git "$SRCDIR/tools/clang" "$REVISION" +fi + # CMake OPTIONS="-DLLVM_BUILD_TESTS=True " OPTIONS+="-DCMAKE_BUILD_TYPE='$BUILDTYPE' " |