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=ba0b8701392e5468570cbafdf8f223948b2105b5 commit ba0b8701392e5468570cbafdf8f223948b2105b5 Author: Guillem Jover <[email protected]> AuthorDate: Tue Aug 6 13:47:02 2024 +0200 dpkg-shlibdeps: Add symbolic name alternative to --warnings bits Make selecting the warnings to use more user friendly for both the caller, and whoever comes next and reads the command line calling the tool, by adding support for symbolic warning names. --- man/dpkg-shlibdeps.pod | 41 +++++++++++++++++++++++++++++------------ scripts/dpkg-shlibdeps.pl | 10 +++++++++- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/man/dpkg-shlibdeps.pod b/man/dpkg-shlibdeps.pod index 2e83808dc..4e030b472 100644 --- a/man/dpkg-shlibdeps.pod +++ b/man/dpkg-shlibdeps.pod @@ -326,18 +326,35 @@ Usage of this option is discouraged, all libraries should provide dependency information (either with shlibs files, or with symbols files) even if they are not yet used by other packages. -=item B<--warnings=>I<value> - -I<value> is a bit field defining the set of warnings that -can be emitted by B<dpkg-shlibdeps> (since dpkg 1.14.17). -Bit 0 (value=1) enables the warning “symbol I<sym> used by I<binary> -found in none of the libraries”, bit 1 (value=2) enables the warning -“package could avoid a useless dependency” and bit 2 (value=4) enables -the warning “I<binary> should not be linked against I<library>”. -The default I<value> is 3: the first two warnings are active by -default, the last one is not. -Set I<value> to 7 if you want all -warnings to be active. +=item B<--warnings=>[I<value>|I<string>[,...]] + +Select the set of warnings that can be emitted by B<dpkg-shlibdeps> +(since dpkg 1.14.17). + +The warnings can be selected from a comma-separated list of symbolic +names (since dpkg 1.22.12), +or from a I<value> denoting a bit field for these warnings. + +=over + +=item symbol-not-found (bit 0, value 1) + +Selects the warning “symbol I<sym> used by I<binary> found in none of the +libraries”. + +Enabled by default. + +=item avoidable-dependency (bit 1, value 2) + +Selects the warning “package could avoid a useless dependency”. + +Enabled by default. + +=item useless-linkage (bit 2, value 4) + +Select the warning “I<binary> should not be linked against I<library>”. + +=back =item B<--admindir=>I<dir> diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl index d482a98b2..b46f8fd0d 100755 --- a/scripts/dpkg-shlibdeps.pl +++ b/scripts/dpkg-shlibdeps.pl @@ -25,7 +25,7 @@ use strict; use warnings; use feature qw(state); -use List::Util qw(any none); +use List::Util qw(any none sum); use Cwd qw(realpath); use File::Basename qw(dirname); @@ -54,6 +54,12 @@ use constant { WARN_NOT_NEEDED => 4, }; +my %warn2bits = ( + 'symbol-not-found' => WARN_SYM_NOT_FOUND, + 'avoidable-dependency' => WARN_DEP_AVOIDABLE, + 'useless-linkage' => WARN_NOT_NEEDED, +); + # By increasing importance my @depfields = qw(Suggests Recommends Depends Pre-Depends); my $i = 0; my %depstrength = map { $_ => $i++ } @depfields; @@ -122,6 +128,8 @@ foreach (@ARGV) { $ignore_missing_info = 1; } elsif (m/^--warnings=(\d+)$/) { $warnings = $1; + } elsif (m/^--warnings=([a-z,-]+)$/) { + $warnings = sum map { $warn2bits{$_} } split m{,}, $1; } elsif (m/^--package=(.+)$/) { $oppackage = $1; my $err = pkg_name_is_illegal($oppackage); -- Dpkg.Org's dpkg

