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

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=c5e6822d598a34d93001450c282c33f22b18efde

commit c5e6822d598a34d93001450c282c33f22b18efde
Author: Guillem Jover <[email protected]>
AuthorDate: Thu Jan 19 09:44:12 2023 +0100

    Dpkg::Vendor::Ubuntu: Fix lto feature to honor DEB_BUILD_OPTIONS
    
    The recently added lto handling for Ubuntu, did not take into account
    that the DEB_BUILD_OPTIONS and DEB_BUILD_MAINT_OPTIONS environment
    variables are parsed and their options applied just after setting the
    defaults, and before applying any arch-specific mask.
    
    We add a new init_build_features() internal method, which sits between
    these two actions, so that the Ubuntu vendor module can modify the
    defaults before any user or maintainer override are applied.
    
    Fixes: commit df7627acfadca528e52147cc777fa01b2ed802b4
    Fixes: https://bugs.launchpad.net/bugs/2002582
---
 scripts/Dpkg/Vendor/Debian.pm |  6 ++++++
 scripts/Dpkg/Vendor/Ubuntu.pm | 17 +++++++++++++----
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index 39ffbf065..06aa49ad6 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -94,6 +94,10 @@ sub run_hook {
     }
 }
 
+sub init_build_features {
+    my ($self, $use_feature, $builtin_feature) = @_;
+}
+
 sub set_build_features {
     my ($self, $flags) = @_;
 
@@ -139,6 +143,8 @@ sub set_build_features {
         },
     );
 
+    $self->init_build_features(\%use_feature, \%builtin_feature);
+
     ## Setup
 
     require Dpkg::BuildOptions;
diff --git a/scripts/Dpkg/Vendor/Ubuntu.pm b/scripts/Dpkg/Vendor/Ubuntu.pm
index df42580e2..9c77519d7 100644
--- a/scripts/Dpkg/Vendor/Ubuntu.pm
+++ b/scripts/Dpkg/Vendor/Ubuntu.pm
@@ -109,17 +109,26 @@ sub run_hook {
 }
 
 # Override Debian default features.
-sub set_build_features {
-    my ($self, $flags) = @_;
+sub init_build_features {
+    my ($self, $use_feature, $builtin_feature) = @_;
 
-    $self->SUPER::set_build_features($flags);
+    $self->SUPER::init_build_features($use_feature, $builtin_feature);
 
     require Dpkg::Arch;
     my $arch = Dpkg::Arch::get_host_arch();
 
     if (any { $_ eq $arch } qw(amd64 arm64 ppc64el s390x)) {
-        $flags->set_feature('optimize', 'lto', 1);
+        $use_feature->{optimize}{lto} = 1;
     }
+}
+
+sub set_build_features {
+    my ($self, $flags) = @_;
+
+    $self->SUPER::set_build_features($flags);
+
+    require Dpkg::Arch;
+    my $arch = Dpkg::Arch::get_host_arch();
 
     if ($arch eq 'ppc64el' && $flags->get_option_value('optimize-level') != 0) 
{
         $flags->set_option_value('optimize-level', 3);

-- 
Dpkg.Org's dpkg

Reply via email to