summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2014-02-06 11:02:55 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-06 15:30:44 +0000
commit618931eb0297391bd8e5346d297c2bcab7e088cf (patch)
treecdfab77c0c5c8c643c68bfba448e202c432607de /meta/classes
parent4e9eb77108c7e628ebd00ec848b8bc034802e197 (diff)
downloadpoky-618931eb0297391bd8e5346d297c2bcab7e088cf.tar.gz
classes/buildhistory: write out files in UTF-8 format
If the package information contained unicode characters (for example, in the package file listing) then writing them out as ASCII would fail, so write them out using codecs.open() instead of open() using UTF-8. This fixes ca-certificates failing in do_packagedata when buildhistory is enabled. (From OE-Core rev: dcf228fe69bfee4e22baad477ad407248c0f9cdb) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/buildhistory.bbclass46
1 files changed, 25 insertions, 21 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 6b097ea20f..6d1e74afe1 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -242,21 +242,25 @@ python buildhistory_emit_pkghistory() {
242 242
243 243
244def write_recipehistory(rcpinfo, d): 244def write_recipehistory(rcpinfo, d):
245 import codecs
246
245 bb.debug(2, "Writing recipe history") 247 bb.debug(2, "Writing recipe history")
246 248
247 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) 249 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
248 250
249 infofile = os.path.join(pkghistdir, "latest") 251 infofile = os.path.join(pkghistdir, "latest")
250 with open(infofile, "w") as f: 252 with codecs.open(infofile, "w", encoding='utf8') as f:
251 if rcpinfo.pe != "0": 253 if rcpinfo.pe != "0":
252 f.write("PE = %s\n" % rcpinfo.pe) 254 f.write(u"PE = %s\n" % rcpinfo.pe)
253 f.write("PV = %s\n" % rcpinfo.pv) 255 f.write(u"PV = %s\n" % rcpinfo.pv)
254 f.write("PR = %s\n" % rcpinfo.pr) 256 f.write(u"PR = %s\n" % rcpinfo.pr)
255 f.write("DEPENDS = %s\n" % rcpinfo.depends) 257 f.write(u"DEPENDS = %s\n" % rcpinfo.depends)
256 f.write("PACKAGES = %s\n" % rcpinfo.packages) 258 f.write(u"PACKAGES = %s\n" % rcpinfo.packages)
257 259
258 260
259def write_pkghistory(pkginfo, d): 261def write_pkghistory(pkginfo, d):
262 import codecs
263
260 bb.debug(2, "Writing package history for package %s" % pkginfo.name) 264 bb.debug(2, "Writing package history for package %s" % pkginfo.name)
261 265
262 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) 266 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
@@ -266,11 +270,11 @@ def write_pkghistory(pkginfo, d):
266 bb.utils.mkdirhier(pkgpath) 270 bb.utils.mkdirhier(pkgpath)
267 271
268 infofile = os.path.join(pkgpath, "latest") 272 infofile = os.path.join(pkgpath, "latest")
269 with open(infofile, "w") as f: 273 with codecs.open(infofile, "w", encoding='utf8') as f:
270 if pkginfo.pe != "0": 274 if pkginfo.pe != "0":
271 f.write("PE = %s\n" % pkginfo.pe) 275 f.write(u"PE = %s\n" % pkginfo.pe)
272 f.write("PV = %s\n" % pkginfo.pv) 276 f.write(u"PV = %s\n" % pkginfo.pv)
273 f.write("PR = %s\n" % pkginfo.pr) 277 f.write(u"PR = %s\n" % pkginfo.pr)
274 278
275 pkgvars = {} 279 pkgvars = {}
276 pkgvars['PKG'] = pkginfo.pkg if pkginfo.pkg != pkginfo.name else '' 280 pkgvars['PKG'] = pkginfo.pkg if pkginfo.pkg != pkginfo.name else ''
@@ -280,26 +284,26 @@ def write_pkghistory(pkginfo, d):
280 for pkgvar in pkgvars: 284 for pkgvar in pkgvars:
281 val = pkgvars[pkgvar] 285 val = pkgvars[pkgvar]
282 if val: 286 if val:
283 f.write("%s = %s\n" % (pkgvar, val)) 287 f.write(u"%s = %s\n" % (pkgvar, val))
284 288
285 f.write("RPROVIDES = %s\n" % pkginfo.rprovides) 289 f.write(u"RPROVIDES = %s\n" % pkginfo.rprovides)
286 f.write("RDEPENDS = %s\n" % pkginfo.rdepends) 290 f.write(u"RDEPENDS = %s\n" % pkginfo.rdepends)
287 f.write("RRECOMMENDS = %s\n" % pkginfo.rrecommends) 291 f.write(u"RRECOMMENDS = %s\n" % pkginfo.rrecommends)
288 if pkginfo.rsuggests: 292 if pkginfo.rsuggests:
289 f.write("RSUGGESTS = %s\n" % pkginfo.rsuggests) 293 f.write(u"RSUGGESTS = %s\n" % pkginfo.rsuggests)
290 if pkginfo.rreplaces: 294 if pkginfo.rreplaces:
291 f.write("RREPLACES = %s\n" % pkginfo.rreplaces) 295 f.write(u"RREPLACES = %s\n" % pkginfo.rreplaces)
292 if pkginfo.rconflicts: 296 if pkginfo.rconflicts:
293 f.write("RCONFLICTS = %s\n" % pkginfo.rconflicts) 297 f.write(u"RCONFLICTS = %s\n" % pkginfo.rconflicts)
294 f.write("PKGSIZE = %d\n" % pkginfo.size) 298 f.write(u"PKGSIZE = %d\n" % pkginfo.size)
295 f.write("FILES = %s\n" % pkginfo.files) 299 f.write(u"FILES = %s\n" % pkginfo.files)
296 f.write("FILELIST = %s\n" % pkginfo.filelist) 300 f.write(u"FILELIST = %s\n" % pkginfo.filelist)
297 301
298 for filevar in pkginfo.filevars: 302 for filevar in pkginfo.filevars:
299 filevarpath = os.path.join(pkgpath, "latest.%s" % filevar) 303 filevarpath = os.path.join(pkgpath, "latest.%s" % filevar)
300 val = pkginfo.filevars[filevar] 304 val = pkginfo.filevars[filevar]
301 if val: 305 if val:
302 with open(filevarpath, "w") as f: 306 with codecs.open(filevarpath, "w", encoding='utf8') as f:
303 f.write(val) 307 f.write(val)
304 else: 308 else:
305 if os.path.exists(filevarpath): 309 if os.path.exists(filevarpath):