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=a7483666a0864fe0cfd0231432951e6084c7d24b

commit a7483666a0864fe0cfd0231432951e6084c7d24b
Author: Guillem Jover <[email protected]>
AuthorDate: Thu Jun 30 06:36:45 2022 +0200

    Dpkg::BuildFlags: Add a new use_feature() method
    
    This abstracts the feature state with this getter so that we can query
    it from code that needs to act on the features to set actual build
    flags.
---
 scripts/Dpkg/BuildFlags.pm | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/scripts/Dpkg/BuildFlags.pm b/scripts/Dpkg/BuildFlags.pm
index 0b204f77a..fb7c57a1b 100644
--- a/scripts/Dpkg/BuildFlags.pm
+++ b/scripts/Dpkg/BuildFlags.pm
@@ -278,6 +278,23 @@ sub set_feature {
     $self->{features}{$area}{$feature} = $enabled;
 }
 
+=item $bf->use_feature($area, $feature)
+
+Returns true if the given feature within a known feature areas has been
+enabled, and false otherwise.
+The only currently recognized feature areas are "future", "qa", "sanitize",
+"optimize", "hardening" and "reproducible".
+
+=cut
+
+sub use_feature {
+    my ($self, $area, $feature) = @_;
+
+    return 0 if ! $self->has_features($area);
+    return 0 if ! $self->{features}{$area}{$feature};
+    return 1;
+}
+
 =item $bf->strip($flag, $value, $source, $maint)
 
 Update the build flag $flag by stripping the flags listed in $value and
@@ -482,7 +499,7 @@ sub list {
 
 New option: 'vendor_defaults' in new().
 
-New method: $bf->load_vendor_defaults().
+New methods: $bf->load_vendor_defaults(), $bf->use_feature().
 
 =head2 Version 1.04 (dpkg 1.20.0)
 

-- 
Dpkg.Org's dpkg

Reply via email to