[debhelper-devel] [debhelper] 02/04: dh_gencontrol: Create dbgsym packages with correct component

Niels Thykier nthykier at moszumanska.debian.org
Sun Dec 20 12:03:06 UTC 2015


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

nthykier pushed a commit to branch master
in repository debhelper.

commit d5b20221044e517e5bd8b010b03f9417f76bc002
Author: Niels Thykier <niels at thykier.net>
Date:   Sun Dec 20 11:57:06 2015 +0000

    dh_gencontrol: Create dbgsym packages with correct component
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 Debian/Debhelper/Dh_Lib.pm | 26 ++++++++++++++++++++++++--
 debian/changelog           |  2 ++
 dh_gencontrol              | 11 ++++++++++-
 3 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 1d917c4..ab3d6b2 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -912,7 +912,8 @@ sub sourcepackage {
 #
 # As a side effect, populates %package_arches and %package_types
 # with the types of all packages (not only those returned).
-my (%package_types, %package_arches, %package_multiarches, %packages_by_type);
+my (%package_types, %package_arches, %package_multiarches, %packages_by_type,
+    %package_sections);
 sub getpackages {
 	my ($type) = @_;
 	$type //= 'both';
@@ -928,7 +929,8 @@ sub getpackages {
 
 	my $package="";
 	my $arch="";
-	my ($package_type, $multiarch, %seen, @profiles,
+	my $section="";
+	my ($package_type, $multiarch, %seen, @profiles, $source_section,
 		$included_in_build_profile);
 	if (exists $ENV{'DEB_BUILD_PROFILES'}) {
 		@profiles=split /\s+/, $ENV{'DEB_BUILD_PROFILES'};
@@ -950,6 +952,9 @@ sub getpackages {
 			$package_type="deb";
 			$included_in_build_profile=1;
 		}
+		if (/^Section:\s(.*)\s*$/i) {
+			$section = $1;
+		}
 		if (/^Architecture:\s*(.*)/i) {
 			$arch=$1;
 		}
@@ -981,6 +986,7 @@ sub getpackages {
 				$package_types{$package}=$package_type;
 				$package_arches{$package}=$arch;
 				$package_multiarches{$package} = $multiarch;
+				$package_sections{$package} = $section || $source_section;
 				if ($included_in_build_profile) {
 					if ($arch eq 'all') {
 						push(@{$packages_by_type{'indep'}}, $package);
@@ -991,9 +997,12 @@ sub getpackages {
 						push(@{$packages_by_type{'both'}}, $package);
 					}
 				}
+			} elsif ($section and not defined($source_section)) {
+				$source_section = $section;
 			}
 			$package='';
 			$arch='';
+			$section='';
 		}
 	}
 	close CONTROL;
@@ -1026,6 +1035,19 @@ sub package_multiarch {
 	return $package_multiarches{$package} // 'no';
 }
 
+# Returns the (raw) section value of a package (possibly including component).
+sub package_section {
+	my ($package) = @_;
+
+	# Test the architecture field instead, as it is common for a
+	# package to not have a multi-arch value.
+	if (! exists $package_sections{$package}) {
+		warning "package $package is not in control info";
+		return 'unknown';
+	}
+	return $package_sections{$package} // 'unknown';
+}
+
 # Return true if a given package is really a udeb.
 sub is_udeb {
 	my $package=shift;
diff --git a/debian/changelog b/debian/changelog
index a2e30c9..7e6890d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ debhelper (9.20151219+unreleased) UNRELEASED; urgency=medium
   * dh_strip: Document that dbgsym packages are built by
     default.
   * Dh_Lib: Cache the results of getpackages.
+  * dh_gencontrol: Create debug symbol packages with the same
+    component as the original package.
 
  -- Niels Thykier <niels at thykier.net>  Sun, 20 Dec 2015 10:30:08 +0000
 
diff --git a/dh_gencontrol b/dh_gencontrol
index 499dfae..1d35f89 100755
--- a/dh_gencontrol
+++ b/dh_gencontrol
@@ -89,18 +89,27 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 	# extension.
 	if ( -d $ddeb_tmp and not is_udeb($package)) {
 		my $multiarch = package_multiarch($package);
+		my $section = package_section($package);
 		my $replaces = read_ddeb_migration($ddeb_info_dir);
+		my $component = '';
+		if ($section =~ m{^(.*)/[^/]+$}) {
+			$component = "${1}/";
+			# This should not happen, but lets not propogate the error
+			# if does.
+			$component = '' if $component eq 'main/';
+		}
 
 		# Remove and override more or less every standard field.
 		my @ddeb_options = (qw(
 			-UPre-Depends -URecommends -USuggests -UEnhances -UProvides -UEssential
-			-UConflicts -DPriority=extra -DSection=debug
+			-UConflicts -DPriority=extra
 			-DAuto-Built-Package=debug-symbols
 			),
 			 "-DPackage=${package}-dbgsym",
 			 "-DDepends=${package} (= \${binary:Version})",
 			 "-DDescription=Debug symbols for ${package}",
 			 "-DBuild-Ids=${build_ids}",
+			 "-DSection=${component}debug",
 		);
 		# Disable multi-arch unless the original package is an
 		# multi-arch: same package.  In all other cases, we do not

-- 
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