summaryrefslogtreecommitdiff
path: root/tcwg-llvm-release.sh
diff options
context:
space:
mode:
authorRenato Golin <renato.golin@linaro.org>2017-05-04 15:03:17 +0100
committerRenato Golin <renato.golin@linaro.org>2017-05-04 19:17:43 +0100
commita9d187520a5af7b67e607b9b1dbb7ab527a567e8 (patch)
tree14f3da8bd363b1b688c8bf1639768dfb9d5703b2 /tcwg-llvm-release.sh
parentd044b6ce8fae1184e7b554ab39ef76601b569b95 (diff)
tcwg-llvm-*: Moving common stuff out
This is an NFC patch that just common things up. I'm making sure that we only handle URLs and toolchain downloads in a single place, which will later be very useful when we get Jenkins to ask these scripts to create the trigger files. This is the first part of TCWG-1117. Adding the trigger files will be the second. I have tested on my box by sourcing the common file and calling the functions with the right parameters as well as running the scripts (build/release/test) with the appropriate arguments but with the core logic actually commented out. I have some empty tar balls with the right names on dev-01. :) Change-Id: Ice435ad9d5e20152e295413075c32a396ffc5e2a
Diffstat (limited to 'tcwg-llvm-release.sh')
-rwxr-xr-xtcwg-llvm-release.sh63
1 files changed, 20 insertions, 43 deletions
diff --git a/tcwg-llvm-release.sh b/tcwg-llvm-release.sh
index 98b82827..11cc5a8d 100755
--- a/tcwg-llvm-release.sh
+++ b/tcwg-llvm-release.sh
@@ -8,6 +8,8 @@
set -exu
set -o pipefail
+. tcwg-llvm-common.sh
+
# Syntax
SYN_WORKSPACE="--workspace=/path/to/workspace"
SYN_RELEASE="--release=M.m.p"
@@ -78,36 +80,7 @@ while [ "$#" -gt 0 ]; do
fi
shift ;;
--toolchain)
- if [ "$VAL" != "" ]; then
- TOOLCHAIN="$VAL"
- file=$(basename "$VAL")
- dir=$(echo "$file" | sed 's/\.tar.*//g')
- # Download the toolchain
- if [ ! -d "$WORKSPACE/$dir" ]; then
- echo "No dir '$WORKSPACE/$dir'..."
- if [ ! -f "$WORKSPACE/$file" ]; then
- echo "No file '$WORKSPACE/$file'..."
- echo "Downloading from '$VAL'"
- wget -q "$VAL" -O "$WORKSPACE/$file"
- fi
- echo "Unpacking '$WORKSPACE/$file'"
- tar xf "$WORKSPACE/$file" -C "$WORKSPACE"
- fi
- # Clang or GCC?
- if [ -f "$WORKSPACE/$dir/bin/clang" ]; then
- export CC="$WORKSPACE/$dir/bin/clang"
- export CXX="$WORKSPACE/$dir/bin/clang++"
- elif [ -f "$WORKSPACE/$dir/bin/gcc" ]; then
- export CC="$WORKSPACE/$dir/bin/gcc"
- export CXX="$WORKSPACE/$dir/bin/g++"
- else
- echo "ERROR: Toolchain '$VAL' has no known compiler in $dir/bin"
- echo "Syntax: $SYN_TOOLCHAIN"
- exit 1
- fi
- else
- echo "WARNING: No toolchain specified, using the system one"
- fi
+ download_toolchain "$VAL"
shift ;;
*)
echo "ERROR: Invalid argument '$1'"
@@ -118,7 +91,12 @@ while [ "$#" -gt 0 ]; do
done
# Validate options
-if [ "$WORKSPACE" = "" -o ! -d "$WORKSPACE" ]; then
+if [ "$RELEASE" = "" ] || [ "$CANDIDATE" = "" ]; then
+ echo "ERROR: Missing release or candidate"
+ echo "$SYNTAX"
+ exit 1
+fi
+if [ "$WORKSPACE" = "" ] || [ ! -d "$WORKSPACE" ]; then
echo "ERROR: Missing workspace"
echo "$SYNTAX"
exit 1
@@ -130,13 +108,13 @@ if [ "$BUILDJOBS" = "" ]; then
fi
# Additional Options
-platform=$(uname -m)
-TRIPLE="$platform-linux-gnu"
-if echo "$platform" | grep -qi "armv7"; then
+PLATFORM=$(uname -m)
+TRIPLE="$PLATFORM-linux-gnu"
+if echo "$PLATFORM" | grep -qi "armv7"; then
TRIPLE="armv7a-linux-gnueabihf"
-elif ! echo "$platform" | grep -qi "aarch64" && \
- ! echo "$platform" | grep -qi "x86_64"; then
- echo "ERROR: Don't recognise platform $platform"
+elif ! echo "$PLATFORM" | grep -qi "aarch64" && \
+ ! echo "$PLATFORM" | grep -qi "x86_64"; then
+ echo "ERROR: Don't recognise PLATFORM $PLATFORM"
exit 1
fi
@@ -173,12 +151,11 @@ result=0
wait $! || result=$?
# Ship
-PKGNAME=clang+llvm-$RELEASE$RCTAG-$TRIPLE
-PKGDIR="$WORKSPACE/$PKGNAME"
-PUSHDIR=public_html/builds/releases/llvm
-FILESERVER=dev-01.tcwglab
+PKGNAME="$(push_binary_name "$RELEASE$RCTAG" "$TRIPLE")"
+PUSHTYPE="releases"
+PUSHDIR="$(push_binary_dir "$PUSHTYPE")"
-ssh $FILESERVER mkdir -p $PUSHDIR
-cd "$WORKSPACE/$RCDIR" && scp "$PKGNAME.tar.xz" $FILESERVER:"$PUSHDIR"
+ssh $PUSHSERVER mkdir -p $PUSHDIR
+cd "$WORKSPACE/$RCDIR" && scp "$PKGNAME.$PUSHSUFFIX" "$(push_scp_url "$PUSHTYPE")"
exit $result