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.bbclass24
1 files changed, 16 insertions, 8 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 510a6df85a..200d03192e 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -57,6 +57,8 @@ python buildhistory_emit_pkghistory() {
57 self.rrecommends = "" 57 self.rrecommends = ""
58 self.files = "" 58 self.files = ""
59 self.filelist = "" 59 self.filelist = ""
60 # Variables that need to be written to their own separate file
61 self.filevars = dict.fromkeys(['pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm'])
60 62
61 # Should check PACKAGES here to see if anything removed 63 # Should check PACKAGES here to see if anything removed
62 64
@@ -167,6 +169,8 @@ python buildhistory_emit_pkghistory() {
167 pkginfo.rdepends = sortpkglist(squashspaces(getpkgvar(pkg, 'RDEPENDS') or "")) 169 pkginfo.rdepends = sortpkglist(squashspaces(getpkgvar(pkg, 'RDEPENDS') or ""))
168 pkginfo.rrecommends = sortpkglist(squashspaces(getpkgvar(pkg, 'RRECOMMENDS') or "")) 170 pkginfo.rrecommends = sortpkglist(squashspaces(getpkgvar(pkg, 'RRECOMMENDS') or ""))
169 pkginfo.files = squashspaces(getpkgvar(pkg, 'FILES') or "") 171 pkginfo.files = squashspaces(getpkgvar(pkg, 'FILES') or "")
172 for filevar in pkginfo.filevars:
173 pkginfo.filevars[filevar] = getpkgvar(pkg, filevar)
170 174
171 # Gather information about packaged files 175 # Gather information about packaged files
172 pkgdestpkg = os.path.join(pkgdest, pkg) 176 pkgdestpkg = os.path.join(pkgdest, pkg)
@@ -191,16 +195,13 @@ def write_recipehistory(rcpinfo, d):
191 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) 195 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
192 196
193 infofile = os.path.join(pkghistdir, "latest") 197 infofile = os.path.join(pkghistdir, "latest")
194 f = open(infofile, "w") 198 with open(infofile, "w") as f:
195 try:
196 if rcpinfo.pe != "0": 199 if rcpinfo.pe != "0":
197 f.write("PE = %s\n" % rcpinfo.pe) 200 f.write("PE = %s\n" % rcpinfo.pe)
198 f.write("PV = %s\n" % rcpinfo.pv) 201 f.write("PV = %s\n" % rcpinfo.pv)
199 f.write("PR = %s\n" % rcpinfo.pr) 202 f.write("PR = %s\n" % rcpinfo.pr)
200 f.write("DEPENDS = %s\n" % rcpinfo.depends) 203 f.write("DEPENDS = %s\n" % rcpinfo.depends)
201 f.write("PACKAGES = %s\n" % rcpinfo.packages) 204 f.write("PACKAGES = %s\n" % rcpinfo.packages)
202 finally:
203 f.close()
204 205
205 206
206def write_pkghistory(pkginfo, d): 207def write_pkghistory(pkginfo, d):
@@ -213,8 +214,7 @@ def write_pkghistory(pkginfo, d):
213 os.makedirs(pkgpath) 214 os.makedirs(pkgpath)
214 215
215 infofile = os.path.join(pkgpath, "latest") 216 infofile = os.path.join(pkgpath, "latest")
216 f = open(infofile, "w") 217 with open(infofile, "w") as f:
217 try:
218 if pkginfo.pe != "0": 218 if pkginfo.pe != "0":
219 f.write("PE = %s\n" % pkginfo.pe) 219 f.write("PE = %s\n" % pkginfo.pe)
220 f.write("PV = %s\n" % pkginfo.pv) 220 f.write("PV = %s\n" % pkginfo.pv)
@@ -224,8 +224,16 @@ def write_pkghistory(pkginfo, d):
224 f.write("PKGSIZE = %d\n" % pkginfo.size) 224 f.write("PKGSIZE = %d\n" % pkginfo.size)
225 f.write("FILES = %s\n" % pkginfo.files) 225 f.write("FILES = %s\n" % pkginfo.files)
226 f.write("FILELIST = %s\n" % pkginfo.filelist) 226 f.write("FILELIST = %s\n" % pkginfo.filelist)
227 finally: 227
228 f.close() 228 for filevar in pkginfo.filevars:
229 filevarpath = os.path.join(pkgpath, "latest.%s" % filevar)
230 val = pkginfo.filevars[filevar]
231 if val:
232 with open(filevarpath, "w") as f:
233 f.write(val)
234 else:
235 if os.path.exists(filevarpath):
236 os.unlink(filevarpath)
229 237
230 238
231buildhistory_get_image_installed() { 239buildhistory_get_image_installed() {