From f3cd649313063ef9d72a3a4a0ab5b4af598c8c9f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 20:42:36 +0200 Subject: Merging upstream version 1.22.6. Signed-off-by: Daniel Baumann --- scripts/Test/Dpkg.pm | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) (limited to 'scripts/Test') diff --git a/scripts/Test/Dpkg.pm b/scripts/Test/Dpkg.pm index 1632ad8..ce98be2 100644 --- a/scripts/Test/Dpkg.pm +++ b/scripts/Test/Dpkg.pm @@ -47,6 +47,7 @@ our @EXPORT_OK = qw( test_needs_openpgp_backend test_needs_srcdir_switch test_neutralize_checksums + test_get_openpgp_backend ); our %EXPORT_TAGS = ( needs => [ qw( @@ -197,21 +198,41 @@ sub test_needs_command } } +my %openpgp_command = ( + 'gpg-sq' => { + backend => 'gpg', + }, + 'gpg' => { + backend => 'gpg', + }, + 'sq' => { + backend => 'sq', + }, + 'sqop' => { + backend => 'sop', + }, + 'pgpainless-cli' => { + backend => 'sop', + }, +); + sub test_needs_openpgp_backend { - my @backends = qw( - gpg-sq - gpg - sq - sqop - pgpainless-cli - ); - my @cmds = grep { can_run($_) } @backends; - if (@cmds == 0) { - plan skip_all => "requires >= 1 openpgp command: @backends"; + my @cmds = sort keys %openpgp_command; + my @have_cmds = grep { can_run($_) } @cmds; + if (@have_cmds == 0) { + plan skip_all => "requires >= 1 openpgp command: @cmds"; } - return @cmds; + return @have_cmds; +} + +sub test_get_openpgp_backend +{ + my $cmd = shift; + + return 'auto' if $cmd eq 'auto'; + return $openpgp_command{$cmd}{backend}; } sub test_needs_srcdir_switch -- cgit v1.2.3