summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-08-02 10:23:04 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-06 15:29:45 +0100
commitc0149ac6c4859a05a7a1f7310a9bd981caea8f2d (patch)
tree113778634ce63a91ea9d11b656171e0997f3ea35 /meta/classes
parent78d8faf4e16400f9f89c39917f14c03a49a09dcc (diff)
downloadpoky-c0149ac6c4859a05a7a1f7310a9bd981caea8f2d.tar.gz
classes/buildhistory: save preinst/postinst/prerm/postrm
Write the value of these package script variables into the packageinfo so that any changes to them can be tracked (in separate files since they are multi-line). Inspired by an earlier patch from Andreas Müller <schnitzeltony@googlemail.com> (From OE-Core rev: 988a417c857c01c87de6ba9602968059cf8d830f) 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.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() {