[L/unstable 04/13] UBUNTU: [Packaging] use dpkg-parsechangelog to get package name and series

Masahiro Yamada masahiro.yamada at canonical.com
Mon Dec 5 08:56:10 UTC 2022


dpkg-parsechangelog is more readable than the complex regex matching.

Also, use the simple variables (:=) instead of recursive variables (=)
since these are used over and over again. Invoking the shell every time
is not efficient.

Signed-off-by: Masahiro Yamada <masahiro.yamada at canonical.com>
---
 debian/rules.d/0-common-vars.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index c0910d46670a..104029dc0a8e 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -4,10 +4,10 @@ comma = ,
 #
 # The source package name will be the first token from $(DEBIAN)/changelog
 #
-src_pkg_name=$(shell sed -n '1s/^\(.*\) (.*).*$$/\1/p' $(DEBIAN)/changelog)
+src_pkg_name := $(shell dpkg-parsechangelog -l$(DEBIAN)/changelog -S source)
 
 # Get the series
-series=$(shell dpkg-parsechangelog -l$(DEBIAN)/changelog | sed -ne 's/^Distribution: *//p' | sed -e 's/-\(security\|updates\|proposed\)$$//')
+series := $(shell dpkg-parsechangelog -l$(DEBIAN)/changelog -S distribution | sed -e 's/-\(security\|updates\|proposed\)$$//')
 
 # Get some version info
 release := $(shell sed -n '1s/^$(src_pkg_name).*(\(.*\)-.*).*$$/\1/p' $(DEBIAN)/changelog)
-- 
2.34.1




More information about the kernel-team mailing list