[dpkg] 105/192: Dpkg::Vendor: Only load Dpkg::BuildOptions and Dpkg::Arch if needed
Ximin Luo
infinity0 at debian.org
Tue Oct 17 11:04:06 UTC 2017
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch pu/reproducible_builds
in repository dpkg.
commit 79f7e1533187cabe9bf6c00777a101bfe48d0971
Author: Guillem Jover <guillem at debian.org>
Date: Sat Jul 15 01:59:41 2017 +0200
Dpkg::Vendor: Only load Dpkg::BuildOptions and Dpkg::Arch if needed
The Dpkg::Vendor-specific modules are loaded as part of many other
modules load-chains. But not all parts of these modules are used, as
they are hook-specific. Switch these two modules to be required only
when we are going over the specific code paths needing them.
---
debian/changelog | 3 +++
scripts/Dpkg/Vendor/Debian.pm | 11 +++++++----
scripts/Dpkg/Vendor/Ubuntu.pm | 10 +++++++---
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index e4da204..7e26637 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -27,6 +27,9 @@ dpkg (1.19.0) UNRELEASED; urgency=medium
- Remove unused Dpkg::Path from Dpkg::Vendor::Ubuntu.
- Only load POSIX from Dpkg::Compression::FileHandle if we are going to
use signal definitions, reducing the load time of many other modules.
+ - Only load Dpkg::BuildOptions and Dpkg::Arch from Dpkg::Vendor-specific
+ modules if we are going to use them, reducing the load time of many
+ other modules.
* Documentation:
- Document currently accepted syntax for changelogs in deb-changelog(5).
Closes: #858579
diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index 29d4772..7f22dc7 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -29,8 +29,6 @@ use Dpkg;
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
use Dpkg::Control::Types;
-use Dpkg::BuildOptions;
-use Dpkg::Arch qw(get_host_arch debarch_to_debtuple);
use parent qw(Dpkg::Vendor::Default);
@@ -94,6 +92,8 @@ sub run_hook {
sub _parse_feature_area {
my ($self, $area, $use_feature) = @_;
+ require Dpkg::BuildOptions;
+
# Adjust features based on user or maintainer's desires.
my $opts = Dpkg::BuildOptions->new(envvar => 'DEB_BUILD_OPTIONS');
$opts->parse_features($area, $use_feature);
@@ -248,8 +248,11 @@ sub _add_sanitize_flags {
sub _add_hardening_flags {
my ($self, $flags) = @_;
- my $arch = get_host_arch();
- my ($abi, $libc, $os, $cpu) = debarch_to_debtuple($arch);
+
+ require Dpkg::Arch;
+
+ my $arch = Dpkg::Arch::get_host_arch();
+ my ($abi, $libc, $os, $cpu) = Dpkg::Arch::debarch_to_debtuple($arch);
unless (defined $abi and defined $libc and defined $os and defined $cpu) {
warning(g_("unknown host architecture '%s'"), $arch);
diff --git a/scripts/Dpkg/Vendor/Ubuntu.pm b/scripts/Dpkg/Vendor/Ubuntu.pm
index cf93bcc..eb2dffe 100644
--- a/scripts/Dpkg/Vendor/Ubuntu.pm
+++ b/scripts/Dpkg/Vendor/Ubuntu.pm
@@ -27,8 +27,6 @@ our $VERSION = '0.01';
use Dpkg::ErrorHandling;
use Dpkg::Gettext;
use Dpkg::Control::Types;
-use Dpkg::BuildOptions;
-use Dpkg::Arch qw(debarch_eq get_host_arch);
use parent qw(Dpkg::Vendor::Debian);
@@ -99,10 +97,16 @@ sub run_hook {
} elsif ($hook eq 'update-buildflags') {
my $flags = shift @params;
+
+ require Dpkg::BuildOptions;
+
my $build_opts = Dpkg::BuildOptions->new();
if (!$build_opts->has('noopt')) {
- if (debarch_eq(get_host_arch(), 'ppc64el')) {
+ require Dpkg::Arch;
+
+ my $arch = Dpkg::Arch::get_host_arch();
+ if (Dpkg::Arch::debarch_eq($arch, 'ppc64el')) {
for my $flag (qw(CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS GCJFLAGS
FFLAGS FCFLAGS)) {
$flags->set($flag, '-g -O3', 'vendor');
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list