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=02e9c01cd797d20a02b696197fe5849b418f617f commit 02e9c01cd797d20a02b696197fe5849b418f617f Author: Guillem Jover <[email protected]> AuthorDate: Sat Dec 10 13:55:26 2022 +0100 dpkg-buildflags: Add support for features handled as builtin defaults --- man/dpkg-buildflags.pod | 17 +++++++++++++++-- scripts/Dpkg/Vendor/Debian.pm | 4 ++-- scripts/dpkg-buildflags.pl | 20 +++++++++++++++++--- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/man/dpkg-buildflags.pod b/man/dpkg-buildflags.pod index fb4e451b7..7ec5db192 100644 --- a/man/dpkg-buildflags.pod +++ b/man/dpkg-buildflags.pod @@ -182,8 +182,9 @@ the flag is set/modified by an environment-specific configuration. Print any information that can be useful to explain the behaviour of the program: current vendor, relevant environment variables, feature areas, -state of all feature flags, and the compiler flags with their origin -(since dpkg 1.19.0). +state of all feature flags, whether a feature is handled as a builtin +default by the compiler (since dpkg dpkg 1.21.14), +and the compiler flags with their origin (since dpkg 1.19.0). For example: @@ -195,10 +196,18 @@ For example: Features: bug=no canary=no + Builtins: + + Area: hardening + Features: + pie=no + Builtins: + pie=yes Area: reproducible Features: timeless=no + Builtins: Flag: CFLAGS Value: -O0 -Wall @@ -211,6 +220,9 @@ For example: =item B<--query-features> I<area> Print the features enabled for a given area (since dpkg 1.16.2). +If the feature is handled (even if only on some architectures) as a +builtin default by the compiler, then a B<Builtin> field is printed +(since dpkg 1.21.14). The only currently recognized areas on Debian and derivatives are B<future>, B<qa>, B<reproducible>, B<sanitize> and B<hardening>, see the B<FEATURE AREAS> @@ -222,6 +234,7 @@ For example: Feature: pie Enabled: yes + Builtin: yes Feature: stackprotector Enabled: yes diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm index c293a99d6..b08202b1b 100644 --- a/scripts/Dpkg/Vendor/Debian.pm +++ b/scripts/Dpkg/Vendor/Debian.pm @@ -434,8 +434,8 @@ sub _add_build_flags { # Set used features to their builtin setting if unset. foreach my $area (sort keys %builtin_feature) { - foreach my $feature (keys %{$builtin_feature{$area}}) { - $use_feature{$area}{$feature} //= $builtin_feature{$area}{$feature}; + while (my ($feature, $state) = each %{$builtin_feature{$area}}) { + $flags->set_builtin($area, $feature, $state); } } diff --git a/scripts/dpkg-buildflags.pl b/scripts/dpkg-buildflags.pl index 825e92bc2..33c4c92fe 100755 --- a/scripts/dpkg-buildflags.pl +++ b/scripts/dpkg-buildflags.pl @@ -118,11 +118,13 @@ if ($action eq 'list') { exit 1 unless $build_flags->has_features($param); my %features = $build_flags->get_features($param); + my %builtins = $build_flags->get_builtins($param); my $para_shown = 0; foreach my $feature (sort keys %features) { print $para_shown++ ? "\n" : ''; printf "Feature: %s\n", $feature; - printf "Enabled: %s\n", $features{$feature} ? 'yes' : 'no'; + printf "Enabled: %s\n", $features{$feature} // $builtins{$feature} ? 'yes' : 'no'; + printf "Builtin: %s\n", $builtins{$feature} ? 'yes' : 'no' if exists $builtins{$feature}; } } elsif ($action =~ m/^export-(.*)$/) { my $export_type = $1; @@ -160,8 +162,13 @@ if ($action eq 'list') { print "Area: $area\n"; print "Features:\n"; my %features = $build_flags->get_features($area); + my %builtins = $build_flags->get_builtins($area); foreach my $feature (sort keys %features) { - printf " %s=%s\n", $feature, $features{$feature} ? 'yes' : 'no'; + printf " %s=%s\n", $feature, $features{$feature} // $builtins{$feature} ? 'yes' : 'no'; + } + print "Builtins:\n"; + foreach my $feature (sort keys %builtins) { + printf " %s=%s\n", $feature, $builtins{$feature} ? 'yes' : 'no'; } } @@ -197,10 +204,17 @@ if ($action eq 'list') { foreach my $area (sort $build_flags->get_feature_areas()) { my $fs; my %features = $build_flags->get_features($area); + my %builtins = $build_flags->get_builtins($area); foreach my $feature (sort keys %features) { - $fs .= sprintf(' %s=%s', $feature, $features{$feature} ? 'yes' : 'no'); + $fs .= sprintf(' %s=%s', $feature, $features{$feature} // $builtins{$feature} ? 'yes' : 'no'); } print report(REPORT_STATUS, "$area features:$fs"); + my $bs = q{}; + foreach my $feature (sort keys %builtins) { + next if ! exists $builtins{$feature}; + $bs .= sprintf(' %s=%s', $feature, $builtins{$feature} ? 'yes' : 'no'); + } + print report(REPORT_STATUS, "$area builtins:$bs"); } # Then the resulting values (with their origin): foreach my $flag ($build_flags->list()) { -- Dpkg.Org's dpkg

