Simplify autorelease to not use release tags
[releng/builder.git] / jjb / autorelease / include-raw-autorelease-release-versions.sh
index 94880a56dfdd68bed559872ce6681e2f0f817401..bb50bec4170fb9fc897d975209ea113c60d01617 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/bash
 # @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
 ##############################################################################
-# Copyright (c) 2015 The Linux Foundation and others.
+# Copyright (c) 2015, 2017 The Linux Foundation and others.
 #
 # All rights reserved. This program and the accompanying materials
 # are made available under the terms of the Eclipse Public License v1.0
 # RELEASE_TAG=Beryllium-SR1  # Example
 # RELEASE_BRANCH=stable/beryllium  # Example
 
-LFTOOLS_DIR="$WORKSPACE/.venv-lftools"
-if [ ! -d "$LFTOOLS_DIR" ]
-then
-    virtualenv $LFTOOLS_DIR
-    source $LFTOOLS_DIR/bin/activate
-    pip install --upgrade pip
-    pip freeze
-    pip install lftools
-fi
-source "$LFTOOLS_DIR/bin/activate"
+# Set release tag as $STREAM, when no release tag is passed
+RELEASE_TAG="${RELEASE_TAG:-${STREAM^}}"
+# Ensure that the first letter of RELEASE_TAG is uppercase.
+RELEASE_TAG="${RELEASE_TAG^}"
 
 # Directory to put git format-patches
-PATCH_DIR=`pwd`/patches
+PATCH_DIR="$WORKSPACE/patches"
 
-echo $RELEASE_TAG
-lftools version release $RELEASE_TAG
+echo "$RELEASE_TAG"
+lftools version release "$RELEASE_TAG"
 git submodule foreach "git commit -am \"Release $RELEASE_TAG\" || true"
 git commit -am "Release $RELEASE_TAG"
 
 mkdir patches
-mv taglist.log $PATCH_DIR
-modules=`xmlstarlet sel -N x=http://maven.apache.org/POM/4.0.0 -t -m '//x:modules' -v '//x:module' pom.xml`
+# TODO: Fix this workaround so that scripts will ensure that taglist.log exists and archived.
+mv taglist.log "$PATCH_DIR" || true
+modules=$(xmlstarlet sel -N x=http://maven.apache.org/POM/4.0.0 -t -m '//x:modules' -v '//x:module' pom.xml)
 for module in $modules; do
-    pushd $module
-    git format-patch --stdout origin/$RELEASE_BRANCH > $PATCH_DIR/${module//\//-}.patch
-    git bundle create $PATCH_DIR/${module//\//-}.bundle "origin/master..HEAD"
+    pushd "$module"
+    git format-patch --stdout "origin/$RELEASE_BRANCH" > "$PATCH_DIR/${module//\//-}.patch"
+    git bundle create "$PATCH_DIR/${module//\//-}.bundle" "origin/master..HEAD"
     popd
 done
 
-tar cvzf all-bundles.tar.gz `find $PATCH_DIR -type f -print0 \
-                                | xargs -0r file             \
-                                | egrep -e ':.*Git bundle.*' \
-                                | cut -d: -f1`
-rm $PATCH_DIR/*.bundle
+tar cvzf patches.tar.gz -C "$WORKSPACE" patches
+rm "$PATCH_DIR"/*.bundle