summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/gpg_sign.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-20 11:17:05 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-02 08:24:00 +0100
commita7309d5790f5dac46e84d3c14959943eb2496fda (patch)
tree48e1fcb886b8ef2974bade09694356f3230fb8a8 /meta/lib/oe/gpg_sign.py
parent297438e965053b2eb56cc8ef3e59465642f10a24 (diff)
downloadpoky-a7309d5790f5dac46e84d3c14959943eb2496fda.tar.gz
classes/lib: Update to use python3 command pipeline decoding
In python3, strings are unicode by default. We need to encode/decode from command pipelines and other places where we interface with the real world using the correct locales. This patch updates various call sites to use the correct encoding/decodings. (From OE-Core rev: bb4685af1bffe17b3aa92a6d21398f38a44ea874) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/gpg_sign.py')
-rw-r--r--meta/lib/oe/gpg_sign.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/meta/lib/oe/gpg_sign.py b/meta/lib/oe/gpg_sign.py
index b83ee86728..a8a478aa95 100644
--- a/meta/lib/oe/gpg_sign.py
+++ b/meta/lib/oe/gpg_sign.py
@@ -24,7 +24,7 @@ class LocalSigner(object):
24 status, output = oe.utils.getstatusoutput(cmd) 24 status, output = oe.utils.getstatusoutput(cmd)
25 if status: 25 if status:
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.decode("utf-8")))
28 28
29 def sign_rpms(self, files, keyid, passphrase): 29 def sign_rpms(self, files, keyid, passphrase):
30 """Sign RPM files""" 30 """Sign RPM files"""
@@ -39,7 +39,7 @@ class LocalSigner(object):
39 39
40 status, output = oe.utils.getstatusoutput(cmd) 40 status, output = oe.utils.getstatusoutput(cmd)
41 if status: 41 if status:
42 raise bb.build.FuncFailed("Failed to sign RPM packages: %s" % output) 42 raise bb.build.FuncFailed("Failed to sign RPM packages: %s" % output.decode("utf-8"))
43 43
44 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):
45 """Create a detached signature of a file""" 45 """Create a detached signature of a file"""
@@ -71,11 +71,11 @@ class LocalSigner(object):
71 passphrase = fobj.readline(); 71 passphrase = fobj.readline();
72 72
73 job = subprocess.Popen(cmd, stdin=subprocess.PIPE, stderr=subprocess.PIPE) 73 job = subprocess.Popen(cmd, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
74 (_, stderr) = job.communicate(passphrase) 74 (_, stderr) = job.communicate(passphrase.encode("utf-8"))
75 75
76 if job.returncode: 76 if job.returncode:
77 raise bb.build.FuncFailed("GPG exited with code %d: %s" % 77 raise bb.build.FuncFailed("GPG exited with code %d: %s" %
78 (job.returncode, stderr)) 78 (job.returncode, stderr.decode("utf-8")))
79 79
80 except IOError as e: 80 except IOError as e:
81 bb.error("IO error (%s): %s" % (e.errno, e.strerror)) 81 bb.error("IO error (%s): %s" % (e.errno, e.strerror))
@@ -90,7 +90,7 @@ class LocalSigner(object):
90 """Return the gpg version""" 90 """Return the gpg version"""
91 import subprocess 91 import subprocess
92 try: 92 try:
93 return subprocess.check_output((self.gpg_bin, "--version")).split()[2] 93 return subprocess.check_output((self.gpg_bin, "--version")).split()[2].decode("utf-8")
94 except subprocess.CalledProcessError as e: 94 except subprocess.CalledProcessError as e:
95 raise bb.build.FuncFailed("Could not get gpg version: %s" % e) 95 raise bb.build.FuncFailed("Could not get gpg version: %s" % e)
96 96