[debhelper-devel] [debhelper] 01/03: getpackages: Restore behaviour of omitting $type parameter

Niels Thykier nthykier at moszumanska.debian.org
Fri Dec 25 14:33:20 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 776cf8d5fd106c851f9156ffcfebe88cc7d3f51c
Author: Niels Thykier <niels at thykier.net>
Date:   Wed Dec 23 08:12:38 2015 +0000

    getpackages: Restore behaviour of omitting $type parameter
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 Debian/Debhelper/Dh_Lib.pm | 10 ++++++----
 doc/PROGRAMMING            |  3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index ab3d6b2..8a41f6f 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -916,15 +916,16 @@ my (%package_types, %package_arches, %package_multiarches, %packages_by_type,
     %package_sections);
 sub getpackages {
 	my ($type) = @_;
-	$type //= 'both';
-	error("getpackages: First argument must be one of \"arch\", \"indep\" or \"both\"")
-		if $type ne 'both' and $type ne 'indep' and $type ne 'arch';
+	error("getpackages: First argument must be one of \"arch\", \"indep\", or \"both\"")
+		if defined($type) and $type ne 'both' and $type ne 'indep' and $type ne 'arch';
+
+	$type //= 'all-listed-in-control-file';
 
 	if (%packages_by_type) {
 		return @{$packages_by_type{$type}};
 	}
 
-	$packages_by_type{$_} = [] for qw(both indep arch);
+	$packages_by_type{$_} = [] for qw(both indep arch all-listed-in-control-file);
 	
 
 	my $package="";
@@ -988,6 +989,7 @@ sub getpackages {
 				$package_multiarches{$package} = $multiarch;
 				$package_sections{$package} = $section || $source_section;
 				if ($included_in_build_profile) {
+					push(@{$packages_by_type{'all-listed-in-control-file'}}, $package);
 					if ($arch eq 'all') {
 						push(@{$packages_by_type{'indep'}}, $package);
 						push(@{$packages_by_type{'both'}}, $package);
diff --git a/doc/PROGRAMMING b/doc/PROGRAMMING
index 6c6e027..e5b9a72 100644
--- a/doc/PROGRAMMING
+++ b/doc/PROGRAMMING
@@ -269,10 +269,11 @@ is_udeb($package)
 getpackages($type)
 	Returns a list of packages in the control file.
 	Pass "arch" or "indep" to specify arch-dependent or
-	-independent. If nothing is specified, returns all
+	-independent. If $type is omitted, returns all
 	packages (including packages that are not built
 	for this architecture). Pass "both" to get the union
 	of "arch" and "indep" packages.
+	Note that "both" is *not* the same omitting the $type parameter.
 	As a side effect, populates %package_arches and %package_types with
 	the types of all packages (not only those returned).
 get_source_date_epoch()

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