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=e44684be3d97f280b50ff4024f9547bf1a6cd10a

commit e44684be3d97f280b50ff4024f9547bf1a6cd10a
Author: Guillem Jover <[email protected]>
AuthorDate: Thu Nov 10 04:49:53 2022 +0100

    Dpkg::Source::Package: Call armor() unconditionally for signature conversion
    
    When we find a potentially binary signature (with a «.sig» extension),
    we simply unconditionally run armor() which now behaves in an idempotent
    way.
---
 scripts/Dpkg/Source/Package.pm  | 10 ++--------
 scripts/t/Dpkg_Source_Package.t |  9 +++++----
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index 7aacffaf5..169c1f6e8 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -45,7 +45,7 @@ use Exporter qw(import);
 use POSIX qw(:errno_h :sys_wait_h);
 use Carp;
 use File::Temp;
-use File::Copy qw(cp copy);
+use File::Copy qw(cp);
 use File::Basename;
 use File::Spec;
 
@@ -437,13 +437,7 @@ sub armor_original_tarball_signature {
     my ($self, $bin, $asc) = @_;
 
     if (-e $bin) {
-        if ($self->{openpgp}->is_armored($bin)) {
-            notice(g_('signature file is already OpenPGP ASCII armor, 
copying'));
-            copy($bin, $asc);
-            return $asc;
-        }
-
-        return $asc if $self->{openpgp}->armor('SIGNATURE', $bin, $asc) == 0;
+        return $self->{openpgp}->armor('SIGNATURE', $bin, $asc);
     }
 
     return;
diff --git a/scripts/t/Dpkg_Source_Package.t b/scripts/t/Dpkg_Source_Package.t
index 5430f2e8e..c9c66d416 100644
--- a/scripts/t/Dpkg_Source_Package.t
+++ b/scripts/t/Dpkg_Source_Package.t
@@ -22,6 +22,7 @@ use Test::Dpkg qw(:paths :needs);
 use File::Compare;
 
 use Dpkg::ErrorHandling;
+use Dpkg::OpenPGP::ErrorCodes;
 
 test_needs_command('gpg');
 
@@ -42,8 +43,8 @@ 
is($p->armor_original_tarball_signature("$datadir/nonexistent", $ascfile),
    undef, 'no conversion of inexistent file');
 
 $ascfile = "$tmpdir/package_1.0.orig.tar.sig2asc";
-ok(defined 
$p->armor_original_tarball_signature("$datadir/package_1.0.orig.tar.sig", 
$ascfile),
-   'conversion from binary sig to armored asc');
+is($p->armor_original_tarball_signature("$datadir/package_1.0.orig.tar.sig", 
$ascfile),
+   OPENPGP_OK, 'conversion from binary sig to armored asc');
 
 ok(compare($ascfile, "$datadir/package_1.0.orig.tar.asc") == 0,
    'binary signature converted to OpenPGP ASCII Armor');
@@ -51,8 +52,8 @@ ok(compare($ascfile, "$datadir/package_1.0.orig.tar.asc") == 
0,
 # Grab the output messages.
 eval {
     $ascfile = "$tmpdir/package_1.0.orig.tar.asc2asc";
-    ok(defined 
$p->armor_original_tarball_signature("$datadir/package_1.0.orig.tar.asc", 
$ascfile),
-       'copy instead of converting already armored input');
+    
is($p->armor_original_tarball_signature("$datadir/package_1.0.orig.tar.asc", 
$ascfile),
+       OPENPGP_OK, 'copy instead of converting already armored input');
 };
 
 ok(compare($ascfile, "$datadir/package_1.0.orig.tar.asc") == 0,

-- 
Dpkg.Org's dpkg

Reply via email to