Update release scripts to match stable/lithium 07/4107/1
authorThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 3 Dec 2015 21:23:41 +0000 (16:23 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 3 Feb 2017 17:04:39 +0000 (12:04 -0500)
Change-Id: I0e7d08594c72e79c93ca244288addce4c329a83d
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
odl-patches.sh [deleted file]
patch-odl-release.sh [new file with mode: 0755]
version.sh

diff --git a/odl-patches.sh b/odl-patches.sh
deleted file mode 100755 (executable)
index 86bf6f1..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-project=${PWD##*/}
-
-git apply /tmp/patches/${project}.patch
-git commit -asm "Applying the Helium SR2 release patch"
-find . -name pom.xml | xargs grep SNAPSHOT
-version-bump.sh
-git commit -asm "Bumping versions by 0.0.1 after the Helium SR2 release"
-find . -name pom.xml | xargs grep Helium
-
diff --git a/patch-odl-release.sh b/patch-odl-release.sh
new file mode 100755 (executable)
index 0000000..fd351d9
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+# @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
+##############################################################################
+# Copyright (c) 2015 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
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Thanh Ha - Initial implementation
+##############################################################################
+
+# The purpose of this patch is to:
+#
+#   1) Apply autorelease patches for a ODL Release
+#   2) Create version bump commit for post-release dev cycle
+
+USAGE="USAGE: patch-odl-release <path-to-patches> <tag>\n\
+\n\
+path-to-patches - The path to the directory containing ODL Release patches\n\
+tag  - example: Lithium-SR1"
+
+if [ -z "$2" ]
+then
+    echo -e "$USAGE"
+    exit 1
+fi
+
+PATCH_DIR=$1
+RELEASE_TAG=$2
+
+project=${PWD##*/}
+scriptdir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+
+# Validate that we're patching at the same commit level as when autorelease
+# built the release. Basically ensuring that no new patches snuck into the
+# project during code freeze.
+CURRENT_HASH=`git rev-parse HEAD`
+EXPECTED_HASH=`grep $project $PATCH_DIR/taglist.log | awk '{ print $2 }'`
+echo "Current Hash: $CURRENT_HASH"
+echo "Expected Hash: $EXPECTED_HASH"
+if [ "$CURRENT_HASH" != "$EXPECTED_HASH" ]
+then
+    echo "ERROR: Current project hash does not match expected hash"
+    exit 1
+fi
+
+#######################
+# Start apply patches #
+#######################
+
+git apply ${PATCH_DIR}/${project}.patch
+git commit -asm "Release $RELEASE_TAG"
+git tag -asm "OpenDaylight $RELEASE_TAG release" release/${RELEASE_TAG,,}
+find . -name pom.xml | xargs grep SNAPSHOT
+$scriptdir/version.sh bump $RELEASE_TAG
+git commit -asm "Bumping versions by 0.0.1 for next dev cycle"
+find . -name pom.xml | xargs grep $RELEASE_TAG
+
index c07d0ad..d3e1107 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
 ##############################################################################
@@ -53,7 +53,7 @@ RELEASE_TAG=$2
 FILENAMES="pom.xml features.xml"
 
 
-if [ "$MODE" = "bump" ]
+if [ "$MODE" == "bump" ]
 then
     echo "Bumping versions..."
     for name in $FILENAMES
@@ -75,7 +75,7 @@ then
         find . -type f -name "$name" -exec perl -i -pe "s/(\d\d\d\d\.\d\d\.\d\d)\.(\d+)\.(\d+)-$RELEASE_TAG/\$1.\$2.@{[1+\$3]}-SNAPSHOT/g" {} +
         find . -type f -name "$name" -exec perl -i -pe "s/(\d\d\d\d\.\d\d\.\d\d)\.(\d+)-$RELEASE_TAG/\$1.\$2.1-SNAPSHOT/g" {} +
     done
-elif [ "$MODE" = "release" ]
+elif [ "$MODE" == "release" ]
 then
     for name in $FILENAMES
     do