summaryrefslogtreecommitdiffstats
path: root/meta/classes/buildhistory.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/buildhistory.bbclass')
-rw-r--r--meta/classes/buildhistory.bbclass21
1 files changed, 11 insertions, 10 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 581d532693..3db92d4de7 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -64,6 +64,11 @@ python buildhistory_emit_pkghistory() {
64 if not d.getVar('BB_CURRENTTASK', True) in ['packagedata', 'packagedata_setscene']: 64 if not d.getVar('BB_CURRENTTASK', True) in ['packagedata', 'packagedata_setscene']:
65 return 0 65 return 0
66 66
67 import re
68 import sys
69 if sys.version > '3':
70 long = int
71
67 if not "package" in (d.getVar('BUILDHISTORY_FEATURES', True) or "").split(): 72 if not "package" in (d.getVar('BUILDHISTORY_FEATURES', True) or "").split():
68 return 0 73 return 0
69 74
@@ -233,7 +238,7 @@ python buildhistory_emit_pkghistory() {
233 key = item[0] 238 key = item[0]
234 if key.endswith('_' + pkg): 239 if key.endswith('_' + pkg):
235 key = key[:-len(pkg)-1] 240 key = key[:-len(pkg)-1]
236 pkgdata[key] = item[1].decode('utf-8').decode('string_escape') 241 pkgdata[key] = item[1]
237 242
238 pkge = pkgdata.get('PKGE', '0') 243 pkge = pkgdata.get('PKGE', '0')
239 pkgv = pkgdata['PKGV'] 244 pkgv = pkgdata['PKGV']
@@ -274,7 +279,7 @@ python buildhistory_emit_pkghistory() {
274 # Gather information about packaged files 279 # Gather information about packaged files
275 val = pkgdata.get('FILES_INFO', '') 280 val = pkgdata.get('FILES_INFO', '')
276 dictval = json.loads(val) 281 dictval = json.loads(val)
277 filelist = dictval.keys() 282 filelist = list(dictval.keys())
278 filelist.sort() 283 filelist.sort()
279 pkginfo.filelist = " ".join(filelist) 284 pkginfo.filelist = " ".join(filelist)
280 285
@@ -288,14 +293,12 @@ python buildhistory_emit_pkghistory() {
288 293
289 294
290def write_recipehistory(rcpinfo, d): 295def write_recipehistory(rcpinfo, d):
291 import codecs
292
293 bb.debug(2, "Writing recipe history") 296 bb.debug(2, "Writing recipe history")
294 297
295 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) 298 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
296 299
297 infofile = os.path.join(pkghistdir, "latest") 300 infofile = os.path.join(pkghistdir, "latest")
298 with codecs.open(infofile, "w", encoding='utf8') as f: 301 with open(infofile, "w") as f:
299 if rcpinfo.pe != "0": 302 if rcpinfo.pe != "0":
300 f.write(u"PE = %s\n" % rcpinfo.pe) 303 f.write(u"PE = %s\n" % rcpinfo.pe)
301 f.write(u"PV = %s\n" % rcpinfo.pv) 304 f.write(u"PV = %s\n" % rcpinfo.pv)
@@ -305,8 +308,6 @@ def write_recipehistory(rcpinfo, d):
305 308
306 309
307def write_pkghistory(pkginfo, d): 310def write_pkghistory(pkginfo, d):
308 import codecs
309
310 bb.debug(2, "Writing package history for package %s" % pkginfo.name) 311 bb.debug(2, "Writing package history for package %s" % pkginfo.name)
311 312
312 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) 313 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
@@ -316,7 +317,7 @@ def write_pkghistory(pkginfo, d):
316 bb.utils.mkdirhier(pkgpath) 317 bb.utils.mkdirhier(pkgpath)
317 318
318 infofile = os.path.join(pkgpath, "latest") 319 infofile = os.path.join(pkgpath, "latest")
319 with codecs.open(infofile, "w", encoding='utf8') as f: 320 with open(infofile, "w") as f:
320 if pkginfo.pe != "0": 321 if pkginfo.pe != "0":
321 f.write(u"PE = %s\n" % pkginfo.pe) 322 f.write(u"PE = %s\n" % pkginfo.pe)
322 f.write(u"PV = %s\n" % pkginfo.pv) 323 f.write(u"PV = %s\n" % pkginfo.pv)
@@ -349,7 +350,7 @@ def write_pkghistory(pkginfo, d):
349 filevarpath = os.path.join(pkgpath, "latest.%s" % filevar) 350 filevarpath = os.path.join(pkgpath, "latest.%s" % filevar)
350 val = pkginfo.filevars[filevar] 351 val = pkginfo.filevars[filevar]
351 if val: 352 if val:
352 with codecs.open(filevarpath, "w", encoding='utf8') as f: 353 with open(filevarpath, "w") as f:
353 f.write(val) 354 f.write(val)
354 else: 355 else:
355 if os.path.exists(filevarpath): 356 if os.path.exists(filevarpath):
@@ -842,7 +843,7 @@ python write_srcrev() {
842 f.write('# SRCREV_%s = "%s"\n' % (name, orig_srcrev)) 843 f.write('# SRCREV_%s = "%s"\n' % (name, orig_srcrev))
843 f.write('SRCREV_%s = "%s"\n' % (name, srcrev)) 844 f.write('SRCREV_%s = "%s"\n' % (name, srcrev))
844 else: 845 else:
845 f.write('SRCREV = "%s"\n' % srcrevs.itervalues().next()) 846 f.write('SRCREV = "%s"\n' % srcrevs.values())
846 if len(tag_srcrevs) > 0: 847 if len(tag_srcrevs) > 0:
847 for name, srcrev in tag_srcrevs.items(): 848 for name, srcrev in tag_srcrevs.items():
848 f.write('# tag_%s = "%s"\n' % (name, srcrev)) 849 f.write('# tag_%s = "%s"\n' % (name, srcrev))