Re: Allowing a distribution's Dpkg::Vendor::* to completely remove all build flags
Hi!
On Fri, 2019-07-26 at 09:16:41 -0700, Daniel Schepler wrote:
> However, I've discovered that on my custom system, debhelper currently
> sets empty environment variables for CFLAGS, CXXFLAGS, LDFLAGS, etc.
> which results in decidedly non-default builds for many packages. So,
> I think what I would want would be that my Dpkg::Vendor::UnFrobbed
> module would cause dpkg-buildflags to return no output at all, not
> just empty output for each variable.
>
> Given that, would it make sense to add interfaces in Dpkg::BuildFlags
> to remove all entries entirely from the internal hash tables, and/or
> to remove one particular entry?
Sure, why not! I don't think this would be a sane default as it would
be pretty unexpected, and it would break backwards compatibility. But
adding something like you propose in the form of a new unset() method
(such as in the attached PoC) I think would work for you, as it could
be called from your Dpkg::Vendor::Unfrobbed module, after getting the
list of flags with the list() method.
So would something like the attached work for you? :)
Thanks,
Guillem
diff --git i/scripts/Dpkg/BuildFlags.pm w/scripts/Dpkg/BuildFlags.pm
index a8fd4584a..edf16e4f3 100644
--- i/scripts/Dpkg/BuildFlags.pm
+++ w/scripts/Dpkg/BuildFlags.pm
@@ -18,7 +18,7 @@ package Dpkg::BuildFlags;
use strict;
use warnings;
-our $VERSION = '1.03';
+our $VERSION = '1.04';
use Dpkg ();
use Dpkg::Gettext;
@@ -214,6 +212,20 @@ sub load_config {
$self->load_maintainer_config();
}
+=item $bf->unset($flag)
+
+Unset the build flag $flag, so that it will not be known anymore.
+
+=cut
+
+sub unset {
+ my ($self, $flag) = @_;
+
+ delete $self->{flags}->{$flag};
+ delete $self->{origin}->{$flag};
+ delete $self->{maintainer}->{$flag};
+}
+
=item $bf->set($flag, $value, $source, $maint)
Update the build flag $flag with value $value and record its origin as
@@ -442,6 +454,10 @@ sub list {
=head1 CHANGES
+=head2 Version 1.04 (dpkg 1.20.0)
+
+New method: $bf->unset().
+
=head2 Version 1.03 (dpkg 1.16.5)
New method: $bf->get_feature_areas() to list possible values for
Reply to: