diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2017-02-23 12:24:19 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-01 23:27:08 +0000 |
commit | 7f4278d4726fa68a6d42116430cc46186f09bded (patch) | |
tree | 8043b5d2f54dcc0174dcde8ba097aaef7a55dce6 /meta | |
parent | 8032d64c43b5b11000a3d00a2e8369b6e7e9b833 (diff) | |
download | poky-7f4278d4726fa68a6d42116430cc46186f09bded.tar.gz |
lib/oe/gpg_sign: make gpg version a property of the signer
(From OE-Core rev: a00a362e3dc18ba04230cbbd6f91264e5d76f40d)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oe/gpg_sign.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/meta/lib/oe/gpg_sign.py b/meta/lib/oe/gpg_sign.py index bf36226791..630d312cfc 100644 --- a/meta/lib/oe/gpg_sign.py +++ b/meta/lib/oe/gpg_sign.py | |||
@@ -10,6 +10,7 @@ class LocalSigner(object): | |||
10 | self.gpg_bin = d.getVar('GPG_BIN') or \ | 10 | self.gpg_bin = d.getVar('GPG_BIN') or \ |
11 | bb.utils.which(os.getenv('PATH'), 'gpg') | 11 | bb.utils.which(os.getenv('PATH'), 'gpg') |
12 | self.gpg_path = d.getVar('GPG_PATH') | 12 | self.gpg_path = d.getVar('GPG_PATH') |
13 | self.gpg_version = self.get_gpg_version() | ||
13 | self.rpm_bin = bb.utils.which(os.getenv('PATH'), "rpm") | 14 | self.rpm_bin = bb.utils.which(os.getenv('PATH'), "rpm") |
14 | 15 | ||
15 | def export_pubkey(self, output_file, keyid, armor=True): | 16 | def export_pubkey(self, output_file, keyid, armor=True): |
@@ -59,9 +60,7 @@ class LocalSigner(object): | |||
59 | 60 | ||
60 | #gpg > 2.1 supports password pipes only through the loopback interface | 61 | #gpg > 2.1 supports password pipes only through the loopback interface |
61 | #gpg < 2.1 errors out if given unknown parameters | 62 | #gpg < 2.1 errors out if given unknown parameters |
62 | dots = self.get_gpg_version().split('.') | 63 | if self.gpg_version > (2,1,): |
63 | assert len(dots) >= 2 | ||
64 | if int(dots[0]) >= 2 and int(dots[1]) >= 1: | ||
65 | cmd += ['--pinentry-mode', 'loopback'] | 64 | cmd += ['--pinentry-mode', 'loopback'] |
66 | 65 | ||
67 | cmd += [input_file] | 66 | cmd += [input_file] |
@@ -88,10 +87,11 @@ class LocalSigner(object): | |||
88 | 87 | ||
89 | 88 | ||
90 | def get_gpg_version(self): | 89 | def get_gpg_version(self): |
91 | """Return the gpg version""" | 90 | """Return the gpg version as a tuple of ints""" |
92 | import subprocess | 91 | import subprocess |
93 | try: | 92 | try: |
94 | return subprocess.check_output((self.gpg_bin, "--version")).split()[2].decode("utf-8") | 93 | ver_str = subprocess.check_output((self.gpg_bin, "--version")).split()[2].decode("utf-8") |
94 | return tuple([int(i) for i in ver_str.split('.')]) | ||
95 | except subprocess.CalledProcessError as e: | 95 | except subprocess.CalledProcessError as e: |
96 | raise bb.build.FuncFailed("Could not get gpg version: %s" % e) | 96 | raise bb.build.FuncFailed("Could not get gpg version: %s" % e) |
97 | 97 | ||