summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2017-03-03 14:37:26 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-03-14 15:21:03 +0000
commit951d22cb62891c4bc078925c4af8445d7be940e0 (patch)
tree8a51e0a50952b009553488c2f89cf0d708ec67b7
parent5cbba2c4016ad84a54f83531868aa6e66eef468e (diff)
downloadopenembedded-core-contrib-951d22cb62891c4bc078925c4af8445d7be940e0.tar.gz
openembedded-core-contrib-951d22cb62891c4bc078925c4af8445d7be940e0.tar.bz2
openembedded-core-contrib-951d22cb62891c4bc078925c4af8445d7be940e0.zip
lib/oe/gpg_sign: make gpg version a property of the signer
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> (cherry picked from commit a00a362e3dc18ba04230cbbd6f91264e5d76f40d) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/gpg_sign.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/meta/lib/oe/gpg_sign.py b/meta/lib/oe/gpg_sign.py
index 683ae5bf43..16eb7f83bf 100644
--- a/meta/lib/oe/gpg_sign.py
+++ b/meta/lib/oe/gpg_sign.py
@@ -10,6 +10,7 @@ class LocalSigner(object):
self.gpg_bin = d.getVar('GPG_BIN', True) or \
bb.utils.which(os.getenv('PATH'), 'gpg')
self.gpg_path = d.getVar('GPG_PATH', True)
+ self.gpg_version = self.get_gpg_version()
self.rpm_bin = bb.utils.which(os.getenv('PATH'), "rpm")
def export_pubkey(self, output_file, keyid, armor=True):
@@ -59,9 +60,7 @@ class LocalSigner(object):
#gpg > 2.1 supports password pipes only through the loopback interface
#gpg < 2.1 errors out if given unknown parameters
- dots = self.get_gpg_version().split('.')
- assert len(dots) >= 2
- if int(dots[0]) >= 2 and int(dots[1]) >= 1:
+ if self.gpg_version > (2,1,):
cmd += ['--pinentry-mode', 'loopback']
cmd += [input_file]
@@ -88,10 +87,11 @@ class LocalSigner(object):
def get_gpg_version(self):
- """Return the gpg version"""
+ """Return the gpg version as a tuple of ints"""
import subprocess
try:
- return subprocess.check_output((self.gpg_bin, "--version")).split()[2].decode("utf-8")
+ ver_str = subprocess.check_output((self.gpg_bin, "--version")).split()[2].decode("utf-8")
+ return tuple([int(i) for i in ver_str.split('.')])
except subprocess.CalledProcessError as e:
raise bb.build.FuncFailed("Could not get gpg version: %s" % e)