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=98ba31692fa946e518eedac627e2d0f140e103c9

commit 98ba31692fa946e518eedac627e2d0f140e103c9
Author: Guillem Jover <[email protected]>
AuthorDate: Wed Nov 2 02:43:07 2022 +0100

    Dpkg::OpenPGP: Refactor trusted keyrings from Dpkg::Source::Package
    
    Move all OpenPGP related knowledge inside the Dpkg::OpenPGP module,
    so that we can abstract it for multiple backends.
---
 scripts/Dpkg/OpenPGP.pm        | 10 ++++++++++
 scripts/Dpkg/Source/Package.pm |  5 ++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/scripts/Dpkg/OpenPGP.pm b/scripts/Dpkg/OpenPGP.pm
index 558072212..e28d9678e 100644
--- a/scripts/Dpkg/OpenPGP.pm
+++ b/scripts/Dpkg/OpenPGP.pm
@@ -54,6 +54,16 @@ sub new {
     return $self;
 }
 
+sub get_trusted_keyrings {
+    my $self = shift;
+
+    my @keyrings;
+    if (length $ENV{HOME} and -r "$ENV{HOME}/.gnupg/trustedkeys.gpg") {
+        push @keyrings, "$ENV{HOME}/.gnupg/trustedkeys.gpg";
+    }
+    return @keyrings;
+}
+
 # _pgp_* functions are strictly for applying or removing ASCII armor.
 # See <https://datatracker.ietf.org/doc/html/rfc4880#section-6> for more
 # details.
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index 169c1f6e8..6d0e86392 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -500,9 +500,8 @@ sub check_signature {
     my $dsc = $self->get_filename();
     my @certs;
 
-    if (length $ENV{HOME} and -r "$ENV{HOME}/.gnupg/trustedkeys.gpg") {
-        push @certs, "$ENV{HOME}/.gnupg/trustedkeys.gpg";
-    }
+    push @certs, $self->{openpgp}->get_trusted_keyrings();
+
     foreach my $vendor_keyring (run_vendor_hook('package-keyrings')) {
         if (-r $vendor_keyring) {
             push @certs, $vendor_keyring;

-- 
Dpkg.Org's dpkg

Reply via email to