[Precise/lts-backport-trusty][PATCH 1/1] UBUNTU: update-from-*-master -- add parameter to change source branch

Kleber Sacilotto de Souza kleber.souza at canonical.com
Fri May 5 12:37:13 UTC 2017


Add a '-b' parameter to make it easier to override the default source
release branch without the need to set the env var
'_SOURCE_RELEASE_BRANCH'. When using this parameter it will also use
the tip of the branch instead of the most recent tag for the rebase.

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

diff --git a/debian.trusty/etc/update-from-trusty-master b/debian.trusty/etc/update-from-trusty-master
index 9ca12218e0a..66077a33a34 100755
--- a/debian.trusty/etc/update-from-trusty-master
+++ b/debian.trusty/etc/update-from-trusty-master
@@ -6,7 +6,8 @@
 # the Raring master branch changelog with the correct release names.
 #
 SOURCE_RELEASE=trusty
-SOURCE_RELEASE_BRANCH=${_SOURCE_RELEASE_BRANCH:=master-next}
+SOURCE_RELEASE_BRANCH=master-next
+SOURCE_BRANCH_SEARCH_TAG=true
 DEBIAN_SOURCE=debian.master
 
 TARGET_RELEASE=precise
@@ -26,16 +27,22 @@ POCKET=""
 IGNORE_ABI=""
 IGNORE_MODULES=""
 
-usage="$0 [-r RELEASE_REPO] [-p]"
+usage="$0 [-r RELEASE_REPO] [-b BRANCH_NAME] [-p]"
 
 #
 # command line options:
 # [-r RELEASE_REPO] - override default ${SOURCE_RELEASE} git repository.
+# [-b BRANCH_NAME] - override default ${SOURCE_RELEASE_BRANCH} and use
+#                    the tip of the branch instead of the most recent tag.
 # [-p] - Assume the upload target is a PPA
 
-while getopts ":r:pim" opt; do
+while getopts ":r:b:pim" opt; do
 	case $opt in
 	r ) RELEASE_REPO="$OPTARG" ;;
+	b )
+	    SOURCE_RELEASE_BRANCH="$OPTARG"
+	    SOURCE_BRANCH_SEARCH_TAG=false
+	    ;;
 	p ) POCKET="" ;;
 	\? ) echo usage: ${usage}; exit ;;
 	esac
@@ -59,16 +66,20 @@ git fetch ${RELEASE_REPO} ${SOURCE_RELEASE_BRANCH} || exit 1
 # 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_BRANCH_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.11.0





More information about the kernel-team mailing list