Bug#767914: [PATCH] apt: support either gnupg 1 or 2.
Package: apt
Version: 1.0.9.3
Signed-off-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
---
apt-pkg/contrib/gpgv.cc | 6 +++++-
cmdline/apt-key.in | 10 ++++++++--
debian/control | 2 +-
doc/examples/configure-index | 2 +-
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/apt-pkg/contrib/gpgv.cc b/apt-pkg/contrib/gpgv.cc
index f24dd96..ea8f03a 100644
--- a/apt-pkg/contrib/gpgv.cc
+++ b/apt-pkg/contrib/gpgv.cc
@@ -43,7 +43,11 @@ void ExecGPGV(std::string const &File, std::string const &FileGPG,
int const &statusfd, int fd[2])
{
#define EINTERNAL 111
- std::string const gpgvpath = _config->Find("Dir::Bin::gpg", "/usr/bin/gpgv");
+ std::string gpgv_bin = "/usr/bin/gpgv2";
+ if (FileExists(gpgv_bin) == false) {
+ gpgv_bin = "/usr/bin/gpgv";
+ }
+ std::string const gpgvpath = _config->Find("Dir::Bin::gpg", gpgv_bin);
// FIXME: remove support for deprecated APT::GPGV setting
std::string const trustedFile = _config->Find("APT::GPGV::TrustedKeyring", _config->FindFile("Dir::Etc::Trusted"));
std::string const trustedPath = _config->FindDir("Dir::Etc::TrustedParts");
diff --git a/cmdline/apt-key.in b/cmdline/apt-key.in
index 0774cf4..b811e58 100644
--- a/cmdline/apt-key.in
+++ b/cmdline/apt-key.in
@@ -3,7 +3,13 @@
set -e
unset GREP_OPTIONS
-GPG_CMD="gpg --ignore-time-conflict --no-options --no-default-keyring"
+if type gpg2 2>/dev/null 1>/dev/null; then
+ gpg_bin=gpg2
+else
+ gpg_bin=gpg
+fi
+
+GPG_CMD="$gpg_bin --ignore-time-conflict --no-options --no-default-keyring"
# gpg needs (in different versions more or less) files to function correctly,
# so we give it its own homedir and generate some valid content for it
@@ -306,7 +312,7 @@ if [ -z "$command" ]; then
fi
shift
-if [ "$command" != "help" ] && ! which gpg >/dev/null 2>&1; then
+if [ "$command" != "help" ] && ! which $gpg_bin >/dev/null 2>&1; then
echo >&2 "Warning: gnupg does not seem to be installed."
echo >&2 "Warning: apt-key requires gnupg for most operations."
echo >&2
diff --git a/debian/control b/debian/control
index 0437aa7..a179094 100644
--- a/debian/control
+++ b/debian/control
@@ -18,7 +18,7 @@ XS-Testsuite: autopkgtest
Package: apt
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, ${apt:keyring}, gnupg
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${apt:keyring}, gnupg | gnupg2, gpgv | gpgv2
Replaces: manpages-pl (<< 20060617-3~), manpages-it (<< 2.80-4~), sun-java6-jdk (>> 0), sun-java5-jdk (>> 0), openjdk-6-jdk (<< 6b24-1.11-0ubuntu1~)
Breaks: manpages-pl (<< 20060617-3~), manpages-it (<< 2.80-4~), sun-java6-jdk (>> 0), sun-java5-jdk (>> 0), openjdk-6-jdk (<< 6b24-1.11-0ubuntu1~)
Conflicts: python-apt (<< 0.7.93.2~)
diff --git a/doc/examples/configure-index b/doc/examples/configure-index
index 56e7e1a..66e6461 100644
--- a/doc/examples/configure-index
+++ b/doc/examples/configure-index
@@ -347,7 +347,7 @@ Dir "/"
Bin {
methods "/usr/lib/apt/methods/";
gzip "/bin/gzip";
- gpg "/usr/bin/gpgv";
+ gpg "/usr/bin/gpgv2";
dpkg "/usr/bin/dpkg";
dpkg-source "/usr/bin/dpkg-source";
dpkg-buildpackage "/usr/bin/dpkg-buildpackage";
--
2.1.0
Reply to: