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=32e9c5a319b8abe17f9806fc6737a58237a2aa24

commit 32e9c5a319b8abe17f9806fc6737a58237a2aa24
Author: Guillem Jover <[email protected]>
AuthorDate: Mon Jan 2 12:29:30 2023 +0100

    Dpkg::BuildFlags: Add new get_feature() method
    
    This is relevant with builtin features where use_feature() will coerce
    the returned value into true or false, and where undef is a valid ternary
    state we use to track the default the compiler might have.
---
 scripts/Dpkg/BuildFlags.pm | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/scripts/Dpkg/BuildFlags.pm b/scripts/Dpkg/BuildFlags.pm
index 2487f8681..4370c2545 100644
--- a/scripts/Dpkg/BuildFlags.pm
+++ b/scripts/Dpkg/BuildFlags.pm
@@ -19,7 +19,7 @@ package Dpkg::BuildFlags;
 use strict;
 use warnings;
 
-our $VERSION = '1.05';
+our $VERSION = '1.06';
 
 use Dpkg ();
 use Dpkg::Gettext;
@@ -280,6 +280,22 @@ sub set_feature {
     $self->{features}{$area}{$feature} = $enabled;
 }
 
+=item $bf->get_feature($area, $feature)
+
+Returns the value for the given feature within a known feature area.
+This is relevant for builtin features where the feature has a ternary
+state of true, false and undef, and where the latter cannot be retrieved
+with use_feature().
+
+=cut
+
+sub get_feature {
+    my ($self, $area, $feature) = @_;
+
+    return if ! $self->has_features($area);
+    return $self->{features}{$area}{$feature};
+}
+
 =item $bf->use_feature($area, $feature)
 
 Returns true if the given feature within a known feature areas has been
@@ -552,6 +568,10 @@ sub list {
 
 =head1 CHANGES
 
+=head2 Version 1.06 (dpkg 1.21.15)
+
+New method: $bf->get_feature().
+
 =head2 Version 1.05 (dpkg 1.21.14)
 
 New option: 'vendor_defaults' in new().

-- 
Dpkg.Org's dpkg

Reply via email to