summaryrefslogtreecommitdiffstats
path: root/meta/classes/buildhistory.bbclass
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/classes/buildhistory.bbclass
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/classes/buildhistory.bbclass')
-rw-r--r--meta/classes/buildhistory.bbclass12
1 files changed, 4 insertions, 8 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 581d532693..e3b5c44a09 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):