[debhelper-devel] [debhelper] 01/01: Make dbgsym Package-Type (almost) configurable

Niels Thykier nthykier at moszumanska.debian.org
Sat Nov 4 10:29:07 UTC 2017


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository debhelper.

commit d7755b09a42813d4166074c04a19e8c36e4865ee
Author: Niels Thykier <niels at thykier.net>
Date:   Sat Nov 4 10:26:45 2017 +0000

    Make dbgsym Package-Type (almost) configurable
    
    While not perfect, it should minimize most of the Ubuntu delta related
    to dbgsym packages.  Instead of having to patch dh_gencontrol and
    dh_builddeb, Ubuntu can now change a single line in Dh_Lib to have the
    desired behaviour.
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog               |  6 ++++++
 dh_builddeb                    | 10 ++++++++--
 dh_gencontrol                  |  2 ++
 lib/Debian/Debhelper/Dh_Lib.pm | 12 +++++++++++-
 4 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 44eca59..4ad81a2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,12 @@ debhelper (10.10.6) UNRELEASED; urgency=medium
   * dh,dh_auto_*: Support skipping all of the dh_auto_* helpers if the
     package does not seem to have a build system (and there are no build
     system related options passed to dh).
+  * Dh_Lib.pm: Define a (hardcoded) extension for dbgsym packages.
+  * dh_gencontrol: Pass -DPackage-Type to dpkg-gencontrol when the
+    package type for dbgsym is different than for regular deb packages.
+  * dh_builddeb: Automatically handle renaming of dbgsym packages when
+    the extension of the dbgsym packages are different than for regular
+    deb packages.
 
  -- Axel Beckert <abe at debian.org>  Fri, 27 Oct 2017 23:48:44 +0200
 
diff --git a/dh_builddeb b/dh_builddeb
index 13f67d4..7d36fa3 100755
--- a/dh_builddeb
+++ b/dh_builddeb
@@ -131,8 +131,14 @@ on_items_in_parallel(\@items, sub {
 
 		if ($dbgsym) {
 			my $dbgsym_tmpdir = dbgsym_tmpdir($package);
-			doit("dpkg-deb", @dpkg_options, @{$dh{U_PARAMS}},
-				"--build", $dbgsym_tmpdir, $dh{DESTDIR});
+			my @cmd = ("dpkg-deb", @dpkg_options, @{$dh{U_PARAMS}},
+				"--build", $dbgsym_tmpdir);
+			if (DBGSYM_PACKAGE_TYPE eq DEFAULT_PACKAGE_TYPE) {
+				doit(@cmd, $dh{DESTDIR});
+			} else {
+				build_and_rename_deb($package, $dh{DESTDIR}, \@cmd,
+					sub {s/\.\Q${\DEFAULT_PACKAGE_TYPE}\E$/\.\Q${\DBGSYM_PACKAGE_TYPE}\E/g});
+			}
 			next;
 		}
 		if (exists $ENV{DH_ALWAYS_EXCLUDE} && length $ENV{DH_ALWAYS_EXCLUDE}) {
diff --git a/dh_gencontrol b/dh_gencontrol
index 271aa9a..8552dc3 100755
--- a/dh_gencontrol
+++ b/dh_gencontrol
@@ -131,6 +131,8 @@ on_pkgs_in_parallel {
 				"-DBuild-Ids=${build_ids}",
 				"-DSection=${component}debug",
 			);
+			push(@dbgsym_options, "-DPackage-Type=${\DBGSYM_PACKAGE_TYPE}")
+				if DBGSYM_PACKAGE_TYPE ne DEFAULT_PACKAGE_TYPE;
 			# Disable multi-arch unless the original package is an
 			# multi-arch: same package.  In all other cases, we do not
 			# need a multi-arch value.
diff --git a/lib/Debian/Debhelper/Dh_Lib.pm b/lib/Debian/Debhelper/Dh_Lib.pm
index b92e5fa..7cc0f3c 100644
--- a/lib/Debian/Debhelper/Dh_Lib.pm
+++ b/lib/Debian/Debhelper/Dh_Lib.pm
@@ -23,11 +23,20 @@ use constant {
 	'XARGS_INSERT_PARAMS_HERE' => \'<INSERT-HERE>', #'# Hi emacs.
 	# Magic value for debhelper tools to request "current version"
 	'DH_BUILTIN_VERSION' => \'<DH_LIB_VERSION>', #'# Hi emacs.
+	# Default Package-Type / extension (must be aligned with dpkg)
+	'DEFAULT_PACKAGE_TYPE' => 'deb',
 
 	# Kill-switch for R³ (for backports)
 	'DH_ENABLE_RRR_SUPPORT' => 1,
 };
 
+use constant {
+	# Package-Type / extension for dbgsym packages
+	# TODO: Find a way to determine this automatically from the vendor
+	#  - blocked by Dpkg::Vendor having a rather high load time (for debhelper)
+	'DBGSYM_PACKAGE_TYPE' => DEFAULT_PACKAGE_TYPE,
+};
+
 use Errno qw(ENOENT);
 use Exporter qw(import);
 use File::Glob qw(bsd_glob GLOB_CSH GLOB_NOMAGIC GLOB_TILDE);
@@ -59,7 +68,8 @@ our (@EXPORT, %dh);
 	    &print_and_complex_doit &default_sourcedir &qx_cmd
 	    &compute_doc_main_package &is_so_or_exec_elf_file
 	    &assert_opt_is_known_package &dbgsym_tmpdir &find_hardlinks
-	    &should_use_root &gain_root_cmd
+	    &should_use_root &gain_root_cmd DEFAULT_PACKAGE_TYPE
+	    DBGSYM_PACKAGE_TYPE
 );
 
 # The Makefile changes this if debhelper is installed in a PREFIX.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list