summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe')
-rw-r--r--meta/lib/oe/gpg_sign.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/meta/lib/oe/gpg_sign.py b/meta/lib/oe/gpg_sign.py
index 9cc88f020c..b17272928f 100644
--- a/meta/lib/oe/gpg_sign.py
+++ b/meta/lib/oe/gpg_sign.py
@@ -12,6 +12,7 @@ class LocalSigner(object):
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.gpg_version = self.get_gpg_version()
14 self.rpm_bin = bb.utils.which(os.getenv('PATH'), "rpmsign") 14 self.rpm_bin = bb.utils.which(os.getenv('PATH'), "rpmsign")
15 self.gpg_agent_bin = bb.utils.which(os.getenv('PATH'), "gpg-agent")
15 16
16 def export_pubkey(self, output_file, keyid, armor=True): 17 def export_pubkey(self, output_file, keyid, armor=True):
17 """Export GPG public key to a file""" 18 """Export GPG public key to a file"""
@@ -31,7 +32,7 @@ class LocalSigner(object):
31 """Sign RPM files""" 32 """Sign RPM files"""
32 33
33 cmd = self.rpm_bin + " --addsign --define '_gpg_name %s' " % keyid 34 cmd = self.rpm_bin + " --addsign --define '_gpg_name %s' " % keyid
34 gpg_args = '--no-permission-warning --batch --passphrase=%s' % passphrase 35 gpg_args = '--no-permission-warning --batch --passphrase=%s --agent-program=%s|--auto-expand-secmem' % (passphrase, self.gpg_agent_bin)
35 if self.gpg_version > (2,1,): 36 if self.gpg_version > (2,1,):
36 gpg_args += ' --pinentry-mode=loopback' 37 gpg_args += ' --pinentry-mode=loopback'
37 cmd += "--define '_gpg_sign_cmd_extra_args %s' " % gpg_args 38 cmd += "--define '_gpg_sign_cmd_extra_args %s' " % gpg_args
@@ -71,6 +72,9 @@ class LocalSigner(object):
71 if self.gpg_version > (2,1,): 72 if self.gpg_version > (2,1,):
72 cmd += ['--pinentry-mode', 'loopback'] 73 cmd += ['--pinentry-mode', 'loopback']
73 74
75 if self.gpg_agent_bin:
76 cmd += ["--agent-program=%s|--auto-expand-secmem" % (self.gpg_agent_bin)]
77
74 cmd += [input_file] 78 cmd += [input_file]
75 79
76 try: 80 try:
@@ -99,7 +103,7 @@ class LocalSigner(object):
99 import subprocess 103 import subprocess
100 try: 104 try:
101 ver_str = subprocess.check_output((self.gpg_bin, "--version", "--no-permission-warning")).split()[2].decode("utf-8") 105 ver_str = subprocess.check_output((self.gpg_bin, "--version", "--no-permission-warning")).split()[2].decode("utf-8")
102 return tuple([int(i) for i in ver_str.split('.')]) 106 return tuple([int(i) for i in ver_str.split("-")[0].split('.')])
103 except subprocess.CalledProcessError as e: 107 except subprocess.CalledProcessError as e:
104 raise bb.build.FuncFailed("Could not get gpg version: %s" % e) 108 raise bb.build.FuncFailed("Could not get gpg version: %s" % e)
105 109