diff mbox series

[4/4] UBUNTU: [Packaging] update-version -- allow specification of the master version

Message ID 20210721221338.159114-5-apw@canonical.com
State New
Headers show
Series LP:1928921 LRMv5 -- switch primary version handling to kernel-versions data set | expand

Commit Message

Andy Whitcroft July 21, 2021, 10:13 p.m. UTC
Allow the caller to supply the master version so we do not need to go
look for it in the primary kernel.  This is used during LRM only
respins.

BugLink: https://bugs.launchpad.net/bugs/1928921
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 update-version | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/update-version b/update-version
index 82794e8..cc55c39 100755
--- a/update-version
+++ b/update-version
@@ -6,6 +6,8 @@  tag_prefix=`dpkg-parsechangelog -S Source | sed 's/linux-restricted-modules/Ubun
 
 commit=:
 no_update=false
+master_version=
+master_dir=
 while :
 do
 	if [ "$1" = "--commit" ]; then
@@ -16,25 +18,33 @@  do
 		shift
 		no_update=true
 
+	elif [ "$1" = "--master-version" ]; then
+		master_version="$2"
+		shift 2
+
 	else
 		break
 	fi
 done
 
-if [ "$#" -ne 1 ]; then
-	echo "Usage: $0 <linux-source-directory>" 1>&2
-	exit 1
-fi
-master_dir="$1"
+if [ "$master_version" = "" ]; then
+	if [ "$#" -ne 1 ]; then
+		echo "Usage: $0 <linux-source-directory>" 1>&2
+		exit 1
+	fi
+	master_dir="$1"
 
-# Work out the master kernel version.
-if [ -f "$master_dir/debian/debian.env" ]; then
-	branch=`sed -ne 's/DEBIAN=//p' <"$master_dir/debian/debian.env"`
-	changelog="-l$branch/changelog"
+	# Work out the master kernel version.
+	if [ -f "$master_dir/debian/debian.env" ]; then
+		branch=`sed -ne 's/DEBIAN=//p' <"$master_dir/debian/debian.env"`
+		changelog="-l$branch/changelog"
+	else
+		changelog=""
+	fi
+	master_version=`(cd "$master_dir" && LC_ALL=C dpkg-parsechangelog -SVersion $changelog)`
 else
-	changelog=""
+	no_update=true
 fi
-master_version=`(cd "$master_dir" && LC_ALL=C dpkg-parsechangelog -S Version $changelog)`
 
 # Work out our current version taking into account closed sections.
 here_series=$( LC_ALL=C dpkg-parsechangelog -S Distribution )