[Reproducible-commits] [debhelper] 02/09: Cache result of getpackages
Mattia Rizzolo
mattia at mapreri.org
Sun Dec 20 13:14:53 UTC 2015
This is an automated email from the git hooks/post-receive script.
mattia pushed a commit to branch pu/reproducible_builds
in repository debhelper.
commit 1bd369cc52115fd179a46d6f8d9af6e9f126ffa8
Author: Niels Thykier <niels at thykier.net>
Date: Sun Dec 20 10:46:07 2015 +0000
Cache result of getpackages
Signed-off-by: Niels Thykier <niels at thykier.net>
---
Debian/Debhelper/Dh_Lib.pm | 47 ++++++++++++++++++++++++----------------------
debian/changelog | 1 +
2 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index 53c570f..1d917c4 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -34,7 +34,7 @@ use vars qw(@EXPORT %dh);
&install_dh_config_file &error_exitcode &package_multiarch
&install_file &install_prog &install_lib &install_dir
&get_source_date_epoch &is_cross_compiling
- &generated_file &autotrigger
+ &generated_file &autotrigger &package_section
);
my $max_compat=10;
@@ -912,19 +912,23 @@ 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);
+my (%package_types, %package_arches, %package_multiarches, %packages_by_type);
sub getpackages {
- my $type=shift;
+ 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';
- %package_types=();
- %package_arches=();
- %package_multiarches=();
+ if (%packages_by_type) {
+ return @{$packages_by_type{$type}};
+ }
+
+ $packages_by_type{$_} = [] for qw(both indep arch);
- $type="" if ! defined $type;
my $package="";
my $arch="";
- my ($package_type, $multiarch, @list, %seen, @profiles,
+ my ($package_type, $multiarch, %seen, @profiles,
$included_in_build_profile);
if (exists $ENV{'DEB_BUILD_PROFILES'}) {
@profiles=split /\s+/, $ENV{'DEB_BUILD_PROFILES'};
@@ -977,25 +981,24 @@ sub getpackages {
$package_types{$package}=$package_type;
$package_arches{$package}=$arch;
$package_multiarches{$package} = $multiarch;
+ if ($included_in_build_profile) {
+ if ($arch eq 'all') {
+ push(@{$packages_by_type{'indep'}}, $package);
+ push(@{$packages_by_type{'both'}}, $package);
+ } elsif ($arch eq 'any' ||
+ ($arch ne 'all' && samearch(buildarch(), $arch))) {
+ push(@{$packages_by_type{'arch'}}, $package);
+ push(@{$packages_by_type{'both'}}, $package);
+ }
+ }
}
-
- if ($package && $included_in_build_profile &&
- ((($type eq 'indep' || $type eq 'both') && $arch eq 'all') ||
- (($type eq 'arch' || $type eq 'both') &&
- ($arch eq 'any' ||
- ($arch ne 'all' && samearch(buildarch(), $arch))
- )
- ) || ! $type)
- ) {
- push @list, $package;
- $package="";
- $arch="";
- }
+ $package='';
+ $arch='';
}
}
close CONTROL;
- return @list;
+ return @{$packages_by_type{$type}};
}
# Returns the arch a package will build for.
diff --git a/debian/changelog b/debian/changelog
index 6cdae5b..a2e30c9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ debhelper (9.20151219+unreleased) UNRELEASED; urgency=medium
* dh_strip: Document that dbgsym packages are built by
default.
+ * Dh_Lib: Cache the results of getpackages.
-- Niels Thykier <niels at thykier.net> Sun, 20 Dec 2015 10:30:08 +0000
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/debhelper.git
More information about the Reproducible-commits
mailing list