Control: tag -1 patch Hi!
On Sat, 2014-12-06 at 22:06:22 +0100, Guillem Jover wrote: > On Sat, 2014-12-06 at 21:15:29 +0100, folkert wrote: > > > > Package: dpkg-build > > > > Version: any > > > > Severity: important > At least Debian::Debhelper::Dh_Lib, /usr/share/cdbs/1/rules/buildcore.mk, > /usr/share/cdbs/1/rules/buildvars.mk and /usr/lib/cdbs/list-packages > do parse control files but do not handle the field names in a > case-insensitive way. There might be other instances on those packages. Attached an untested patch that should hopefully fix all instances of this. And another one to simplify the other dpkg-parsechangelog calls that I noticed when I changed the first one. Thanks, Guillem
From 4c57d016f73332c0ed2a35742c800c37fb5582fd Mon Sep 17 00:00:00 2001 From: Guillem Jover <[email protected]> Date: Thu, 11 Dec 2014 03:15:42 +0100 Subject: [PATCH 1/2] Parse control file fields case insensitively Control: #772429 --- 1/rules/buildcore.mk.in | 6 +++--- 1/rules/buildvars.mk.in | 2 +- debian/control | 1 + scripts/list-packages | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/1/rules/buildcore.mk.in b/1/rules/buildcore.mk.in index ef3411f..2f16ffe 100644 --- a/1/rules/buildcore.mk.in +++ b/1/rules/buildcore.mk.in @@ -78,7 +78,7 @@ done) endif # Avoid recursive braindamage if we're building autotools-dev -ifeq (, $(shell grep -x 'Package: autotools-dev' debian/control)) +ifeq (, $(shell grep -xi 'Package: autotools-dev' debian/control)) config_guess := $(shell find $(DEB_SRCDIR) \( -type f -or -type l \) -name config.guess) config_sub := $(shell find $(DEB_SRCDIR) \( -type f -or -type l \) -name config.sub) ifneq (, $(config_all_tar)) @@ -87,7 +87,7 @@ config_sub_tar := $(filter %/config.sub, $(config_all_tar)) endif endif # Ditto for gnulib -ifeq (, $(shell grep -x 'Package: gnulib' debian/control)) +ifeq (, $(shell grep -xi 'Package: gnulib' debian/control)) config_rpath := $(shell find $(DEB_SRCDIR) \( -type f -or -type l \) -name config.rpath) ifneq (, $(config_all_tar)) config_rpath_tar := $(filter %/config.rpath, $(config_all_tar)) @@ -237,7 +237,7 @@ debian/control:: -e '$$bd =~ $(cdbs_re_squash_trailing_commas_and_spaces);' \ -e '$$bd =~ $(cdbs_re_wrap_after_commas);' \ -e 's/\@cdbs\@/$$bd/g;' \ - -e 's/^Build-Depends(|-Indep): ,/Build-Depends$$1:/g;' \ + -e 's/^Build-Depends(|-Indep): ,/Build-Depends$$1:/gi;' \ \ -e 'print;' \ < debian/control.in > debian/control diff --git a/1/rules/buildvars.mk.in b/1/rules/buildvars.mk.in index c958fc4..ffcf239 100644 --- a/1/rules/buildvars.mk.in +++ b/1/rules/buildvars.mk.in @@ -24,7 +24,7 @@ _cdbs_rules_buildvars = 1 CDBS_VERSION = @PACKAGE_VERSION@ # Common useful variables -DEB_SOURCE_PACKAGE := $(strip $(shell egrep '^Source: ' debian/control | cut -f 2 -d ':')) +DEB_SOURCE_PACKAGE := $(shell dpkg-parsechangelog --show-field=Source) DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') DEB_NOEPOCH_VERSION := $(shell echo $(DEB_VERSION) | cut -d: -f2-) DEB_UPSTREAM_VERSION := $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//') diff --git a/debian/control b/debian/control index 2fc939b..4212c50 100644 --- a/debian/control +++ b/debian/control @@ -25,6 +25,7 @@ Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/cdbs.git Package: cdbs Architecture: all Multi-Arch: foreign +Depends: dpkg-dev (>= 1.17.0) Recommends: autotools-dev Suggests: devscripts Description: common build system for Debian packages diff --git a/scripts/list-packages b/scripts/list-packages index f6641f5..9b65b69 100755 --- a/scripts/list-packages +++ b/scripts/list-packages @@ -54,7 +54,7 @@ sub GetPackages { while (<CONTROL>) { chomp; s/\s+$//; - if (/^Package:\s*(.*)/) { + if (/^Package:\s*(.*)/i) { $package=$1; # Detect duplicate package names in the same control file. if (! $seen{$package}) { @@ -64,7 +64,7 @@ sub GetPackages { error("debian/control has a duplicate entry for $package"); } } - if (/^Architecture:\s*(.*)/) { + if (/^Architecture:\s*(.*)/i) { $arch=$1; } -- 2.2.0.rc0.207.ga3a616c
From b94f1682b62c040c92dc3d01f9f21c34adb1e321 Mon Sep 17 00:00:00 2001 From: Guillem Jover <[email protected]> Date: Thu, 11 Dec 2014 03:16:31 +0100 Subject: [PATCH 2/2] Simplify dpkg-parsechangelog calls by using the --show-field option --- 1/rules/buildvars.mk.in | 4 ++-- doc/cdbs-doc.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/1/rules/buildvars.mk.in b/1/rules/buildvars.mk.in index ffcf239..13ccd0e 100644 --- a/1/rules/buildvars.mk.in +++ b/1/rules/buildvars.mk.in @@ -25,10 +25,10 @@ CDBS_VERSION = @PACKAGE_VERSION@ # Common useful variables DEB_SOURCE_PACKAGE := $(shell dpkg-parsechangelog --show-field=Source) -DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') +DEB_VERSION := $(shell dpkg-parsechangelog --show-field=Version) DEB_NOEPOCH_VERSION := $(shell echo $(DEB_VERSION) | cut -d: -f2-) DEB_UPSTREAM_VERSION := $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//') -DEB_ISNATIVE := $(shell dpkg-parsechangelog | egrep '^Version:' | perl -ne 'print if not /^Version:\s*.*-/;') +DEB_ISNATIVE := $(shell dpkg-parsechangelog --show-field=Version | perl -ne 'print if not /^.*-/;') # Split into arch/indep packages ifneq ($(DEB_INDEP_PACKAGES),cdbs) diff --git a/doc/cdbs-doc.xml b/doc/cdbs-doc.xml index f5f45cb..6615155 100644 --- a/doc/cdbs-doc.xml +++ b/doc/cdbs-doc.xml @@ -2115,7 +2115,7 @@ endif DEB_DH_STRIP_ARGS := --dbg-package=libpanel-applet-2 # tight versioning -DEB_NOREVISION_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ' | cut -f 1 -d '-') +DEB_NOREVISION_VERSION := $(shell dpkg-parsechangelog --show-field=Version | cut -f 1 -d '-') DEB_DH_MAKESHLIBS_ARGS_libpanel-applet2-0 := -V"libpanel-applet2-0 (>= $(DEB_NOREVISION_VERSION))" DEB_SHLIBDEPS_LIBRARY_gnome-panel:= libpanel-applet2-0 DEB_SHLIBDEPS_INCLUDE_gnome-panel := debian/libpanel-applet2-0/usr/lib/ -- 2.2.0.rc0.207.ga3a616c

