Explorar o código

scripts: Add GnuPG 2.x support

Add gnupg2 and gpgv2 as alternative Recommends to gnupg and gpgv (to
not pull them by default, as that would change the current default
build environment pulled in by dpkg-dev), but prefer gpgv2 over gpgv,
and gpg2 over gpg at run-time if they are available, so that users
installing the alternatives can benefit from the new implementations.
Guillem Jover %!s(int64=12) %!d(string=hai) anos
pai
achega
5c2eff4315
Modificáronse 4 ficheiros con 19 adicións e 6 borrados
  1. 3 0
      debian/changelog
  2. 4 2
      debian/control
  3. 6 1
      scripts/Dpkg/Source/Package.pm
  4. 6 3
      scripts/dpkg-buildpackage.pl

+ 3 - 0
debian/changelog

@@ -97,6 +97,9 @@ dpkg (1.17.2) UNRELEASED; urgency=low
       @tar_ignore_default_pattern package variables.
       @tar_ignore_default_pattern package variables.
     - Dpkg::Changelog::Entry::Debian: Deprecate $regex_header and
     - Dpkg::Changelog::Entry::Debian: Deprecate $regex_header and
       $regex_trailer package variables.
       $regex_trailer package variables.
+  * Add GnuPG 2.x support. Add gnupg2 and gpgv2 as alternative Recommends to
+    gnupg and gpgv (to not pull them by default), but prefer gpgv2 over gpgv,
+    and gpg2 over gpg at run-time if they are available.
 
 
   [ Updated programs translations ]
   [ Updated programs translations ]
   * German (Sven Joachim).
   * German (Sven Joachim).

+ 4 - 2
debian/control

@@ -51,7 +51,8 @@ Architecture: all
 Multi-Arch: foreign
 Multi-Arch: foreign
 Depends: libdpkg-perl (= ${source:Version}), bzip2, xz-utils,
 Depends: libdpkg-perl (= ${source:Version}), bzip2, xz-utils,
  patch, make, binutils, base-files (>= 5.0.0), ${misc:Depends}
  patch, make, binutils, base-files (>= 5.0.0), ${misc:Depends}
-Recommends: gcc | c-compiler, build-essential, fakeroot, gnupg, gpgv, libalgorithm-merge-perl
+Recommends: gcc | c-compiler, build-essential, fakeroot,
+ gnupg | gnupg2, gpgv | gpgv2, libalgorithm-merge-perl
 Suggests: debian-keyring
 Suggests: debian-keyring
 Breaks: dpkg-cross (<< 2.0.0), devscripts (<< 2.10.26)
 Breaks: dpkg-cross (<< 2.0.0), devscripts (<< 2.10.26)
 Replaces: manpages-it (<< 2.80-4)
 Replaces: manpages-it (<< 2.80-4)
@@ -69,7 +70,8 @@ Architecture: all
 Multi-Arch: foreign
 Multi-Arch: foreign
 Depends: dpkg (>= 1.15.8), perl, libtimedate-perl, ${misc:Depends}
 Depends: dpkg (>= 1.15.8), perl, libtimedate-perl, ${misc:Depends}
 Recommends: libfile-fcntllock-perl, bzip2, xz-utils
 Recommends: libfile-fcntllock-perl, bzip2, xz-utils
-Suggests: debian-keyring, gnupg, gpgv, gcc | c-compiler, binutils, patch
+Suggests: debian-keyring, gnupg | gnupg2, gpgv | gpgv2,
+ gcc | c-compiler, binutils, patch
 Breaks: dpkg-dev (<< 1.15.6)
 Breaks: dpkg-dev (<< 1.15.6)
 Replaces: dpkg (<< 1.15.8), dpkg-dev (<< 1.15.6)
 Replaces: dpkg (<< 1.15.8), dpkg-dev (<< 1.15.6)
 Description: Dpkg perl modules
 Description: Dpkg perl modules

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

@@ -370,8 +370,13 @@ sub check_signature {
     my ($self) = @_;
     my ($self) = @_;
     my $dsc = $self->get_filename();
     my $dsc = $self->get_filename();
     my @exec;
     my @exec;
-    if (find_command('gpgv')) {
+
+    if (find_command('gpgv2')) {
+        push @exec, 'gpgv2';
+    } elsif (find_command('gpgv')) {
         push @exec, 'gpgv';
         push @exec, 'gpgv';
+    } elsif (find_command('gpg2')) {
+        push @exec, 'gpg2', '--no-default-keyring', '-q', '--verify';
     } elsif (find_command('gpg')) {
     } elsif (find_command('gpg')) {
         push @exec, 'gpg', '--no-default-keyring', '-q', '--verify';
         push @exec, 'gpg', '--no-default-keyring', '-q', '--verify';
     }
     }

+ 6 - 3
scripts/dpkg-buildpackage.pl

@@ -324,9 +324,12 @@ if (build_sourceonly) {
 
 
 if (!defined $signcommand &&
 if (!defined $signcommand &&
     (($ENV{GNUPGHOME} && -e $ENV{GNUPGHOME}) ||
     (($ENV{GNUPGHOME} && -e $ENV{GNUPGHOME}) ||
-     ($ENV{HOME} && -e "$ENV{HOME}/.gnupg")) &&
-    find_command('gpg')) {
-    $signcommand = 'gpg';
+     ($ENV{HOME} && -e "$ENV{HOME}/.gnupg"))) {
+    if (find_command('gpg2')) {
+        $signcommand = 'gpg2';
+    } elsif (find_command('gpg')) {
+        $signcommand = 'gpg';
+    }
 }
 }
 
 
 if (not $signcommand) {
 if (not $signcommand) {