Browse Source

Move Debian keyrings to the Debian vendor keyring hook

As Ubuntu is a derivative from Debian, make it inherit the Debian vendor
class when running the keyrings hook.
Guillem Jover 17 years ago
parent
commit
70bf111c9a
4 changed files with 22 additions and 11 deletions
  1. 2 0
      debian/changelog
  2. 0 6
      scripts/Dpkg/Source/Package.pm
  3. 15 2
      scripts/Dpkg/Vendor/Debian.pm
  4. 5 3
      scripts/Dpkg/Vendor/Ubuntu.pm

+ 2 - 0
debian/changelog

@@ -86,6 +86,8 @@ dpkg (1.15.1) UNRELEASED; urgency=low
   * Use backticks instead of non-portable make $(shell) function in automake.
   * Do not install dselect and start-stop-daemon man pages when the programs
     have been disabled from configure.
+  * Move Debian specific keyrings to the Debian vendor class and change the
+    Ubuntu vendor class to inherit from it.
 
   [ Frank Lichtenheld ]
   * Dpkg::Version: Remove unnecessary function next_elem which just

+ 0 - 6
scripts/Dpkg/Source/Package.pm

@@ -288,12 +288,6 @@ sub check_signature {
                 push @exec, "--keyring", $vendor_keyring;
             }
         }
-        if (-r '/usr/share/keyrings/debian-keyring.gpg') {
-            push @exec, "--keyring", "/usr/share/keyrings/debian-keyring.gpg";
-        }
-        if (-r '/usr/share/keyrings/debian-maintainers.gpg') {
-            push @exec, "--keyring", "/usr/share/keyrings/debian-maintainers.gpg";
-        }
         push @exec, $dsc;
 
         my ($stdout, $stderr);

+ 15 - 2
scripts/Dpkg/Vendor/Debian.pm

@@ -29,9 +29,22 @@ Dpkg::Vendor::Debian - Debian vendor object
 
 =head1 DESCRIPTION
 
-This object is empty. It inherits everything from
-Dpkg::Vendor::Default.
+This vendor object customize the behaviour of dpkg scripts
+for Debian specific actions.
 
 =cut
 
+sub run_hook {
+    my ($self, $hook, @params) = @_;
+
+    if ($hook eq "before-source-build") {
+        my $srcpkg = shift @params;
+    } elsif ($hook eq "before-changes-creation") {
+        my $fields = shift @params;
+    } elsif ($hook eq "keyrings") {
+        return ('/usr/share/keyrings/debian-keyring.gpg',
+                '/usr/share/keyrings/debian-maintainers.gpg');
+    }
+}
+
 1;

+ 5 - 3
scripts/Dpkg/Vendor/Ubuntu.pm

@@ -21,11 +21,10 @@ package Dpkg::Vendor::Ubuntu;
 use strict;
 use warnings;
 
-use Dpkg::Vendor::Default;
 use Dpkg::ErrorHandling;
 use Dpkg::Gettext;
 
-our @ISA = qw(Dpkg::Vendor::Default);
+use base 'Dpkg::Vendor::Debian';
 
 =head1 NAME
 
@@ -70,7 +69,10 @@ sub run_hook {
         }
 
     } elsif ($hook eq "keyrings") {
-        return '/usr/share/keyrings/ubuntu-archive-keyring.gpg';
+        my @keyrings = $self->SUPER::run_hook($hook);
+
+        push(@keyrings, '/usr/share/keyrings/ubuntu-archive-keyring.gpg');
+        return @keyrings;
     }
 }