[trusty/lts-backport-xenial][PATCH v2 1/1] UBUNTU: [Packaging] update-from-*-master: add parameter to change source commit

Kleber Sacilotto de Souza kleber.souza at canonical.com
Wed Aug 16 16:15:15 UTC 2017


Add a '-c' parameter to make it easier to override the default source
release commit without the need to set the env var
'_SOURCE_RELEASE_BRANCH'. Change 'BRANCH' to 'COMMIT' since it can
accept any commit-ish name.

Also add a '-t' flag that when used it will use the tip of the branch
instead of the most recent tag for the rebase.

Ignore: yes
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza at canonical.com>
---
 debian.xenial/etc/update-from-xenial-master | 39 ++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/debian.xenial/etc/update-from-xenial-master b/debian.xenial/etc/update-from-xenial-master
index 66dd96d5b9e3..79fbb1739acd 100755
--- a/debian.xenial/etc/update-from-xenial-master
+++ b/debian.xenial/etc/update-from-xenial-master
@@ -6,7 +6,8 @@
 # the Raring master branch changelog with the correct release names.
 #
 SOURCE_RELEASE=xenial
-SOURCE_RELEASE_BRANCH=${_SOURCE_RELEASE_BRANCH:=master-next}
+SOURCE_RELEASE_COMMIT=master-next
+SOURCE_COMMIT_SEARCH_TAG=true
 DEBIAN_SOURCE=debian.master
 
 TARGET_RELEASE=trusty
@@ -27,16 +28,20 @@ POCKET=""
 IGNORE_ABI=""
 IGNORE_MODULES=""
 
-usage="$0 [-r RELEASE_REPO] [-p]"
+usage="$0 [-r RELEASE_REPO] [-c COMMIT-ISH] [-t] [-p]"
 
 #
 # command line options:
 # [-r RELEASE_REPO] - override default ${SOURCE_RELEASE} git repository.
+# [-c COMMIT-ISH] - override default ${SOURCE_RELEASE_COMMIT}
+# [-t] - use the tip of the commit-ish instead of the most recent tag.
 # [-p] - Assume the upload target is a PPA
 
-while getopts ":r:pim" opt; do
+while getopts ":r:c:tpim" opt; do
 	case $opt in
 	r ) RELEASE_REPO="$OPTARG" ;;
+	c ) SOURCE_RELEASE_COMMIT="$OPTARG" ;;
+	t ) SOURCE_COMMIT_SEARCH_TAG=false ;;
 	p ) POCKET="" ;;
 	\? ) echo usage: ${usage}; exit ;;
 	esac
@@ -53,23 +58,27 @@ fi
 # Fetch the upstream branch.
 #
 git fetch ${RELEASE_REPO} || exit 1
-git fetch ${RELEASE_REPO} ${SOURCE_RELEASE_BRANCH} || exit 1
+git fetch ${RELEASE_REPO} ${SOURCE_RELEASE_COMMIT} || exit 1
 
 #
-# Find the most recent tag on ${SOURCE_RELEASE} ${SOURCE_RELEASE_BRANCH}, then
+# Find the most recent tag on ${SOURCE_RELEASE} ${SOURCE_RELEASE_COMMIT}, then
 # rebase against it. This avoids the case where there have been some
 # commits since the last official tag.
 #
-MASTER_COMMIT=`git log --pretty=one FETCH_HEAD | \
-    awk '
-	/Ubuntu-/ {
-		if (match($0, /UBUNTU: Ubuntu-[0-9]/)) {
-				print $1
-				exit
-                        }
-                }
-        '
-`
+if [ "$SOURCE_COMMIT_SEARCH_TAG" = true ]; then
+	MASTER_COMMIT=`git log --pretty=one FETCH_HEAD | \
+	    awk '
+		/Ubuntu-/ {
+			if (match($0, /UBUNTU: Ubuntu-[0-9]/)) {
+					print $1
+					exit
+				}
+			}
+		'
+	`
+else
+	MASTER_COMMIT=`git rev-parse FETCH_HEAD`
+fi
 #
 # Find the current merge point where ${SOURCE_RELEASE} was based.
 #
-- 
2.14.0





More information about the kernel-team mailing list