summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-20 10:17:05 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-02 07:24:00 (GMT)
commita7309d5790f5dac46e84d3c14959943eb2496fda (patch)
tree48e1fcb886b8ef2974bade09694356f3230fb8a8 /meta
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')
-rw-r--r--meta/classes/buildhistory.bbclass12
-rw-r--r--meta/classes/chrpath.bbclass2
-rw-r--r--meta/classes/externalsrc.bbclass2
-rw-r--r--meta/classes/insane.bbclass8
-rw-r--r--meta/classes/libc-package.bbclass3
-rw-r--r--meta/classes/package.bbclass6
-rw-r--r--meta/classes/package_deb.bbclass26
-rw-r--r--meta/classes/toaster.bbclass1
-rw-r--r--meta/lib/oe/gpg_sign.py10
-rw-r--r--meta/lib/oe/package.py4
-rw-r--r--meta/lib/oe/package_manager.py88
-rw-r--r--meta/lib/oe/packagedata.py2
-rw-r--r--meta/lib/oeqa/oetest.py4
-rw-r--r--meta/lib/oeqa/runtime/parselogs.py4
-rw-r--r--meta/lib/oeqa/runtime/ping.py2
-rw-r--r--meta/lib/oeqa/utils/commands.py2
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py26
-rw-r--r--meta/lib/oeqa/utils/qemutinyrunner.py4
-rw-r--r--meta/lib/oeqa/utils/sshcontrol.py1
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-xorg.inc5
20 files changed, 110 insertions, 102 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 581d532..e3b5c44 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -233,7 +233,7 @@ python buildhistory_emit_pkghistory() {
233 key = item[0] 233 key = item[0]
234 if key.endswith('_' + pkg): 234 if key.endswith('_' + pkg):
235 key = key[:-len(pkg)-1] 235 key = key[:-len(pkg)-1]
236 pkgdata[key] = item[1].decode('utf-8').decode('string_escape') 236 pkgdata[key] = item[1]
237 237
238 pkge = pkgdata.get('PKGE', '0') 238 pkge = pkgdata.get('PKGE', '0')
239 pkgv = pkgdata['PKGV'] 239 pkgv = pkgdata['PKGV']
@@ -288,14 +288,12 @@ python buildhistory_emit_pkghistory() {
288 288
289 289
290def write_recipehistory(rcpinfo, d): 290def write_recipehistory(rcpinfo, d):
291 import codecs
292
293 bb.debug(2, "Writing recipe history") 291 bb.debug(2, "Writing recipe history")
294 292
295 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) 293 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
296 294
297 infofile = os.path.join(pkghistdir, "latest") 295 infofile = os.path.join(pkghistdir, "latest")
298 with codecs.open(infofile, "w", encoding='utf8') as f: 296 with open(infofile, "w") as f:
299 if rcpinfo.pe != "0": 297 if rcpinfo.pe != "0":
300 f.write(u"PE = %s\n" % rcpinfo.pe) 298 f.write(u"PE = %s\n" % rcpinfo.pe)
301 f.write(u"PV = %s\n" % rcpinfo.pv) 299 f.write(u"PV = %s\n" % rcpinfo.pv)
@@ -305,8 +303,6 @@ def write_recipehistory(rcpinfo, d):
305 303
306 304
307def write_pkghistory(pkginfo, d): 305def write_pkghistory(pkginfo, d):
308 import codecs
309
310 bb.debug(2, "Writing package history for package %s" % pkginfo.name) 306 bb.debug(2, "Writing package history for package %s" % pkginfo.name)
311 307
312 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) 308 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
@@ -316,7 +312,7 @@ def write_pkghistory(pkginfo, d):
316 bb.utils.mkdirhier(pkgpath) 312 bb.utils.mkdirhier(pkgpath)
317 313
318 infofile = os.path.join(pkgpath, "latest") 314 infofile = os.path.join(pkgpath, "latest")
319 with codecs.open(infofile, "w", encoding='utf8') as f: 315 with open(infofile, "w") as f:
320 if pkginfo.pe != "0": 316 if pkginfo.pe != "0":
321 f.write(u"PE = %s\n" % pkginfo.pe) 317 f.write(u"PE = %s\n" % pkginfo.pe)
322 f.write(u"PV = %s\n" % pkginfo.pv) 318 f.write(u"PV = %s\n" % pkginfo.pv)
@@ -349,7 +345,7 @@ def write_pkghistory(pkginfo, d):
349 filevarpath = os.path.join(pkgpath, "latest.%s" % filevar) 345 filevarpath = os.path.join(pkgpath, "latest.%s" % filevar)
350 val = pkginfo.filevars[filevar] 346 val = pkginfo.filevars[filevar]
351 if val: 347 if val:
352 with codecs.open(filevarpath, "w", encoding='utf8') as f: 348 with open(filevarpath, "w") as f:
353 f.write(val) 349 f.write(val)
354 else: 350 else:
355 if os.path.exists(filevarpath): 351 if os.path.exists(filevarpath):
diff --git a/meta/classes/chrpath.bbclass b/meta/classes/chrpath.bbclass
index 9c68855..cdd7f27 100644
--- a/meta/classes/chrpath.bbclass
+++ b/meta/classes/chrpath.bbclass
@@ -10,6 +10,8 @@ def process_file_linux(cmd, fpath, rootdir, baseprefix, tmpdir, d):
10 if p.returncode != 0: 10 if p.returncode != 0:
11 return 11 return
12 12
13 err = err.decode('utf-8')
14
13 # Handle RUNPATH as well as RPATH 15 # Handle RUNPATH as well as RPATH
14 err = err.replace("RUNPATH=","RPATH=") 16 err = err.replace("RUNPATH=","RPATH=")
15 # Throw away everything other than the rpath list 17 # Throw away everything other than the rpath list
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index da7eb478..b7140a3 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -145,7 +145,7 @@ def srctree_hash_files(d):
145 env = os.environ.copy() 145 env = os.environ.copy()
146 env['GIT_INDEX_FILE'] = tmp_index.name 146 env['GIT_INDEX_FILE'] = tmp_index.name
147 subprocess.check_output(['git', 'add', '.'], cwd=s_dir, env=env) 147 subprocess.check_output(['git', 'add', '.'], cwd=s_dir, env=env)
148 sha1 = subprocess.check_output(['git', 'write-tree'], cwd=s_dir, env=env) 148 sha1 = subprocess.check_output(['git', 'write-tree'], cwd=s_dir, env=env).decode("utf-8")
149 with open(oe_hash_file, 'w') as fobj: 149 with open(oe_hash_file, 'w') as fobj:
150 fobj.write(sha1) 150 fobj.write(sha1)
151 ret = oe_hash_file + ':True' 151 ret = oe_hash_file + ':True'
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 71999ad..9b2337c 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -399,7 +399,7 @@ def package_qa_check_unsafe_references_in_binaries(path, name, d, elf, messages)
399 sysroot_path_usr = sysroot_path + exec_prefix 399 sysroot_path_usr = sysroot_path + exec_prefix
400 400
401 try: 401 try:
402 ldd_output = bb.process.Popen(["prelink-rtld", "--root", sysroot_path, path], stdout=sub.PIPE).stdout.read() 402 ldd_output = bb.process.Popen(["prelink-rtld", "--root", sysroot_path, path], stdout=sub.PIPE).stdout.read().decode("utf-8")
403 except bb.process.CmdError: 403 except bb.process.CmdError:
404 error_msg = pn + ": prelink-rtld aborted when processing %s" % path 404 error_msg = pn + ": prelink-rtld aborted when processing %s" % path
405 package_qa_handle_error("unsafe-references-in-binaries", error_msg, d) 405 package_qa_handle_error("unsafe-references-in-binaries", error_msg, d)
@@ -986,12 +986,12 @@ def package_qa_check_expanded_d(path,name,d,elf,messages):
986 return sane 986 return sane
987 987
988def package_qa_check_encoding(keys, encode, d): 988def package_qa_check_encoding(keys, encode, d):
989 def check_encoding(key,enc): 989 def check_encoding(key, enc):
990 sane = True 990 sane = True
991 value = d.getVar(key, True) 991 value = d.getVar(key, True)
992 if value: 992 if value:
993 try: 993 try:
994 s = unicode(value, enc) 994 s = value.encode(enc)
995 except UnicodeDecodeError as e: 995 except UnicodeDecodeError as e:
996 error_msg = "%s has non %s characters" % (key,enc) 996 error_msg = "%s has non %s characters" % (key,enc)
997 sane = False 997 sane = False
@@ -1217,7 +1217,7 @@ Missing inherit gettext?""" % (gt, config))
1217 try: 1217 try:
1218 flag = "WARNING: unrecognized options:" 1218 flag = "WARNING: unrecognized options:"
1219 log = os.path.join(d.getVar('B', True), 'config.log') 1219 log = os.path.join(d.getVar('B', True), 'config.log')
1220 output = subprocess.check_output(['grep', '-F', flag, log]).replace(', ', ' ') 1220 output = subprocess.check_output(['grep', '-F', flag, log]).decode("utf-8").replace(', ', ' ')
1221 options = set() 1221 options = set()
1222 for line in output.splitlines(): 1222 for line in output.splitlines():
1223 options |= set(line.partition(flag)[2].split()) 1223 options |= set(line.partition(flag)[2].split())
diff --git a/meta/classes/libc-package.bbclass b/meta/classes/libc-package.bbclass
index 467d567..70f479b 100644
--- a/meta/classes/libc-package.bbclass
+++ b/meta/classes/libc-package.bbclass
@@ -150,6 +150,7 @@ python package_do_split_gconvs () {
150 c_re = re.compile('^copy "(.*)"') 150 c_re = re.compile('^copy "(.*)"')
151 i_re = re.compile('^include "(\w+)".*') 151 i_re = re.compile('^include "(\w+)".*')
152 for l in f.readlines(): 152 for l in f.readlines():
153 l = l.decode("latin-1")
153 m = c_re.match(l) or i_re.match(l) 154 m = c_re.match(l) or i_re.match(l)
154 if m: 155 if m:
155 dp = legitimize_package_name('%s%s-gconv-%s' % (mlprefix, bpn, m.group(1))) 156 dp = legitimize_package_name('%s%s-gconv-%s' % (mlprefix, bpn, m.group(1)))
@@ -171,6 +172,7 @@ python package_do_split_gconvs () {
171 c_re = re.compile('^copy "(.*)"') 172 c_re = re.compile('^copy "(.*)"')
172 i_re = re.compile('^include "(\w+)".*') 173 i_re = re.compile('^include "(\w+)".*')
173 for l in f.readlines(): 174 for l in f.readlines():
175 l = l.decode("latin-1")
174 m = c_re.match(l) or i_re.match(l) 176 m = c_re.match(l) or i_re.match(l)
175 if m: 177 if m:
176 dp = legitimize_package_name('%s%s-charmap-%s' % (mlprefix, bpn, m.group(1))) 178 dp = legitimize_package_name('%s%s-charmap-%s' % (mlprefix, bpn, m.group(1)))
@@ -191,6 +193,7 @@ python package_do_split_gconvs () {
191 c_re = re.compile('^copy "(.*)"') 193 c_re = re.compile('^copy "(.*)"')
192 i_re = re.compile('^include "(\w+)".*') 194 i_re = re.compile('^include "(\w+)".*')
193 for l in f.readlines(): 195 for l in f.readlines():
196 l = l.decode("latin-1")
194 m = c_re.match(l) or i_re.match(l) 197 m = c_re.match(l) or i_re.match(l)
195 if m: 198 if m:
196 dp = legitimize_package_name(mlprefix+bpn+'-localedata-%s' % m.group(1)) 199 dp = legitimize_package_name(mlprefix+bpn+'-localedata-%s' % m.group(1))
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index a4125a0..501004e 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -63,7 +63,7 @@ def legitimize_package_name(s):
63 def fixutf(m): 63 def fixutf(m):
64 cp = m.group(1) 64 cp = m.group(1)
65 if cp: 65 if cp:
66 return ('\u%s' % cp).decode('unicode_escape').encode('utf-8') 66 return ('\\u%s' % cp).encode('latin-1').decode('unicode_escape')
67 67
68 # Handle unicode codepoints encoded as <U0123>, as in glibc locale files. 68 # Handle unicode codepoints encoded as <U0123>, as in glibc locale files.
69 s = re.sub('<U([0-9A-Fa-f]{1,4})>', fixutf, s) 69 s = re.sub('<U([0-9A-Fa-f]{1,4})>', fixutf, s)
@@ -1259,8 +1259,8 @@ python emit_pkgdata() {
1259 def write_if_exists(f, pkg, var): 1259 def write_if_exists(f, pkg, var):
1260 def encode(str): 1260 def encode(str):
1261 import codecs 1261 import codecs
1262 c = codecs.getencoder("string_escape") 1262 c = codecs.getencoder("unicode_escape")
1263 return c(str)[0] 1263 return c(str)[0].decode("latin1")
1264 1264
1265 val = d.getVar('%s_%s' % (var, pkg), True) 1265 val = d.getVar('%s_%s' % (var, pkg), True)
1266 if val: 1266 if val:
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass
index bb5220e..e35f427 100644
--- a/meta/classes/package_deb.bbclass
+++ b/meta/classes/package_deb.bbclass
@@ -173,7 +173,7 @@ python do_package_deb () {
173 # Special behavior for description... 173 # Special behavior for description...
174 if 'DESCRIPTION' in fs: 174 if 'DESCRIPTION' in fs:
175 summary = localdata.getVar('SUMMARY', True) or localdata.getVar('DESCRIPTION', True) or "." 175 summary = localdata.getVar('SUMMARY', True) or localdata.getVar('DESCRIPTION', True) or "."
176 ctrlfile.write('Description: %s\n' % unicode(summary,'utf-8')) 176 ctrlfile.write('Description: %s\n' % summary)
177 description = localdata.getVar('DESCRIPTION', True) or "." 177 description = localdata.getVar('DESCRIPTION', True) or "."
178 description = textwrap.dedent(description).strip() 178 description = textwrap.dedent(description).strip()
179 if '\\n' in description: 179 if '\\n' in description:
@@ -182,29 +182,25 @@ python do_package_deb () {
182 # We don't limit the width when manually indent, but we do 182 # We don't limit the width when manually indent, but we do
183 # need the textwrap.fill() to set the initial_indent and 183 # need the textwrap.fill() to set the initial_indent and
184 # subsequent_indent, so set a large width 184 # subsequent_indent, so set a large width
185 ctrlfile.write('%s\n' % unicode(textwrap.fill(t, width=100000, initial_indent=' ', subsequent_indent=' '),'utf-8')) 185 ctrlfile.write('%s\n' % textwrap.fill(t, width=100000, initial_indent=' ', subsequent_indent=' '))
186 else: 186 else:
187 # Auto indent 187 # Auto indent
188 ctrlfile.write('%s\n' % unicode(textwrap.fill(description.strip(), width=74, initial_indent=' ', subsequent_indent=' '),'utf-8')) 188 ctrlfile.write('%s\n' % textwrap.fill(description.strip(), width=74, initial_indent=' ', subsequent_indent=' '))
189 189
190 else: 190 else:
191 ctrlfile.write(unicode(c % tuple(pullData(fs, localdata)),'utf-8')) 191 ctrlfile.write(c % tuple(pullData(fs, localdata)))
192 except KeyError: 192 except KeyError:
193 import sys 193 import sys
194 (type, value, traceback) = sys.exc_info() 194 (type, value, traceback) = sys.exc_info()
195 bb.utils.unlockfile(lf) 195 bb.utils.unlockfile(lf)
196 ctrlfile.close() 196 ctrlfile.close()
197 raise bb.build.FuncFailed("Missing field for deb generation: %s" % value) 197 raise bb.build.FuncFailed("Missing field for deb generation: %s" % value)
198 except UnicodeDecodeError:
199 bb.utils.unlockfile(lf)
200 ctrlfile.close()
201 raise bb.build.FuncFailed("Non UTF-8 characters found in one of the fields")
202 198
203 # more fields 199 # more fields
204 200
205 custom_fields_chunk = get_package_additional_metadata("deb", localdata) 201 custom_fields_chunk = get_package_additional_metadata("deb", localdata)
206 if custom_fields_chunk is not None: 202 if custom_fields_chunk is not None:
207 ctrlfile.write(unicode(custom_fields_chunk)) 203 ctrlfile.write(custom_fields_chunk)
208 ctrlfile.write("\n") 204 ctrlfile.write("\n")
209 205
210 mapping_rename_hook(localdata) 206 mapping_rename_hook(localdata)
@@ -255,17 +251,17 @@ python do_package_deb () {
255 rconflicts = bb.utils.explode_dep_versions2(localdata.getVar("RCONFLICTS", True) or "") 251 rconflicts = bb.utils.explode_dep_versions2(localdata.getVar("RCONFLICTS", True) or "")
256 debian_cmp_remap(rconflicts) 252 debian_cmp_remap(rconflicts)
257 if rdepends: 253 if rdepends:
258 ctrlfile.write("Depends: %s\n" % unicode(bb.utils.join_deps(rdepends))) 254 ctrlfile.write("Depends: %s\n" % bb.utils.join_deps(rdepends))
259 if rsuggests: 255 if rsuggests:
260 ctrlfile.write("Suggests: %s\n" % unicode(bb.utils.join_deps(rsuggests))) 256 ctrlfile.write("Suggests: %s\n" % bb.utils.join_deps(rsuggests))
261 if rrecommends: 257 if rrecommends:
262 ctrlfile.write("Recommends: %s\n" % unicode(bb.utils.join_deps(rrecommends))) 258 ctrlfile.write("Recommends: %s\n" % bb.utils.join_deps(rrecommends))
263 if rprovides: 259 if rprovides:
264 ctrlfile.write("Provides: %s\n" % unicode(bb.utils.join_deps(rprovides))) 260 ctrlfile.write("Provides: %s\n" % bb.utils.join_deps(rprovides))
265 if rreplaces: 261 if rreplaces:
266 ctrlfile.write("Replaces: %s\n" % unicode(bb.utils.join_deps(rreplaces))) 262 ctrlfile.write("Replaces: %s\n" % bb.utils.join_deps(rreplaces))
267 if rconflicts: 263 if rconflicts:
268 ctrlfile.write("Conflicts: %s\n" % unicode(bb.utils.join_deps(rconflicts))) 264 ctrlfile.write("Conflicts: %s\n" % bb.utils.join_deps(rconflicts))
269 ctrlfile.close() 265 ctrlfile.close()
270 266
271 for script in ["preinst", "postinst", "prerm", "postrm"]: 267 for script in ["preinst", "postinst", "prerm", "postrm"]:
diff --git a/meta/classes/toaster.bbclass b/meta/classes/toaster.bbclass
index 1a70f14..1878fe0 100644
--- a/meta/classes/toaster.bbclass
+++ b/meta/classes/toaster.bbclass
@@ -33,6 +33,7 @@ python toaster_layerinfo_dumpdata() {
33 33
34 def _get_git_branch(layer_path): 34 def _get_git_branch(layer_path):
35 branch = subprocess.Popen("git symbolic-ref HEAD 2>/dev/null ", cwd=layer_path, shell=True, stdout=subprocess.PIPE).communicate()[0] 35 branch = subprocess.Popen("git symbolic-ref HEAD 2>/dev/null ", cwd=layer_path, shell=True, stdout=subprocess.PIPE).communicate()[0]
36 branch = branch.decode('utf-8')
36 branch = branch.replace('refs/heads/', '').rstrip() 37 branch = branch.replace('refs/heads/', '').rstrip()
37 return branch 38 return branch
38 39
diff --git a/meta/lib/oe/gpg_sign.py b/meta/lib/oe/gpg_sign.py
index b83ee86..a8a478a 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
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 252e32d..5bb15bb 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -64,8 +64,8 @@ def filedeprunner(arg):
64 64
65 def process_deps(pipe, pkg, pkgdest, provides, requires): 65 def process_deps(pipe, pkg, pkgdest, provides, requires):
66 for line in pipe: 66 for line in pipe:
67 f = line.split(" ", 1)[0].strip() 67 f = line.decode("utf-8").split(" ", 1)[0].strip()
68 line = line.split(" ", 1)[1].strip() 68 line = line.decode("utf-8").split(" ", 1)[1].strip()
69 69
70 if line.startswith("Requires:"): 70 if line.startswith("Requires:"):
71 i = requires 71 i = requires
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 3bc4ebf..abe9f68 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -17,10 +17,10 @@ def create_index(arg):
17 17
18 try: 18 try:
19 bb.note("Executing '%s' ..." % index_cmd) 19 bb.note("Executing '%s' ..." % index_cmd)
20 result = subprocess.check_output(index_cmd, stderr=subprocess.STDOUT, shell=True) 20 result = subprocess.check_output(index_cmd, stderr=subprocess.STDOUT, shell=True).decode("utf-8")
21 except subprocess.CalledProcessError as e: 21 except subprocess.CalledProcessError as e:
22 return("Index creation command '%s' failed with return code %d:\n%s" % 22 return("Index creation command '%s' failed with return code %d:\n%s" %
23 (e.cmd, e.returncode, e.output)) 23 (e.cmd, e.returncode, e.output.decode("utf-8")))
24 24
25 if result: 25 if result:
26 bb.note(result) 26 bb.note(result)
@@ -367,10 +367,10 @@ class RpmPkgsList(PkgsList):
367 # Determine rpm version 367 # Determine rpm version
368 cmd = "%s --version" % self.rpm_cmd 368 cmd = "%s --version" % self.rpm_cmd
369 try: 369 try:
370 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 370 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).decode("utf-8")
371 except subprocess.CalledProcessError as e: 371 except subprocess.CalledProcessError as e:
372 bb.fatal("Getting rpm version failed. Command '%s' " 372 bb.fatal("Getting rpm version failed. Command '%s' "
373 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 373 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
374 374
375 ''' 375 '''
376 Translate the RPM/Smart format names to the OE multilib format names 376 Translate the RPM/Smart format names to the OE multilib format names
@@ -411,10 +411,10 @@ class RpmPkgsList(PkgsList):
411 "-t", self.image_rpmlib] 411 "-t", self.image_rpmlib]
412 412
413 try: 413 try:
414 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip() 414 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip().decode("utf-8")
415 except subprocess.CalledProcessError as e: 415 except subprocess.CalledProcessError as e:
416 bb.fatal("Cannot get the package dependencies. Command '%s' " 416 bb.fatal("Cannot get the package dependencies. Command '%s' "
417 "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output)) 417 "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output.decode("utf-8")))
418 418
419 return output 419 return output
420 420
@@ -425,10 +425,10 @@ class RpmPkgsList(PkgsList):
425 425
426 try: 426 try:
427 # bb.note(cmd) 427 # bb.note(cmd)
428 tmp_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip() 428 tmp_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip().decode("utf-8")
429 except subprocess.CalledProcessError as e: 429 except subprocess.CalledProcessError as e:
430 bb.fatal("Cannot get the installed packages list. Command '%s' " 430 bb.fatal("Cannot get the installed packages list. Command '%s' "
431 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 431 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
432 432
433 output = dict() 433 output = dict()
434 deps = dict() 434 deps = dict()
@@ -485,6 +485,8 @@ class OpkgPkgsList(PkgsList):
485 # output streams separately and check for empty stderr. 485 # output streams separately and check for empty stderr.
486 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) 486 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
487 cmd_output, cmd_stderr = p.communicate() 487 cmd_output, cmd_stderr = p.communicate()
488 cmd_output = cmd_output.decode("utf-8")
489 cmd_stderr = cmd_stderr.decode("utf-8")
488 if p.returncode or cmd_stderr: 490 if p.returncode or cmd_stderr:
489 bb.fatal("Cannot get the installed packages list. Command '%s' " 491 bb.fatal("Cannot get the installed packages list. Command '%s' "
490 "returned %d and stderr:\n%s" % (cmd, p.returncode, cmd_stderr)) 492 "returned %d and stderr:\n%s" % (cmd, p.returncode, cmd_stderr))
@@ -502,10 +504,10 @@ class DpkgPkgsList(PkgsList):
502 cmd.append("-f=Package: ${Package}\nArchitecture: ${PackageArch}\nVersion: ${Version}\nFile: ${Package}_${Version}_${Architecture}.deb\nDepends: ${Depends}\nRecommends: ${Recommends}\n\n") 504 cmd.append("-f=Package: ${Package}\nArchitecture: ${PackageArch}\nVersion: ${Version}\nFile: ${Package}_${Version}_${Architecture}.deb\nDepends: ${Depends}\nRecommends: ${Recommends}\n\n")
503 505
504 try: 506 try:
505 cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip() 507 cmd_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip().decode("utf-8")
506 except subprocess.CalledProcessError as e: 508 except subprocess.CalledProcessError as e:
507 bb.fatal("Cannot get the installed packages list. Command '%s' " 509 bb.fatal("Cannot get the installed packages list. Command '%s' "
508 "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output)) 510 "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output.decode("utf-8")))
509 511
510 return opkg_query(cmd_output) 512 return opkg_query(cmd_output)
511 513
@@ -608,11 +610,11 @@ class PackageManager(object):
608 try: 610 try:
609 bb.note("Installing complementary packages ...") 611 bb.note("Installing complementary packages ...")
610 bb.note('Running %s' % cmd) 612 bb.note('Running %s' % cmd)
611 complementary_pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT) 613 complementary_pkgs = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode("utf-8")
612 except subprocess.CalledProcessError as e: 614 except subprocess.CalledProcessError as e:
613 bb.fatal("Could not compute complementary packages list. Command " 615 bb.fatal("Could not compute complementary packages list. Command "
614 "'%s' returned %d:\n%s" % 616 "'%s' returned %d:\n%s" %
615 (' '.join(cmd), e.returncode, e.output)) 617 (' '.join(cmd), e.returncode, e.output.decode("utf-8")))
616 self.install(complementary_pkgs.split(), attempt_only=True) 618 self.install(complementary_pkgs.split(), attempt_only=True)
617 os.remove(installed_pkgs_file) 619 os.remove(installed_pkgs_file)
618 620
@@ -784,12 +786,12 @@ class RpmPM(PackageManager):
784 try: 786 try:
785 complementary_pkgs = subprocess.check_output(cmd, 787 complementary_pkgs = subprocess.check_output(cmd,
786 stderr=subprocess.STDOUT, 788 stderr=subprocess.STDOUT,
787 shell=True) 789 shell=True).decode("utf-8")
788 # bb.note(complementary_pkgs) 790 # bb.note(complementary_pkgs)
789 return complementary_pkgs 791 return complementary_pkgs
790 except subprocess.CalledProcessError as e: 792 except subprocess.CalledProcessError as e:
791 bb.fatal("Could not invoke smart. Command " 793 bb.fatal("Could not invoke smart. Command "
792 "'%s' returned %d:\n%s" % (cmd, e.returncode, e.output)) 794 "'%s' returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
793 795
794 def _search_pkg_name_in_feeds(self, pkg, feed_archs): 796 def _search_pkg_name_in_feeds(self, pkg, feed_archs):
795 for arch in feed_archs: 797 for arch in feed_archs:
@@ -808,7 +810,7 @@ class RpmPM(PackageManager):
808 (self.smart_cmd, self.smart_opt, pkg) 810 (self.smart_cmd, self.smart_opt, pkg)
809 cmd += " | sed -ne 's/ *Provides://p'" 811 cmd += " | sed -ne 's/ *Provides://p'"
810 bb.note('cmd: %s' % cmd) 812 bb.note('cmd: %s' % cmd)
811 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 813 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).decode("utf-8")
812 # Found a provider 814 # Found a provider
813 if output: 815 if output:
814 bb.note('Found providers for %s: %s' % (pkg, output)) 816 bb.note('Found providers for %s: %s' % (pkg, output))
@@ -956,7 +958,7 @@ class RpmPM(PackageManager):
956 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 958 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
957 except subprocess.CalledProcessError as e: 959 except subprocess.CalledProcessError as e:
958 bb.fatal("Create rpm database failed. Command '%s' " 960 bb.fatal("Create rpm database failed. Command '%s' "
959 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 961 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
960 # Import GPG key to RPM database of the target system 962 # Import GPG key to RPM database of the target system
961 if self.d.getVar('RPM_SIGN_PACKAGES', True) == '1': 963 if self.d.getVar('RPM_SIGN_PACKAGES', True) == '1':
962 pubkey_path = self.d.getVar('RPM_GPG_PUBKEY', True) 964 pubkey_path = self.d.getVar('RPM_GPG_PUBKEY', True)
@@ -1203,11 +1205,11 @@ class RpmPM(PackageManager):
1203 cmd = "%s %s install --attempt -y %s" % \ 1205 cmd = "%s %s install --attempt -y %s" % \
1204 (self.smart_cmd, self.smart_opt, ' '.join(pkgs)) 1206 (self.smart_cmd, self.smart_opt, ' '.join(pkgs))
1205 try: 1207 try:
1206 output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) 1208 output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT).decode("utf-8")
1207 bb.note(output) 1209 bb.note(output)
1208 except subprocess.CalledProcessError as e: 1210 except subprocess.CalledProcessError as e:
1209 bb.fatal("Unable to install packages. Command '%s' " 1211 bb.fatal("Unable to install packages. Command '%s' "
1210 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1212 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1211 1213
1212 ''' 1214 '''
1213 Remove pkgs with smart, the pkg name is smart/rpm format 1215 Remove pkgs with smart, the pkg name is smart/rpm format
@@ -1233,11 +1235,11 @@ class RpmPM(PackageManager):
1233 1235
1234 try: 1236 try:
1235 bb.note(cmd) 1237 bb.note(cmd)
1236 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 1238 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).decode("utf-8")
1237 bb.note(output) 1239 bb.note(output)
1238 except subprocess.CalledProcessError as e: 1240 except subprocess.CalledProcessError as e:
1239 bb.note("Unable to remove packages. Command '%s' " 1241 bb.note("Unable to remove packages. Command '%s' "
1240 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1242 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1241 1243
1242 def upgrade(self): 1244 def upgrade(self):
1243 bb.note('smart upgrade') 1245 bb.note('smart upgrade')
@@ -1310,7 +1312,7 @@ class RpmPM(PackageManager):
1310 install_pkgs.append(pkg) 1312 install_pkgs.append(pkg)
1311 except subprocess.CalledProcessError as e: 1313 except subprocess.CalledProcessError as e:
1312 bb.note("Unable to dump install packages. Command '%s' " 1314 bb.note("Unable to dump install packages. Command '%s' "
1313 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1315 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1314 # Recovery rpmsys channel 1316 # Recovery rpmsys channel
1315 self._invoke_smart('channel --enable rpmsys') 1317 self._invoke_smart('channel --enable rpmsys')
1316 return install_pkgs 1318 return install_pkgs
@@ -1352,7 +1354,7 @@ class RpmPM(PackageManager):
1352 available_pkgs.append(pkg.strip()) 1354 available_pkgs.append(pkg.strip())
1353 except subprocess.CalledProcessError as e: 1355 except subprocess.CalledProcessError as e:
1354 bb.note("Unable to list all available packages. Command '%s' " 1356 bb.note("Unable to list all available packages. Command '%s' "
1355 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1357 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1356 1358
1357 self.fullpkglist = available_pkgs 1359 self.fullpkglist = available_pkgs
1358 1360
@@ -1379,12 +1381,12 @@ class RpmPM(PackageManager):
1379 1381
1380 try: 1382 try:
1381 bb.note(cmd) 1383 bb.note(cmd)
1382 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip() 1384 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip().decode("utf-8")
1383 bb.note(output) 1385 bb.note(output)
1384 os.chmod(saved_dir, 0755) 1386 os.chmod(saved_dir, 0o755)
1385 except subprocess.CalledProcessError as e: 1387 except subprocess.CalledProcessError as e:
1386 bb.fatal("Invoke save_rpmpostinst failed. Command '%s' " 1388 bb.fatal("Invoke save_rpmpostinst failed. Command '%s' "
1387 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1389 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1388 1390
1389 '''Write common configuration for target usage''' 1391 '''Write common configuration for target usage'''
1390 def rpm_setup_smart_target_config(self): 1392 def rpm_setup_smart_target_config(self):
@@ -1417,7 +1419,7 @@ class RpmPM(PackageManager):
1417 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 1419 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
1418 except subprocess.CalledProcessError as e: 1420 except subprocess.CalledProcessError as e:
1419 bb.fatal("Unable to list available packages. Command '%s' " 1421 bb.fatal("Unable to list available packages. Command '%s' "
1420 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1422 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1421 1423
1422 # Set default values to avoid UnboundLocalError 1424 # Set default values to avoid UnboundLocalError
1423 arch = "" 1425 arch = ""
@@ -1482,7 +1484,7 @@ class RpmPM(PackageManager):
1482 except subprocess.CalledProcessError as e: 1484 except subprocess.CalledProcessError as e:
1483 bb.utils.remove(tmp_dir, recurse=True) 1485 bb.utils.remove(tmp_dir, recurse=True)
1484 bb.fatal("Unable to extract %s package. Command '%s' " 1486 bb.fatal("Unable to extract %s package. Command '%s' "
1485 "returned %d:\n%s" % (pkg_path, cmd, e.returncode, e.output)) 1487 "returned %d:\n%s" % (pkg_path, cmd, e.returncode, e.output.decode("utf-8")))
1486 except OSError as e: 1488 except OSError as e:
1487 bb.utils.remove(tmp_dir, recurse=True) 1489 bb.utils.remove(tmp_dir, recurse=True)
1488 bb.fatal("Unable to extract %s package. Command '%s' " 1490 bb.fatal("Unable to extract %s package. Command '%s' "
@@ -1512,7 +1514,7 @@ class OpkgDpkgPM(PackageManager):
1512 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 1514 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
1513 except subprocess.CalledProcessError as e: 1515 except subprocess.CalledProcessError as e:
1514 bb.fatal("Unable to list available packages. Command '%s' " 1516 bb.fatal("Unable to list available packages. Command '%s' "
1515 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1517 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1516 return opkg_query(output) 1518 return opkg_query(output)
1517 1519
1518 """ 1520 """
@@ -1544,7 +1546,7 @@ class OpkgDpkgPM(PackageManager):
1544 except subprocess.CalledProcessError as e: 1546 except subprocess.CalledProcessError as e:
1545 bb.utils.remove(tmp_dir, recurse=True) 1547 bb.utils.remove(tmp_dir, recurse=True)
1546 bb.fatal("Unable to extract %s package. Command '%s' " 1548 bb.fatal("Unable to extract %s package. Command '%s' "
1547 "returned %d:\n%s" % (pkg_path, cmd, e.returncode, e.output)) 1549 "returned %d:\n%s" % (pkg_path, cmd, e.returncode, e.output.decode("utf-8")))
1548 except OSError as e: 1550 except OSError as e:
1549 bb.utils.remove(tmp_dir, recurse=True) 1551 bb.utils.remove(tmp_dir, recurse=True)
1550 bb.fatal("Unable to extract %s package. Command '%s' " 1552 bb.fatal("Unable to extract %s package. Command '%s' "
@@ -1733,7 +1735,7 @@ class OpkgPM(OpkgDpkgPM):
1733 except subprocess.CalledProcessError as e: 1735 except subprocess.CalledProcessError as e:
1734 self.deploy_dir_unlock() 1736 self.deploy_dir_unlock()
1735 bb.fatal("Unable to update the package index files. Command '%s' " 1737 bb.fatal("Unable to update the package index files. Command '%s' "
1736 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1738 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1737 1739
1738 self.deploy_dir_unlock() 1740 self.deploy_dir_unlock()
1739 1741
@@ -1754,12 +1756,12 @@ class OpkgPM(OpkgDpkgPM):
1754 try: 1756 try:
1755 bb.note("Installing the following packages: %s" % ' '.join(pkgs)) 1757 bb.note("Installing the following packages: %s" % ' '.join(pkgs))
1756 bb.note(cmd) 1758 bb.note(cmd)
1757 output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) 1759 output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT).decode("utf-8")
1758 bb.note(output) 1760 bb.note(output)
1759 except subprocess.CalledProcessError as e: 1761 except subprocess.CalledProcessError as e:
1760 (bb.fatal, bb.note)[attempt_only]("Unable to install packages. " 1762 (bb.fatal, bb.note)[attempt_only]("Unable to install packages. "
1761 "Command '%s' returned %d:\n%s" % 1763 "Command '%s' returned %d:\n%s" %
1762 (cmd, e.returncode, e.output)) 1764 (cmd, e.returncode, e.output.decode("utf-8")))
1763 1765
1764 def remove(self, pkgs, with_dependencies=True): 1766 def remove(self, pkgs, with_dependencies=True):
1765 if with_dependencies: 1767 if with_dependencies:
@@ -1771,11 +1773,11 @@ class OpkgPM(OpkgDpkgPM):
1771 1773
1772 try: 1774 try:
1773 bb.note(cmd) 1775 bb.note(cmd)
1774 output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) 1776 output = subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT).decode("utf-8")
1775 bb.note(output) 1777 bb.note(output)
1776 except subprocess.CalledProcessError as e: 1778 except subprocess.CalledProcessError as e:
1777 bb.fatal("Unable to remove packages. Command '%s' " 1779 bb.fatal("Unable to remove packages. Command '%s' "
1778 "returned %d:\n%s" % (e.cmd, e.returncode, e.output)) 1780 "returned %d:\n%s" % (e.cmd, e.returncode, e.output.decode("utf-8")))
1779 1781
1780 def write_index(self): 1782 def write_index(self):
1781 self.deploy_dir_lock() 1783 self.deploy_dir_lock()
@@ -1818,10 +1820,10 @@ class OpkgPM(OpkgDpkgPM):
1818 pkg_info = cmd + pkg 1820 pkg_info = cmd + pkg
1819 1821
1820 try: 1822 try:
1821 output = subprocess.check_output(pkg_info.split(), stderr=subprocess.STDOUT).strip() 1823 output = subprocess.check_output(pkg_info.split(), stderr=subprocess.STDOUT).strip().decode("utf-8")
1822 except subprocess.CalledProcessError as e: 1824 except subprocess.CalledProcessError as e:
1823 bb.fatal("Cannot get package info. Command '%s' " 1825 bb.fatal("Cannot get package info. Command '%s' "
1824 "returned %d:\n%s" % (pkg_info, e.returncode, e.output)) 1826 "returned %d:\n%s" % (pkg_info, e.returncode, e.output.decode("utf-8")))
1825 1827
1826 if output == "": 1828 if output == "":
1827 bb.note("Ignored bad recommendation: '%s' is " 1829 bb.note("Ignored bad recommendation: '%s' is "
@@ -1858,7 +1860,7 @@ class OpkgPM(OpkgDpkgPM):
1858 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 1860 subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
1859 except subprocess.CalledProcessError as e: 1861 except subprocess.CalledProcessError as e:
1860 bb.fatal("Unable to update. Command '%s' " 1862 bb.fatal("Unable to update. Command '%s' "
1861 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1863 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1862 1864
1863 # Dummy installation 1865 # Dummy installation
1864 cmd = "%s %s --noaction install %s " % (self.opkg_cmd, 1866 cmd = "%s %s --noaction install %s " % (self.opkg_cmd,
@@ -1868,7 +1870,7 @@ class OpkgPM(OpkgDpkgPM):
1868 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) 1870 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
1869 except subprocess.CalledProcessError as e: 1871 except subprocess.CalledProcessError as e:
1870 bb.fatal("Unable to dummy install packages. Command '%s' " 1872 bb.fatal("Unable to dummy install packages. Command '%s' "
1871 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 1873 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
1872 1874
1873 bb.utils.remove(temp_rootfs, True) 1875 bb.utils.remove(temp_rootfs, True)
1874 1876
@@ -2012,7 +2014,7 @@ class DpkgPM(OpkgDpkgPM):
2012 subprocess.check_output(p_full, stderr=subprocess.STDOUT) 2014 subprocess.check_output(p_full, stderr=subprocess.STDOUT)
2013 except subprocess.CalledProcessError as e: 2015 except subprocess.CalledProcessError as e:
2014 bb.note("%s for package %s failed with %d:\n%s" % 2016 bb.note("%s for package %s failed with %d:\n%s" %
2015 (suffix[1], pkg_name, e.returncode, e.output)) 2017 (suffix[1], pkg_name, e.returncode, e.output.decode("utf-8")))
2016 failed_pkgs.append(pkg_name) 2018 failed_pkgs.append(pkg_name)
2017 break 2019 break
2018 2020
@@ -2030,7 +2032,7 @@ class DpkgPM(OpkgDpkgPM):
2030 subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) 2032 subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT)
2031 except subprocess.CalledProcessError as e: 2033 except subprocess.CalledProcessError as e:
2032 bb.fatal("Unable to update the package index files. Command '%s' " 2034 bb.fatal("Unable to update the package index files. Command '%s' "
2033 "returned %d:\n%s" % (e.cmd, e.returncode, e.output)) 2035 "returned %d:\n%s" % (e.cmd, e.returncode, e.output.decode("utf-8")))
2034 2036
2035 self.deploy_dir_unlock() 2037 self.deploy_dir_unlock()
2036 2038
@@ -2049,7 +2051,7 @@ class DpkgPM(OpkgDpkgPM):
2049 except subprocess.CalledProcessError as e: 2051 except subprocess.CalledProcessError as e:
2050 (bb.fatal, bb.note)[attempt_only]("Unable to install packages. " 2052 (bb.fatal, bb.note)[attempt_only]("Unable to install packages. "
2051 "Command '%s' returned %d:\n%s" % 2053 "Command '%s' returned %d:\n%s" %
2052 (cmd, e.returncode, e.output)) 2054 (cmd, e.returncode, e.output.decode("utf-8")))
2053 2055
2054 # rename *.dpkg-new files/dirs 2056 # rename *.dpkg-new files/dirs
2055 for root, dirs, files in os.walk(self.target_rootfs): 2057 for root, dirs, files in os.walk(self.target_rootfs):
@@ -2080,7 +2082,7 @@ class DpkgPM(OpkgDpkgPM):
2080 subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) 2082 subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT)
2081 except subprocess.CalledProcessError as e: 2083 except subprocess.CalledProcessError as e:
2082 bb.fatal("Unable to remove packages. Command '%s' " 2084 bb.fatal("Unable to remove packages. Command '%s' "
2083 "returned %d:\n%s" % (e.cmd, e.returncode, e.output)) 2085 "returned %d:\n%s" % (e.cmd, e.returncode, e.output.decode("utf-8")))
2084 2086
2085 def write_index(self): 2087 def write_index(self):
2086 self.deploy_dir_lock() 2088 self.deploy_dir_lock()
@@ -2213,7 +2215,7 @@ class DpkgPM(OpkgDpkgPM):
2213 subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) 2215 subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT)
2214 except subprocess.CalledProcessError as e: 2216 except subprocess.CalledProcessError as e:
2215 bb.fatal("Cannot fix broken dependencies. Command '%s' " 2217 bb.fatal("Cannot fix broken dependencies. Command '%s' "
2216 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 2218 "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8")))
2217 2219
2218 def list_installed(self): 2220 def list_installed(self):
2219 return DpkgPkgsList(self.d, self.target_rootfs).list_pkgs() 2221 return DpkgPkgsList(self.d, self.target_rootfs).list_pkgs()
diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py
index bc0fd06..df1b4c5 100644
--- a/meta/lib/oe/packagedata.py
+++ b/meta/lib/oe/packagedata.py
@@ -8,7 +8,7 @@ def read_pkgdatafile(fn):
8 pkgdata = {} 8 pkgdata = {}
9 9
10 def decode(str): 10 def decode(str):
11 c = codecs.getdecoder("string_escape") 11 c = codecs.getdecoder("unicode_escape")
12 return c(str)[0] 12 return c(str)[0]
13 13
14 if os.access(fn, os.R_OK): 14 if os.access(fn, os.R_OK):
diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index a50f9d8..4211ffc 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -132,7 +132,7 @@ class oeSDKTest(oeTest):
132 return False 132 return False
133 133
134 def _run(self, cmd): 134 def _run(self, cmd):
135 return subprocess.check_output(". %s > /dev/null; %s;" % (self.tc.sdkenv, cmd), shell=True) 135 return subprocess.check_output(". %s > /dev/null; %s;" % (self.tc.sdkenv, cmd), shell=True).decode("utf-8")
136 136
137class oeSDKExtTest(oeSDKTest): 137class oeSDKExtTest(oeSDKTest):
138 def _run(self, cmd): 138 def _run(self, cmd):
@@ -144,7 +144,7 @@ class oeSDKExtTest(oeSDKTest):
144 env['PATH'] = avoid_paths_in_environ(paths_to_avoid) 144 env['PATH'] = avoid_paths_in_environ(paths_to_avoid)
145 145
146 return subprocess.check_output(". %s > /dev/null;"\ 146 return subprocess.check_output(". %s > /dev/null;"\
147 " %s;" % (self.tc.sdkenv, cmd), shell=True, env=env) 147 " %s;" % (self.tc.sdkenv, cmd), shell=True, env=env).decode("utf-8")
148 148
149def getmodule(pos=2): 149def getmodule(pos=2):
150 # stack returns a list of tuples containg frame information 150 # stack returns a list of tuples containg frame information
diff --git a/meta/lib/oeqa/runtime/parselogs.py b/meta/lib/oeqa/runtime/parselogs.py
index a936601..242cd8c 100644
--- a/meta/lib/oeqa/runtime/parselogs.py
+++ b/meta/lib/oeqa/runtime/parselogs.py
@@ -238,7 +238,7 @@ class ParseLogsTest(oeRuntimeTest):
238 result = None 238 result = None
239 thegrep = self.build_grepcmd(errors, ignore_errors, log) 239 thegrep = self.build_grepcmd(errors, ignore_errors, log)
240 try: 240 try:
241 result = subprocess.check_output(thegrep, shell=True) 241 result = subprocess.check_output(thegrep, shell=True).decode("utf-8")
242 except: 242 except:
243 pass 243 pass
244 if (result is not None): 244 if (result is not None):
@@ -246,7 +246,7 @@ class ParseLogsTest(oeRuntimeTest):
246 rez = result.splitlines() 246 rez = result.splitlines()
247 for xrez in rez: 247 for xrez in rez:
248 try: 248 try:
249 grep_output = subprocess.check_output(['grep', '-F', xrez, '-B', str(lines_before), '-A', str(lines_after), log]) 249 grep_output = subprocess.check_output(['grep', '-F', xrez, '-B', str(lines_before), '-A', str(lines_after), log]).decode("utf-8")
250 except: 250 except:
251 pass 251 pass
252 results[log.replace('target_logs/','')][xrez]=grep_output 252 results[log.replace('target_logs/','')][xrez]=grep_output
diff --git a/meta/lib/oeqa/runtime/ping.py b/meta/lib/oeqa/runtime/ping.py
index 80c4601..0f27447 100644
--- a/meta/lib/oeqa/runtime/ping.py
+++ b/meta/lib/oeqa/runtime/ping.py
@@ -14,7 +14,7 @@ class PingTest(oeRuntimeTest):
14 endtime = time.time() + 60 14 endtime = time.time() + 60
15 while count < 5 and time.time() < endtime: 15 while count < 5 and time.time() < endtime:
16 proc = subprocess.Popen("ping -c 1 %s" % self.target.ip, shell=True, stdout=subprocess.PIPE) 16 proc = subprocess.Popen("ping -c 1 %s" % self.target.ip, shell=True, stdout=subprocess.PIPE)
17 output += proc.communicate()[0] 17 output += proc.communicate()[0].decode("utf-8")
18 if proc.poll() == 0: 18 if proc.poll() == 0:
19 count += 1 19 count += 1
20 else: 20 else:
diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 48f6441..9a7c1d1 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -78,7 +78,7 @@ class Command(object):
78 self.process.kill() 78 self.process.kill()
79 self.thread.join() 79 self.thread.join()
80 80
81 self.output = self.output.rstrip() 81 self.output = self.output.decode("utf-8").rstrip()
82 self.status = self.process.poll() 82 self.status = self.process.poll()
83 83
84 self.log.debug("Command '%s' returned %d as exit code." % (self.cmd, self.status)) 84 self.log.debug("Command '%s' returned %d as exit code." % (self.cmd, self.status))
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 695402f..f51de99 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -71,7 +71,8 @@ class QemuRunner:
71 if self.logfile: 71 if self.logfile:
72 # It is needed to sanitize the data received from qemu 72 # It is needed to sanitize the data received from qemu
73 # because is possible to have control characters 73 # because is possible to have control characters
74 msg = re_control_char.sub('', unicode(msg, 'utf-8')) 74 msg = msg.decode("utf-8")
75 msg = re_control_char.sub('', msg)
75 with codecs.open(self.logfile, "a", encoding="utf-8") as f: 76 with codecs.open(self.logfile, "a", encoding="utf-8") as f:
76 f.write("%s" % msg) 77 f.write("%s" % msg)
77 78
@@ -79,7 +80,7 @@ class QemuRunner:
79 import fcntl 80 import fcntl
80 fl = fcntl.fcntl(o, fcntl.F_GETFL) 81 fl = fcntl.fcntl(o, fcntl.F_GETFL)
81 fcntl.fcntl(o, fcntl.F_SETFL, fl | os.O_NONBLOCK) 82 fcntl.fcntl(o, fcntl.F_SETFL, fl | os.O_NONBLOCK)
82 return os.read(o.fileno(), 1000000) 83 return os.read(o.fileno(), 1000000).decode("utf-8")
83 84
84 85
85 def handleSIGCHLD(self, signum, frame): 86 def handleSIGCHLD(self, signum, frame):
@@ -229,14 +230,19 @@ class QemuRunner:
229 socklist.remove(self.server_socket) 230 socklist.remove(self.server_socket)
230 logger.info("Connection from %s:%s" % addr) 231 logger.info("Connection from %s:%s" % addr)
231 else: 232 else:
232 data = sock.recv(1024) 233 data = data + sock.recv(1024)
233 if data: 234 if data:
234 bootlog += data 235 try:
235 if re.search(".* login:", bootlog): 236 data = data.decode("utf-8")
236 self.server_socket = qemusock 237 bootlog += data
237 stopread = True 238 data = b''
238 reachedlogin = True 239 if re.search(".* login:", bootlog):
239 logger.info("Reached login banner") 240 self.server_socket = qemusock
241 stopread = True
242 reachedlogin = True
243 logger.info("Reached login banner")
244 except UnicodeDecodeError:
245 continue
240 else: 246 else:
241 socklist.remove(sock) 247 socklist.remove(sock)
242 sock.close() 248 sock.close()
@@ -325,7 +331,7 @@ class QemuRunner:
325 # Walk the process tree from the process specified looking for a qemu-system. Return its [pid'cmd] 331 # Walk the process tree from the process specified looking for a qemu-system. Return its [pid'cmd]
326 # 332 #
327 ps = subprocess.Popen(['ps', 'axww', '-o', 'pid,ppid,command'], stdout=subprocess.PIPE).communicate()[0] 333 ps = subprocess.Popen(['ps', 'axww', '-o', 'pid,ppid,command'], stdout=subprocess.PIPE).communicate()[0]
328 processes = ps.split('\n') 334 processes = ps.decode("utf-8").split('\n')
329 nfields = len(processes[0].split()) - 1 335 nfields = len(processes[0].split()) - 1
330 pids = {} 336 pids = {}
331 commands = {} 337 commands = {}
diff --git a/meta/lib/oeqa/utils/qemutinyrunner.py b/meta/lib/oeqa/utils/qemutinyrunner.py
index d6ce096..054ab0e 100644
--- a/meta/lib/oeqa/utils/qemutinyrunner.py
+++ b/meta/lib/oeqa/utils/qemutinyrunner.py
@@ -102,7 +102,7 @@ class QemuTinyRunner(QemuRunner):
102 bb.note("Qemu pid didn't appeared in %s seconds" % self.runqemutime) 102 bb.note("Qemu pid didn't appeared in %s seconds" % self.runqemutime)
103 output = self.runqemu.stdout 103 output = self.runqemu.stdout
104 self.stop() 104 self.stop()
105 bb.note("Output from runqemu:\n%s" % output.read()) 105 bb.note("Output from runqemu:\n%s" % output.read().decode("utf-8"))
106 return False 106 return False
107 107
108 return self.is_alive() 108 return self.is_alive()
@@ -131,7 +131,7 @@ class QemuTinyRunner(QemuRunner):
131 # Walk the process tree from the process specified looking for a qemu-system. Return its [pid'cmd] 131 # Walk the process tree from the process specified looking for a qemu-system. Return its [pid'cmd]
132 # 132 #
133 ps = subprocess.Popen(['ps', 'axww', '-o', 'pid,ppid,command'], stdout=subprocess.PIPE).communicate()[0] 133 ps = subprocess.Popen(['ps', 'axww', '-o', 'pid,ppid,command'], stdout=subprocess.PIPE).communicate()[0]
134 processes = ps.split('\n') 134 processes = ps.decode("utf-8").split('\n')
135 nfields = len(processes[0].split()) - 1 135 nfields = len(processes[0].split()) - 1
136 pids = {} 136 pids = {}
137 commands = {} 137 commands = {}
diff --git a/meta/lib/oeqa/utils/sshcontrol.py b/meta/lib/oeqa/utils/sshcontrol.py
index ff88d37..f5d46e0 100644
--- a/meta/lib/oeqa/utils/sshcontrol.py
+++ b/meta/lib/oeqa/utils/sshcontrol.py
@@ -58,6 +58,7 @@ class SSHProcess(object):
58 self.process.stdout.close() 58 self.process.stdout.close()
59 eof = True 59 eof = True
60 else: 60 else:
61 data = data.decode("utf-8")
61 output += data 62 output += data
62 self.log(data) 63 self.log(data)
63 endtime = time.time() + timeout 64 endtime = time.time() + timeout
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc b/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
index 30307bc..371c279 100644
--- a/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
@@ -168,9 +168,10 @@ python populate_packages_prepend() {
168 } 168 }
169 p = subprocess.Popen(args="pkg-config --variable=%s xorg-server" % abis[name], 169 p = subprocess.Popen(args="pkg-config --variable=%s xorg-server" % abis[name],
170 shell=True, env=newenv, stdout=subprocess.PIPE) 170 shell=True, env=newenv, stdout=subprocess.PIPE)
171 output = p.communicate()[0] 171 stdout, stderr = p.communicate()
172 output = stdout.decode("utf-8").split(".")[0]
172 mlprefix = d.getVar('MLPREFIX', True) or '' 173 mlprefix = d.getVar('MLPREFIX', True) or ''
173 return "%sxorg-abi-%s-%s" % (mlprefix, name, output.split(".")[0]) 174 return "%sxorg-abi-%s-%s" % (mlprefix, name, output)
174 175
175 pn = d.getVar("PN", True) 176 pn = d.getVar("PN", True)
176 d.appendVar("RPROVIDES_" + pn, " " + get_abi("input")) 177 d.appendVar("RPROVIDES_" + pn, " " + get_abi("input"))