aboutsummaryrefslogtreecommitdiffstats
path: root/meta
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:23:39 +0000
commitdcf228fe69bfee4e22baad477ad407248c0f9cdb (patch)
tree06b295169f6f23c149f0d88a8ae6f41dfa30a679 /meta
parent8461283a648d7c5affd51971ebd9b35a8a4c625f (diff)
downloadopenembedded-core-dcf228fe69bfee4e22baad477ad407248c0f9cdb.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. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-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() {
def write_recipehistory(rcpinfo, d):
+ import codecs
+
bb.debug(2, "Writing recipe history")
pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
infofile = os.path.join(pkghistdir, "latest")
- with open(infofile, "w") as f:
+ with codecs.open(infofile, "w", encoding='utf8') as f:
if rcpinfo.pe != "0":
- f.write("PE = %s\n" % rcpinfo.pe)
- f.write("PV = %s\n" % rcpinfo.pv)
- f.write("PR = %s\n" % rcpinfo.pr)
- f.write("DEPENDS = %s\n" % rcpinfo.depends)
- f.write("PACKAGES = %s\n" % rcpinfo.packages)
+ f.write(u"PE = %s\n" % rcpinfo.pe)
+ f.write(u"PV = %s\n" % rcpinfo.pv)
+ f.write(u"PR = %s\n" % rcpinfo.pr)
+ f.write(u"DEPENDS = %s\n" % rcpinfo.depends)
+ f.write(u"PACKAGES = %s\n" % rcpinfo.packages)
def write_pkghistory(pkginfo, d):
+ import codecs
+
bb.debug(2, "Writing package history for package %s" % pkginfo.name)
pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
@@ -266,11 +270,11 @@ def write_pkghistory(pkginfo, d):
bb.utils.mkdirhier(pkgpath)
infofile = os.path.join(pkgpath, "latest")
- with open(infofile, "w") as f:
+ with codecs.open(infofile, "w", encoding='utf8') as f:
if pkginfo.pe != "0":
- f.write("PE = %s\n" % pkginfo.pe)
- f.write("PV = %s\n" % pkginfo.pv)
- f.write("PR = %s\n" % pkginfo.pr)
+ f.write(u"PE = %s\n" % pkginfo.pe)
+ f.write(u"PV = %s\n" % pkginfo.pv)
+ f.write(u"PR = %s\n" % pkginfo.pr)
pkgvars = {}
pkgvars['PKG'] = pkginfo.pkg if pkginfo.pkg != pkginfo.name else ''
@@ -280,26 +284,26 @@ def write_pkghistory(pkginfo, d):
for pkgvar in pkgvars:
val = pkgvars[pkgvar]
if val:
- f.write("%s = %s\n" % (pkgvar, val))
+ f.write(u"%s = %s\n" % (pkgvar, val))
- f.write("RPROVIDES = %s\n" % pkginfo.rprovides)
- f.write("RDEPENDS = %s\n" % pkginfo.rdepends)
- f.write("RRECOMMENDS = %s\n" % pkginfo.rrecommends)
+ f.write(u"RPROVIDES = %s\n" % pkginfo.rprovides)
+ f.write(u"RDEPENDS = %s\n" % pkginfo.rdepends)
+ f.write(u"RRECOMMENDS = %s\n" % pkginfo.rrecommends)
if pkginfo.rsuggests:
- f.write("RSUGGESTS = %s\n" % pkginfo.rsuggests)
+ f.write(u"RSUGGESTS = %s\n" % pkginfo.rsuggests)
if pkginfo.rreplaces:
- f.write("RREPLACES = %s\n" % pkginfo.rreplaces)
+ f.write(u"RREPLACES = %s\n" % pkginfo.rreplaces)
if pkginfo.rconflicts:
- f.write("RCONFLICTS = %s\n" % pkginfo.rconflicts)
- f.write("PKGSIZE = %d\n" % pkginfo.size)
- f.write("FILES = %s\n" % pkginfo.files)
- f.write("FILELIST = %s\n" % pkginfo.filelist)
+ f.write(u"RCONFLICTS = %s\n" % pkginfo.rconflicts)
+ f.write(u"PKGSIZE = %d\n" % pkginfo.size)
+ f.write(u"FILES = %s\n" % pkginfo.files)
+ f.write(u"FILELIST = %s\n" % pkginfo.filelist)
for filevar in pkginfo.filevars:
filevarpath = os.path.join(pkgpath, "latest.%s" % filevar)
val = pkginfo.filevars[filevar]
if val:
- with open(filevarpath, "w") as f:
+ with codecs.open(filevarpath, "w", encoding='utf8') as f:
f.write(val)
else:
if os.path.exists(filevarpath):