summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--scripts/Dpkg/Vendor/Debian.pm15
-rw-r--r--scripts/Test/Dpkg.pm43
-rw-r--r--scripts/po/ca.po2
-rw-r--r--scripts/po/de.po2
-rw-r--r--scripts/po/dpkg-dev.pot4
-rw-r--r--scripts/po/es.po2
-rw-r--r--scripts/po/fr.po2
-rw-r--r--scripts/po/nl.po2
-rw-r--r--scripts/po/pl.po2
-rw-r--r--scripts/po/pt.po2
-rw-r--r--scripts/po/ru.po2
-rw-r--r--scripts/po/sv.po2
-rw-r--r--scripts/t/Dpkg_BuildFlags.t51
-rw-r--r--scripts/t/Dpkg_OpenPGP.t84
14 files changed, 134 insertions, 81 deletions
diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index fcf5b1e..b3be69e 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -117,7 +117,7 @@ sub set_build_features {
time64 => undef,
},
qa => {
- bug => 0,
+ bug => undef,
'bug-implicit-func' => undef,
canary => 0,
},
@@ -297,10 +297,6 @@ sub set_build_features {
if ($use_feature{abi}{time64} && ! $builtin_feature{abi}{time64}) {
# On glibc 64-bit time_t support requires LFS.
$use_feature{abi}{lfs} = 1 if $libc eq 'gnu';
-
- # Require -Werror=implicit-function-declaration, to avoid linking
- # against the wrong symbol.
- $use_feature{qa}{'bug-implicit-func'} = 1;
}
# XXX: Handle lfs alias from future abi feature area.
@@ -311,7 +307,14 @@ sub set_build_features {
## Area: qa
- $use_feature{qa}{'bug-implicit-func'} //= $use_feature{qa}{bug};
+ # For time64 we require -Werror=implicit-function-declaration, to avoid
+ # linking against the wrong symbol. Instead of enabling this conditionally
+ # on time64 being enabled, do it unconditionally so that the effects are
+ # uniform and visible on all architectures. Unless it has been set
+ # explicitly.
+ $use_feature{qa}{'bug-implicit-func'} //= $use_feature{qa}{bug} // 1;
+
+ $use_feature{qa}{bug} //= 0;
## Area: reproducible
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
diff --git a/scripts/po/ca.po b/scripts/po/ca.po
index 6338f4a..6b3ac8d 100644
--- a/scripts/po/ca.po
+++ b/scripts/po/ca.po
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: dpkg-dev 1.21.18\n"
"Report-Msgid-Bugs-To: debian-dpkg@lists.debian.org\n"
-"POT-Creation-Date: 2024-02-27 04:27+0100\n"
+"POT-Creation-Date: 2024-03-10 20:21+0100\n"
"PO-Revision-Date: 2023-12-17 20:30+0100\n"
"Last-Translator: Guillem Jover <guillem@debian.org>\n"
"Language-Team: Catalan <debian-l10n-catalan@lists.debian.org>\n"
diff --git a/scripts/po/de.po b/scripts/po/de.po
index 6cbd867..d2806d2 100644
--- a/scripts/po/de.po
+++ b/scripts/po/de.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: dpkg-dev 1.22.5\n"
"Report-Msgid-Bugs-To: debian-dpkg@lists.debian.org\n"
-"POT-Creation-Date: 2024-02-27 04:27+0100\n"
+"POT-Creation-Date: 2024-03-10 20:21+0100\n"
"PO-Revision-Date: 2024-01-25 17:45+0100\n"
"Last-Translator: Helge Kreutzmann <debian@helgefjell.de>\n"
"Language-Team: German <debian-l10n-german@lists.debian.org>\n"
diff --git a/scripts/po/dpkg-dev.pot b/scripts/po/dpkg-dev.pot
index 7b03361..e318e2e 100644
--- a/scripts/po/dpkg-dev.pot
+++ b/scripts/po/dpkg-dev.pot
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: dpkg 1.22.5\n"
+"Project-Id-Version: dpkg 1.22.6\n"
"Report-Msgid-Bugs-To: debian-dpkg@lists.debian.org\n"
-"POT-Creation-Date: 2024-02-27 04:27+0100\n"
+"POT-Creation-Date: 2024-03-10 20:21+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/scripts/po/es.po b/scripts/po/es.po
index 1c92dd9..5147b90 100644
--- a/scripts/po/es.po
+++ b/scripts/po/es.po
@@ -31,7 +31,7 @@ msgid ""
msgstr ""
"Project-Id-Version: dpkg-dev 1.16.8\n"
"Report-Msgid-Bugs-To: debian-dpkg@lists.debian.org\n"
-"POT-Creation-Date: 2024-02-27 04:27+0100\n"
+"POT-Creation-Date: 2024-03-10 20:21+0100\n"
"PO-Revision-Date: 2014-12-02 20:24+0100\n"
"Last-Translator: Omar Campagne <ocampagne@gmail.com>\n"
"Language-Team: Spanish <debian-l10n-spanish@lists.debian.org>\n"
diff --git a/scripts/po/fr.po b/scripts/po/fr.po
index a690156..133d9cf 100644
--- a/scripts/po/fr.po
+++ b/scripts/po/fr.po
@@ -11,7 +11,7 @@ msgid ""
msgstr ""
"Project-Id-Version: dpkg-dev 1.21.20\n"
"Report-Msgid-Bugs-To: debian-dpkg@lists.debian.org\n"
-"POT-Creation-Date: 2024-02-27 04:27+0100\n"
+"POT-Creation-Date: 2024-03-10 20:21+0100\n"
"PO-Revision-Date: 2023-02-10 02:16+0100\n"
"Last-Translator: Sébastien Poher <sebastien@volted.net>\n"
"Language-Team: French <debian-l10n-french@lists.debian.org>\n"
diff --git a/scripts/po/nl.po b/scripts/po/nl.po
index 3d16f22..a523f41 100644
--- a/scripts/po/nl.po
+++ b/scripts/po/nl.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: dpkg-dev 1.21.19\n"
"Report-Msgid-Bugs-To: debian-dpkg@lists.debian.org\n"
-"POT-Creation-Date: 2024-02-27 04:27+0100\n"
+"POT-Creation-Date: 2024-03-10 20:21+0100\n"
"PO-Revision-Date: 2023-02-02 17:51+0100\n"
"Last-Translator: Frans Spiesschaert <Frans.Spiesschaert@yucom.be>\n"
"Language-Team: \n"
diff --git a/scripts/po/pl.po b/scripts/po/pl.po
index 3b04a9e..ab55496 100644
--- a/scripts/po/pl.po
+++ b/scripts/po/pl.po
@@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Project-Id-Version: dpkg-dev 1.15.4\n"
"Report-Msgid-Bugs-To: debian-dpkg@lists.debian.org\n"
-"POT-Creation-Date: 2024-02-27 04:27+0100\n"
+"POT-Creation-Date: 2024-03-10 20:21+0100\n"
"PO-Revision-Date: 2015-04-07 07:05+0200\n"
"Last-Translator: Łukasz Dulny <BartekChom@poczta.onet.pl>\n"
"Language-Team: Polish <debian-l10n-polish@lists.debian.org>\n"
diff --git a/scripts/po/pt.po b/scripts/po/pt.po
index 9d63df4..3ed6c01 100644
--- a/scripts/po/pt.po
+++ b/scripts/po/pt.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: dpkg-dev 1.22.0\n"
"Report-Msgid-Bugs-To: debian-dpkg@lists.debian.org\n"
-"POT-Creation-Date: 2024-02-27 04:27+0100\n"
+"POT-Creation-Date: 2024-03-10 20:21+0100\n"
"PO-Revision-Date: 2023-03-08 22:31+0000\n"
"Last-Translator: Américo Monteiro <a_monteiro@gmx.com>\n"
"Language-Team: Portuguese <>\n"
diff --git a/scripts/po/ru.po b/scripts/po/ru.po
index c4350d9..ff60a9c 100644
--- a/scripts/po/ru.po
+++ b/scripts/po/ru.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: dpkg-dev 1.17.23\n"
"Report-Msgid-Bugs-To: debian-dpkg@lists.debian.org\n"
-"POT-Creation-Date: 2024-02-27 04:27+0100\n"
+"POT-Creation-Date: 2024-03-10 20:21+0100\n"
"PO-Revision-Date: 2015-04-07 07:02+0200\n"
"Last-Translator: Yuri Kozlov <yuray@komyakino.ru>\n"
"Language-Team: Russian <debian-l10n-russian@lists.debian.org>\n"
diff --git a/scripts/po/sv.po b/scripts/po/sv.po
index 166b1e8..f55cae1 100644
--- a/scripts/po/sv.po
+++ b/scripts/po/sv.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: dpkg-dev 1.22.0\n"
"Report-Msgid-Bugs-To: debian-dpkg@lists.debian.org\n"
-"POT-Creation-Date: 2024-02-27 04:27+0100\n"
+"POT-Creation-Date: 2024-03-10 20:21+0100\n"
"PO-Revision-Date: 2023-12-27 14:43+0100\n"
"Last-Translator: Peter Krefting <peter@softwolves.pp.se>\n"
"Language-Team: Svenska <tp-sv@listor.tp-sv.se>\n"
diff --git a/scripts/t/Dpkg_BuildFlags.t b/scripts/t/Dpkg_BuildFlags.t
index 515ed15..23c3deb 100644
--- a/scripts/t/Dpkg_BuildFlags.t
+++ b/scripts/t/Dpkg_BuildFlags.t
@@ -16,7 +16,7 @@
use strict;
use warnings;
-use Test::More tests => 100;
+use Test::More tests => 118;
BEGIN {
$ENV{DEB_BUILD_ARCH} = 'amd64';
@@ -150,6 +150,37 @@ foreach my $area (sort keys %known_features) {
"supported features for area $area");
}
+# Test qa bug and bug-implicit-func defaults.
+undef $ENV{DEB_BUILD_MAINT_OPTIONS};
+$bf = Dpkg::BuildFlags->new();
+test_has_noflag($bf, 'CFLAGS', '-Werror=array-bounds');
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+
+$ENV{DEB_BUILD_MAINT_OPTIONS} = 'qa=+bug';
+$bf = Dpkg::BuildFlags->new();
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+test_has_flag($bf, 'CFLAGS', '-Werror=array-bounds');
+test_has_flag($bf, 'CFLAGS', '-Werror=clobbered');
+test_has_flag($bf, 'CFLAGS', '-Werror=volatile-register-var');
+test_has_flag($bf, 'CXXFLAGS', '-Werror=array-bounds');
+test_has_flag($bf, 'CXXFLAGS', '-Werror=clobbered');
+test_has_flag($bf, 'CXXFLAGS', '-Werror=volatile-register-var');
+
+$ENV{DEB_BUILD_MAINT_OPTIONS} = 'qa=-bug-implicit-func';
+$bf = Dpkg::BuildFlags->new();
+test_has_noflag($bf, 'CFLAGS', '-Werror=array-bounds');
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+
+$ENV{DEB_BUILD_MAINT_OPTIONS} = 'qa=+bug,-bug-implicit-func';
+$bf = Dpkg::BuildFlags->new();
+test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+test_has_flag($bf, 'CFLAGS', '-Werror=array-bounds');
+test_has_flag($bf, 'CFLAGS', '-Werror=clobbered');
+test_has_flag($bf, 'CFLAGS', '-Werror=volatile-register-var');
+test_has_flag($bf, 'CXXFLAGS', '-Werror=array-bounds');
+test_has_flag($bf, 'CXXFLAGS', '-Werror=clobbered');
+test_has_flag($bf, 'CXXFLAGS', '-Werror=volatile-register-var');
+
# Test lfs alias from abi to future, we need a 32-bit arch that does does
# not currently have this flag built-in.
$ENV{DEB_BUILD_ARCH} = 'i386';
@@ -184,7 +215,7 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
-test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
$ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=+time64';
$bf = Dpkg::BuildFlags->new();
@@ -200,7 +231,7 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
-test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
# 32-bit system with time32 and no time64.
$ENV{DEB_BUILD_ARCH} = 'hurd-i386';
@@ -212,7 +243,7 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
-test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
$ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=+time64';
$bf = Dpkg::BuildFlags->new();
@@ -220,7 +251,7 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
-test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
$ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=-time64';
$bf = Dpkg::BuildFlags->new();
@@ -228,7 +259,7 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
-test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
# 32-bit system with time32, time64 enabled by default.
$ENV{DEB_BUILD_ARCH} = 'armhf';
@@ -256,7 +287,7 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
test_has_flag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
test_has_flag($bf, 'CPPFLAGS', '-U_TIME_BITS');
-test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
# 64-bit system with built-in time64.
$ENV{DEB_BUILD_ARCH} = 'amd64';
@@ -268,7 +299,7 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
-test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
$ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=+time64';
$bf = Dpkg::BuildFlags->new();
@@ -276,7 +307,7 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
-test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
$ENV{DEB_BUILD_MAINT_OPTIONS} = 'abi=-time64';
$bf = Dpkg::BuildFlags->new();
@@ -284,6 +315,6 @@ test_has_noflag($bf, 'CPPFLAGS', '-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64');
test_has_noflag($bf, 'CPPFLAGS', '-U_LARGEFILE_SOURCE -U_FILE_OFFSET_BITS');
test_has_noflag($bf, 'CPPFLAGS', '-D_TIME_BITS=64');
test_has_noflag($bf, 'CPPFLAGS', '-U_TIME_BITS');
-test_has_noflag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
+test_has_flag($bf, 'CFLAGS', '-Werror=implicit-function-declaration');
# TODO: Add more test cases.
diff --git a/scripts/t/Dpkg_OpenPGP.t b/scripts/t/Dpkg_OpenPGP.t
index d409082..2902cf6 100644
--- a/scripts/t/Dpkg_OpenPGP.t
+++ b/scripts/t/Dpkg_OpenPGP.t
@@ -17,7 +17,7 @@ use strict;
use warnings;
use Test::More;
-use Test::Dpkg qw(:paths :needs);
+use Test::Dpkg qw(:paths :needs test_get_openpgp_backend);
use File::Compare;
@@ -25,14 +25,6 @@ use Dpkg::ErrorHandling;
use Dpkg::Path qw(find_command);
use Dpkg::OpenPGP::KeyHandle;
-my %backend_cmd = (
- auto => 'auto',
- 'gpg-sq' => 'gpg',
- gpg => 'gpg',
- sq => 'sq',
- sqop => 'sop',
- 'pgpainless-cli' => 'sop',
-);
my @cmds = test_needs_openpgp_backend();
unshift @cmds, 'auto';
@@ -58,48 +50,54 @@ foreach my $cmd (@cmds) {
my $datadir = test_get_data_path();
my $tempdir = test_get_temp_path();
- my $backend = $backend_cmd{$cmd};
+ my $backend = test_get_openpgp_backend($cmd);
my $openpgp = Dpkg::OpenPGP->new(
backend => $backend,
cmd => $cmd,
);
- ok($openpgp->dearmor('PUBLIC KEY BLOCK', "$datadir/dpkg-test-pub.asc", "$tempdir/dpkg-test-pub.pgp") == OPENPGP_OK(),
- "($backend:$cmd) dearmoring OpenPGP ASCII Armored certificate");
- ok($openpgp->armor('PUBLIC KEY BLOCK', "$tempdir/dpkg-test-pub.pgp", "$tempdir/dpkg-test-pub.asc") == OPENPGP_OK(),
- "($backend:$cmd) armoring OpenPGP binary certificate");
- test_diff("$datadir/dpkg-test-pub.asc", "$tempdir/dpkg-test-pub.asc",
- "($backend:$cmd) OpenPGP certificate dearmor/armor round-trip correctly");
-
- ok($openpgp->armor('SIGNATURE', "$datadir/sign-file.sig", "$tempdir/sign-file.asc") == OPENPGP_OK(),
- "($backend:$cmd) armoring OpenPGP binary signature succeeded");
- ok(compare("$datadir/sign-file.sig", "$tempdir/sign-file.asc") != 0,
- "($backend:$cmd) armoring OpenPGP ASCII Armor changed the file");
- ok($openpgp->armor('SIGNATURE', "$datadir/sign-file.asc", "$tempdir/sign-file-rearmor.asc") == OPENPGP_OK(),
- "($backend:$cmd) armoring OpenPGP armored signature succeeded");
- test_diff("$datadir/sign-file.asc", "$tempdir/sign-file-rearmor.asc",
- "($backend:$cmd) rearmoring OpenPGP ASCII Armor changed the file");
-
- ok($openpgp->dearmor('SIGNATURE', "$tempdir/sign-file.asc", "$tempdir/sign-file.sig") == OPENPGP_OK(),
- "($backend:$cmd) dearmoring OpenPGP armored signature succeeded");
- test_diff("$datadir/sign-file.sig", "$tempdir/sign-file.sig",
- "($backend:$cmd) dearmored OpenPGP ASCII Armor signature matches");
-
- my $cert = "$datadir/dpkg-test-pub.asc";
-
- ok($openpgp->inline_verify("$datadir/sign-file-inline.asc", undef, $cert) == OPENPGP_OK(),
- "($backend:$cmd) verify OpenPGP ASCII Armor inline signature");
- ok($openpgp->inline_verify("$datadir/sign-file-inline.sig", undef, $cert) == OPENPGP_OK(),
- "($backend:$cmd) verify OpenPGP binary inline signature");
-
- ok($openpgp->verify("$datadir/sign-file", "$datadir/sign-file.asc", $cert) == OPENPGP_OK(),
+ my $certfile = "$datadir/dpkg-test-pub.asc";
+ my $keyfile = "$datadir/dpkg-test-sec.asc";
+
+ SKIP: {
+ skip 'missing backend command', 13
+ unless $openpgp->{backend}->has_verify_cmd();
+
+ ok($openpgp->dearmor('PUBLIC KEY BLOCK', $certfile, "$tempdir/dpkg-test-pub.pgp") == OPENPGP_OK(),
+ "($backend:$cmd) dearmoring OpenPGP ASCII Armored certificate");
+ ok($openpgp->armor('PUBLIC KEY BLOCK', "$tempdir/dpkg-test-pub.pgp", "$tempdir/dpkg-test-pub.asc") == OPENPGP_OK(),
+ "($backend:$cmd) armoring OpenPGP binary certificate");
+ test_diff($certfile, "$tempdir/dpkg-test-pub.asc",
+ "($backend:$cmd) OpenPGP certificate dearmor/armor round-trip correctly");
+
+ ok($openpgp->armor('SIGNATURE', "$datadir/sign-file.sig", "$tempdir/sign-file.asc") == OPENPGP_OK(),
+ "($backend:$cmd) armoring OpenPGP binary signature succeeded");
+ ok(compare("$datadir/sign-file.sig", "$tempdir/sign-file.asc") != 0,
+ "($backend:$cmd) armoring OpenPGP ASCII Armor changed the file");
+ ok($openpgp->armor('SIGNATURE', "$datadir/sign-file.asc", "$tempdir/sign-file-rearmor.asc") == OPENPGP_OK(),
+ "($backend:$cmd) armoring OpenPGP armored signature succeeded");
+ test_diff("$datadir/sign-file.asc", "$tempdir/sign-file-rearmor.asc",
+ "($backend:$cmd) rearmoring OpenPGP ASCII Armor changed the file");
+
+ ok($openpgp->dearmor('SIGNATURE', "$tempdir/sign-file.asc", "$tempdir/sign-file.sig") == OPENPGP_OK(),
+ "($backend:$cmd) dearmoring OpenPGP armored signature succeeded");
+ test_diff("$datadir/sign-file.sig", "$tempdir/sign-file.sig",
+ "($backend:$cmd) dearmored OpenPGP ASCII Armor signature matches");
+
+ ok($openpgp->inline_verify("$datadir/sign-file-inline.asc", undef, $certfile) == OPENPGP_OK(),
+ "($backend:$cmd) verify OpenPGP ASCII Armor inline signature");
+ ok($openpgp->inline_verify("$datadir/sign-file-inline.sig", undef, $certfile) == OPENPGP_OK(),
+ "($backend:$cmd) verify OpenPGP binary inline signature");
+
+ ok($openpgp->verify("$datadir/sign-file", "$datadir/sign-file.asc", $certfile) == OPENPGP_OK(),
"($backend:$cmd) verify OpenPGP ASCII Armor detached signature");
- ok($openpgp->verify("$datadir/sign-file", "$datadir/sign-file.sig", $cert) == OPENPGP_OK(),
- "($backend:$cmd) verify OpenPGP binary detached signature");
+ ok($openpgp->verify("$datadir/sign-file", "$datadir/sign-file.sig", $certfile) == OPENPGP_OK(),
+ "($backend:$cmd) verify OpenPGP binary detached signature");
+ };
my $key = Dpkg::OpenPGP::KeyHandle->new(
type => 'keyfile',
- handle => "$datadir/dpkg-test-sec.asc",
+ handle => $keyfile,
);
SKIP: {
@@ -107,7 +105,7 @@ foreach my $cmd (@cmds) {
ok($openpgp->inline_sign("$datadir/sign-file", "$tempdir/sign-file-inline.asc", $key) == OPENPGP_OK(),
"($backend:$cmd) inline OpenPGP sign");
- ok($openpgp->inline_verify("$tempdir/sign-file-inline.asc", undef, $cert) == OPENPGP_OK(),
+ ok($openpgp->inline_verify("$tempdir/sign-file-inline.asc", undef, $certfile) == OPENPGP_OK(),
"($backend:$cmd) verify generated inline OpenPGP signature");
};