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.py24
1 files changed, 6 insertions, 18 deletions
diff --git a/meta/lib/oe/gpg_sign.py b/meta/lib/oe/gpg_sign.py
index e738397880..b83ee86728 100644
--- a/meta/lib/oe/gpg_sign.py
+++ b/meta/lib/oe/gpg_sign.py
@@ -26,32 +26,20 @@ class LocalSigner(object):
26 raise bb.build.FuncFailed('Failed to export gpg public key (%s): %s' % 26 raise bb.build.FuncFailed('Failed to export gpg public key (%s): %s' %
27 (keyid, output)) 27 (keyid, output))
28 28
29 def sign_rpms(self, files, keyid, passphrase_file): 29 def sign_rpms(self, files, keyid, passphrase):
30 """Sign RPM files""" 30 """Sign RPM files"""
31 import pexpect
32 31
33 cmd = self.rpm_bin + " --addsign --define '_gpg_name %s' " % keyid 32 cmd = self.rpm_bin + " --addsign --define '_gpg_name %s' " % keyid
33 cmd += "--define '_gpg_passphrase %s' " % passphrase
34 if self.gpg_bin: 34 if self.gpg_bin:
35 cmd += "--define '%%__gpg %s' " % self.gpg_bin 35 cmd += "--define '%%__gpg %s' " % self.gpg_bin
36 if self.gpg_path: 36 if self.gpg_path:
37 cmd += "--define '_gpg_path %s' " % self.gpg_path 37 cmd += "--define '_gpg_path %s' " % self.gpg_path
38 cmd += ' '.join(files) 38 cmd += ' '.join(files)
39 39
40 # Need to use pexpect for feeding the passphrase 40 status, output = oe.utils.getstatusoutput(cmd)
41 proc = pexpect.spawn(cmd) 41 if status:
42 try: 42 raise bb.build.FuncFailed("Failed to sign RPM packages: %s" % output)
43 proc.expect_exact('Enter pass phrase:', timeout=15)
44 with open(passphrase_file) as fobj:
45 proc.sendline(fobj.readline().rstrip('\n'))
46 proc.expect(pexpect.EOF, timeout=900)
47 proc.close()
48 except pexpect.TIMEOUT as err:
49 bb.error('rpmsign timeout: %s' % err)
50 proc.terminate()
51 if os.WEXITSTATUS(proc.status) or not os.WIFEXITED(proc.status):
52 bb.error('rpmsign failed: %s' % proc.before.strip())
53 raise bb.build.FuncFailed("Failed to sign RPM packages")
54
55 43
56 def detach_sign(self, input_file, keyid, passphrase_file, passphrase=None, armor=True): 44 def detach_sign(self, input_file, keyid, passphrase_file, passphrase=None, armor=True):
57 """Create a detached signature of a file""" 45 """Create a detached signature of a file"""