[PATCH 1/3] Dpkg::BuildFlags: simplify update-buildflags hook
Pass the entire Dpkg::BuildFlags object to update-buildflags, so that
hooks can use its set() method rather than setting hash elements
directly.
---
scripts/Dpkg/BuildFlags.pm | 2 +-
scripts/Dpkg/Vendor/Default.pm | 8 ++++----
scripts/Dpkg/Vendor/Ubuntu.pm | 3 +--
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/scripts/Dpkg/BuildFlags.pm b/scripts/Dpkg/BuildFlags.pm
index 0ab93fb..c4f9a95 100644
--- a/scripts/Dpkg/BuildFlags.pm
+++ b/scripts/Dpkg/BuildFlags.pm
@@ -84,7 +84,7 @@ sub load_vendor_defaults {
FFLAGS => 'vendor',
LDFLAGS => 'vendor',
};
- run_vendor_hook("update-buildflags", $self->{flags}, $self->{origin});
+ run_vendor_hook("update-buildflags", $self);
}
=item $bf->load_system_config()
diff --git a/scripts/Dpkg/Vendor/Default.pm b/scripts/Dpkg/Vendor/Default.pm
index 8e3743b..ee2d495 100644
--- a/scripts/Dpkg/Vendor/Default.pm
+++ b/scripts/Dpkg/Vendor/Default.pm
@@ -98,11 +98,11 @@ The hook is called in Dpkg::Changelog to post-process a
Dpkg::Changelog::Entry after it has been created and filled with the
appropriate values.
-=item update-buildflags ($flags, $origin)
+=item update-buildflags ($flags)
The hook is called in Dpkg::BuildFlags to allow the vendor to override
-the default values set for the various build flags. $flags and $origin
-are hash reference.
+the default values set for the various build flags. $flags is a
+Dpkg::BuildFlags object.
=back
@@ -122,7 +122,7 @@ sub run_hook {
} elsif ($hook eq "extend-patch-header") {
my ($textref, $ch_info) = @params;
} elsif ($hook eq "update-buildflags") {
- my ($flags, $origin) = @params;
+ my $flags = shift @params;
}
# Default return value for unknown/unimplemented hooks
diff --git a/scripts/Dpkg/Vendor/Ubuntu.pm b/scripts/Dpkg/Vendor/Ubuntu.pm
index db58493..fa4b7d0 100644
--- a/scripts/Dpkg/Vendor/Ubuntu.pm
+++ b/scripts/Dpkg/Vendor/Ubuntu.pm
@@ -92,9 +92,8 @@ sub run_hook {
} elsif ($hook eq "update-buildflags") {
my $flags = shift @params;
- my $origin = shift @params;
# Per https://wiki.ubuntu.com/DistCompilerFlags
- $flags->{'LDFLAGS'} = '-Wl,-Bsymbolic-functions';
+ $flags->set('LDFLAGS', '-Wl,-Bsymbolic-functions', 'vendor');
} else {
return $self->SUPER::run_hook($hook, @params);
--
1.7.1
Reply to: