1
0
mirror of https://git.yoctoproject.org/poky synced 2026-07-17 04:07:06 +00:00

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>
This commit is contained in:
Paul Eggleton
2012-08-02 10:23:04 +01:00
committed by Richard Purdie
parent 78d8faf4e1
commit c0149ac6c4
2 changed files with 65 additions and 9 deletions
+16 -8
View File
@@ -57,6 +57,8 @@ python buildhistory_emit_pkghistory() {
self.rrecommends = ""
self.files = ""
self.filelist = ""
# Variables that need to be written to their own separate file
self.filevars = dict.fromkeys(['pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm'])
# Should check PACKAGES here to see if anything removed
@@ -167,6 +169,8 @@ python buildhistory_emit_pkghistory() {
pkginfo.rdepends = sortpkglist(squashspaces(getpkgvar(pkg, 'RDEPENDS') or ""))
pkginfo.rrecommends = sortpkglist(squashspaces(getpkgvar(pkg, 'RRECOMMENDS') or ""))
pkginfo.files = squashspaces(getpkgvar(pkg, 'FILES') or "")
for filevar in pkginfo.filevars:
pkginfo.filevars[filevar] = getpkgvar(pkg, filevar)
# Gather information about packaged files
pkgdestpkg = os.path.join(pkgdest, pkg)
@@ -191,16 +195,13 @@ def write_recipehistory(rcpinfo, d):
pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
infofile = os.path.join(pkghistdir, "latest")
f = open(infofile, "w")
try:
with open(infofile, "w") 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)
finally:
f.close()
def write_pkghistory(pkginfo, d):
@@ -213,8 +214,7 @@ def write_pkghistory(pkginfo, d):
os.makedirs(pkgpath)
infofile = os.path.join(pkgpath, "latest")
f = open(infofile, "w")
try:
with open(infofile, "w") as f:
if pkginfo.pe != "0":
f.write("PE = %s\n" % pkginfo.pe)
f.write("PV = %s\n" % pkginfo.pv)
@@ -224,8 +224,16 @@ def write_pkghistory(pkginfo, d):
f.write("PKGSIZE = %d\n" % pkginfo.size)
f.write("FILES = %s\n" % pkginfo.files)
f.write("FILELIST = %s\n" % pkginfo.filelist)
finally:
f.close()
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:
f.write(val)
else:
if os.path.exists(filevarpath):
os.unlink(filevarpath)
buildhistory_get_image_installed() {