summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/gpg_sign.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/gpg_sign.py')
-rw-r--r--meta/lib/oe/gpg_sign.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/meta/lib/oe/gpg_sign.py b/meta/lib/oe/gpg_sign.py
index 059381d5e3..0b5dc20892 100644
--- a/meta/lib/oe/gpg_sign.py
+++ b/meta/lib/oe/gpg_sign.py
@@ -66,6 +66,13 @@ class LocalSigner(object):
66 if armor: 66 if armor:
67 cmd += ['--armor'] 67 cmd += ['--armor']
68 68
69 #gpg > 2.1 supports password pipes only through the loopback interface
70 #gpg < 2.1 errors out if given unknown parameters
71 dots = self.get_gpg_version().split('.')
72 assert len(dots) >= 2
73 if int(dots[0]) >= 2 and int(dots[1]) >= 1:
74 cmd += ['--pinentry-mode', 'loopback']
75
69 cmd += [input_file] 76 cmd += [input_file]
70 77
71 try: 78 try:
@@ -89,6 +96,15 @@ class LocalSigner(object):
89 raise Exception("Failed to sign '%s" % input_file) 96 raise Exception("Failed to sign '%s" % input_file)
90 97
91 98
99 def get_gpg_version(self):
100 """Return the gpg version"""
101 import subprocess
102 try:
103 return subprocess.check_output((self.gpg_bin, "--version")).split()[2]
104 except subprocess.CalledProcessError as e:
105 raise bb.build.FuncFailed("Could not get gpg version: %s" % e)
106
107
92 def verify(self, sig_file): 108 def verify(self, sig_file):
93 """Verify signature""" 109 """Verify signature"""
94 cmd = self.gpg_bin + " --verify " 110 cmd = self.gpg_bin + " --verify "