Package: debhelper
Version: 9.20120419
Severity: normal
Tags: patch

Hi,

when building a package that produces udebs with

        dh_gencontrol -- -v$(OTHER_VERSION) 

the filename for the udebs is generated wrong. The attached patch
corrects this by prefering the version information from DEBIAN/control
if possible.

MfG
        Goswin

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages debhelper depends on:
ii  binutils    2.22-6
ii  dpkg-dev    1.16.1.2
ii  file        5.11-1
ii  html2text   1.3.2a-15
ii  man-db      2.6.1-2
ii  perl        5.14.2-9
ii  po-debconf  1.0.16+nmu2

debhelper recommends no packages.

Versions of packages debhelper suggests:
ii  dh-make  0.60

-- no debconf information
Description: Try to parse DEBIAN/control to get the packages version
 This patch changes the way isnative determines the version of a package.
 It first tries to parse debian/$package/DEBIAN/control and falls back to
 parsing the changelog.
 .
 Isnative has the side effect of setting $dh{VERSION}, which is used in
 udeb_filename. If dpkg-gencontrol -v<other version> is used then the
 version in DEBIAN/control and debian/changelog will disagree and without
 this patch udeb_filename will return the wrong filename and the build
 will fail in dpkg_genchanges.
 .
 The patch applies to debhelper from squeeze (8.0.0), squeeze-backports
 (9.20120419~bpo60+1), lucid (7.4.15) and precise (9.20120115ubuntu3).
Author: Goswin von Brederlow <[email protected]>
Last-Update: 2012-06-13

---
diff -Nru debhelper-8.0.0/Debian/Debhelper/Dh_Lib.pm debhelper-8.0.0+ql1/Debian/Debhelper/Dh_Lib.pm
--- debhelper-8.0.0/Debian/Debhelper/Dh_Lib.pm	2010-06-24 02:35:34.000000000 +0200
+++ debhelper-8.0.0+ql1/Debian/Debhelper/Dh_Lib.pm	2012-06-13 12:35:51.000000000 +0200
@@ -437,11 +437,16 @@
 			$isnative_changelog="debian/changelog";
 		}
 		# Get the package version.
-		my $version=`dpkg-parsechangelog -l$isnative_changelog`;
+		my $version=`grep 2>/dev/null "^Version:" "debian/$package/DEBIAN/control"`;
 		($dh{VERSION})=$version=~m/Version:\s*(.*)/m;
-		# Did the changelog parse fail?
+		# Did the DEBIAN/control parse fail?
 		if (! defined $dh{VERSION}) {
-			error("changelog parse failure");
+			$version=`dpkg-parsechangelog -l$isnative_changelog`;
+			($dh{VERSION})=$version=~m/Version:\s*(.*)/m;
+			# Did the changelog parse fail?
+			if (! defined $dh{VERSION}) {
+				error("changelog parse failure");
+			}
 		}
 
 		# Is this a native Debian package?

Reply via email to