summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/gpg_sign.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/meta/lib/oe/gpg_sign.py b/meta/lib/oe/gpg_sign.py
index b17272928f..ccd5aee420 100644
--- a/meta/lib/oe/gpg_sign.py
+++ b/meta/lib/oe/gpg_sign.py
@@ -3,6 +3,8 @@ import os
3 3
4import bb 4import bb
5import oe.utils 5import oe.utils
6import subprocess
7import shlex
6 8
7class LocalSigner(object): 9class LocalSigner(object):
8 """Class for handling local (on the build host) signing""" 10 """Class for handling local (on the build host) signing"""
@@ -23,10 +25,7 @@ class LocalSigner(object):
23 if armor: 25 if armor:
24 cmd += "--armor " 26 cmd += "--armor "
25 cmd += keyid 27 cmd += keyid
26 status, output = oe.utils.getstatusoutput(cmd) 28 subprocess.check_output(shlex.split(cmd), stderr=subprocess.STDOUT)
27 if status:
28 raise bb.build.FuncFailed('Failed to export gpg public key (%s): %s' %
29 (keyid, output))
30 29
31 def sign_rpms(self, files, keyid, passphrase, digest, sign_chunk, fsk=None, fsk_password=None): 30 def sign_rpms(self, files, keyid, passphrase, digest, sign_chunk, fsk=None, fsk_password=None):
32 """Sign RPM files""" 31 """Sign RPM files"""
@@ -48,13 +47,10 @@ class LocalSigner(object):
48 47
49 # Sign in chunks 48 # Sign in chunks
50 for i in range(0, len(files), sign_chunk): 49 for i in range(0, len(files), sign_chunk):
51 status, output = oe.utils.getstatusoutput(cmd + ' '.join(files[i:i+sign_chunk])) 50 subprocess.check_output(shlex.split(cmd + ' '.join(files[i:i+sign_chunk])), stderr=subprocess.STDOUT)
52 if status:
53 raise bb.build.FuncFailed("Failed to sign RPM packages: %s" % output)
54 51
55 def detach_sign(self, input_file, keyid, passphrase_file, passphrase=None, armor=True): 52 def detach_sign(self, input_file, keyid, passphrase_file, passphrase=None, armor=True):
56 """Create a detached signature of a file""" 53 """Create a detached signature of a file"""
57 import subprocess
58 54
59 if passphrase_file and passphrase: 55 if passphrase_file and passphrase:
60 raise Exception("You should use either passphrase_file of passphrase, not both") 56 raise Exception("You should use either passphrase_file of passphrase, not both")
@@ -100,7 +96,6 @@ class LocalSigner(object):
100 96
101 def get_gpg_version(self): 97 def get_gpg_version(self):
102 """Return the gpg version as a tuple of ints""" 98 """Return the gpg version as a tuple of ints"""
103 import subprocess
104 try: 99 try:
105 ver_str = subprocess.check_output((self.gpg_bin, "--version", "--no-permission-warning")).split()[2].decode("utf-8") 100 ver_str = subprocess.check_output((self.gpg_bin, "--version", "--no-permission-warning")).split()[2].decode("utf-8")
106 return tuple([int(i) for i in ver_str.split("-")[0].split('.')]) 101 return tuple([int(i) for i in ver_str.split("-")[0].split('.')])
@@ -114,7 +109,7 @@ class LocalSigner(object):
114 if self.gpg_path: 109 if self.gpg_path:
115 cmd += "--homedir %s " % self.gpg_path 110 cmd += "--homedir %s " % self.gpg_path
116 cmd += sig_file 111 cmd += sig_file
117 status, _ = oe.utils.getstatusoutput(cmd) 112 status = subprocess.call(shlex.split(cmd))
118 ret = False if status else True 113 ret = False if status else True
119 return ret 114 return ret
120 115