summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Picus <diana.picus@linaro.org>2021-07-27 13:12:11 +0200
committerDiana Picus <diana.picus@linaro.org>2021-07-27 13:48:15 +0200
commitd3e27cdaab0b89581804d5ae28619216768033b6 (patch)
treebed6a36b533c780e3779736ff052f92e81dbb2ec
parentfb7852bee8f941240b046236188fbebc759cf2a5 (diff)
tcwg-llvm-release.sh: Fix git-ref
When building a git-ref, we're using the test-release.sh from the release branch passed in as a parameter. We should instead use the one from the given git-ref, and in fact we shouldn't pass a release number at all. This patch fixes the issue by forcing either release + candidate or git ref to be passed in. Change-Id: I7df89175164fc49b1e73411f9f5ff6ebd118caa4
-rw-r--r--jenkins-helpers.sh29
-rw-r--r--round-robin.sh3
-rwxr-xr-xtcwg-llvm-release.sh28
3 files changed, 30 insertions, 30 deletions
diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh
index 771ace4b..7feb3edf 100644
--- a/jenkins-helpers.sh
+++ b/jenkins-helpers.sh
@@ -514,28 +514,6 @@ clone_or_update_repo_no_checkout ()
)
}
-# Checkout branch/ref/SHA1 in a git repo
-# $1 -- repo directory
-# $2 -- ref to checkout
-# $3 -- name of the git remote
-git_checkout ()
-{
- (
- set -euf -o pipefail
-
- local dir="$1"
- local ref="$2"
- local remote="$3"
-
- git_clean "$dir"
- # Convert git branch/tag names into SHA1
- local sha1
- sha1=$(git_rev_parse "$dir" "$ref" "$remote")
- # Checkout
- git -C "$dir" checkout --detach "$sha1"
- )
-}
-
# Clone or update a git repo
# $1 -- repo directory
# $2 -- ref to checkout
@@ -558,7 +536,12 @@ clone_or_update_repo ()
clone_or_update_repo_no_checkout "$dir" "$url" "$reference" \
"$single_branch" "$remote"
- git_checkout "$dir" "$ref" "$remote"
+ git_clean "$dir"
+ # Convert git branch/tag names into SHA1
+ local sha1
+ sha1=$(git_rev_parse "$dir" "$ref" "$remote")
+ # Checkout
+ git -C "$dir" checkout --detach "$sha1"
)
}
diff --git a/round-robin.sh b/round-robin.sh
index 5015c716..feeafae3 100644
--- a/round-robin.sh
+++ b/round-robin.sh
@@ -165,7 +165,8 @@ clone_repo ()
# Allow manifest override
branch="${rr[${project}_rev]-$branch}"
- git_checkout "$project" "$branch" origin
+
+ git -C $project checkout --detach "$branch"
local cur_rev
cur_rev=$(git -C $project rev-parse HEAD)
diff --git a/tcwg-llvm-release.sh b/tcwg-llvm-release.sh
index 5e1b5433..4e6259f2 100755
--- a/tcwg-llvm-release.sh
+++ b/tcwg-llvm-release.sh
@@ -15,7 +15,7 @@ BASEDIR=$(dirname "$(readlink -f "$0")")
# Syntax
SYN_WORKSPACE="--workspace=/path/to/workspace"
SYN_RELEASE="--release=M.m.p"
-SYN_CANDIDATE="--candidate=N (or 'final' or 'branch=*')"
+SYN_CANDIDATE="--candidate=N (or 'final' or 'git-ref=*')"
SYN_BUILDJOBS="--buildjobs=N (def. CPUS)"
SYN_TOOLCHAIN="--toolchain=http://url/for/tarball"
SYN_TOOLCHAIN_FILE="--toolchain-file=<file-name> (file name to copy the produced toolchain file name)"
@@ -25,7 +25,9 @@ SYNTAX="$0 $SYN_WORKSPACE $SYN_RELEASE $SYN_CANDIDATE $SYN_TOOLCHAIN $SYN_TOOLCH
# Environment Variables and default values
WORKSPACE=$(pwd)
+GITREF=""
RELEASE=""
+RELCALL=""
CANDIDATE=""
RCCALL=""
RCTAG=""
@@ -43,10 +45,15 @@ while [ "$#" -gt 0 ]; do
case "$ARG" in
--release)
RELEASE="$VAL"
- if ! echo "$RELEASE" | grep -E -q "^[0-9]+\\.[0-9]\\.[0-9]"; then
+ if test -z "$RELEASE"; then
+ # The release can be empty if we're building a git ref.
+ echo "No release specified"
+ elif ! echo "$RELEASE" | grep -E -q "^[0-9]+\\.[0-9]\\.[0-9]"; then
echo "ERROR: $1"
echo "Syntax: $SYN_RELEASE"
exit 1
+ else
+ RELCALL="-release $RELEASE"
fi
shift ;;
--candidate)
@@ -120,8 +127,13 @@ while [ "$#" -gt 0 ]; do
done
# Validate options
-if [ "$RELEASE" = "" ] || [ "$CANDIDATE" = "" ]; then
- echo "ERROR: Missing release or candidate"
+if [ "$CANDIDATE" = "" ]; then
+ echo "ERROR: Missing candidate"
+ echo "$SYNTAX"
+ exit 1
+fi
+if [ "$RELEASE" = "" ] && [ "$GITREF" = "" ]; then
+ echo "ERROR: Missing release"
echo "$SYNTAX"
exit 1
fi
@@ -175,7 +187,11 @@ LOGEXT="txt"
# Release script
RELEASE_SCRIPT="test-release.sh"
-RELEASE_TAG="llvmorg-${RELEASE}${RCTAG}"
+if test -z "$RELEASE"; then
+ RELEASE_TAG="$GITREF"
+else
+ RELEASE_TAG="llvmorg-${RELEASE}${RCTAG}"
+fi
SCRIPT_URL=https://raw.githubusercontent.com/llvm/llvm-project/$RELEASE_TAG/llvm/utils/release/$RELEASE_SCRIPT
(
cd "$WORKSPACE"
@@ -188,7 +204,7 @@ SCRIPT_URL=https://raw.githubusercontent.com/llvm/llvm-project/$RELEASE_TAG/llvm
# - we want to push the binary public on success or failre
result=0
(
- cd "$WORKSPACE" && LC_ALL=C ./$RELEASE_SCRIPT -release $RELEASE $RCCALL -triple $TARGET -j$BUILDJOBS $OPENMP $MLIR $FLANG $USENINJA $LIMITLINKJOBS |& tee "$LOGBASE-release.$LOGEXT"
+ cd "$WORKSPACE" && LC_ALL=C ./$RELEASE_SCRIPT $RELCALL $RCCALL -triple $TARGET -j$BUILDJOBS $OPENMP $MLIR $FLANG $USENINJA $LIMITLINKJOBS |& tee "$LOGBASE-release.$LOGEXT"
) &
wait $! || result=$?