summaryrefslogtreecommitdiff
path: root/meta/classes/buildhistory.bbclass
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-08-02 10:23:02 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-06 15:27:22 +0100
commit223b183197b363edef0c11a25bad33555fca5a15 (patch)
tree8c3c736f88009b490cff68515cb58411b01f8a3d /meta/classes/buildhistory.bbclass
parentccedfd250620fc562988ba730ad5717b107a9d3e (diff)
downloadopenembedded-core-223b183197b363edef0c11a25bad33555fca5a15.tar.gz
openembedded-core-223b183197b363edef0c11a25bad33555fca5a15.tar.bz2
openembedded-core-223b183197b363edef0c11a25bad33555fca5a15.zip
classes/buildhistory: ensure old package info is removed
If a package is removed from PACKAGES, ensure that the package info file and directory are removed from buildhistory so that we don't have stale data lying around. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/buildhistory.bbclass')
-rw-r--r--meta/classes/buildhistory.bbclass18
1 files changed, 14 insertions, 4 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index f5494cd551..c3555dacbc 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -149,6 +149,19 @@ python buildhistory_emit_pkghistory() {
pr = d.getVar('PR', True)
packages = squashspaces(d.getVar('PACKAGES', True))
+ packagelist = packages.split()
+ if not os.path.exists(pkghistdir):
+ os.makedirs(pkghistdir)
+ else:
+ # Remove files for packages that no longer exist
+ for item in os.listdir(pkghistdir):
+ if item != "latest":
+ if item not in packagelist:
+ subdir = os.path.join(pkghistdir, item)
+ for subfile in os.listdir(subdir):
+ os.unlink(os.path.join(subdir, subfile))
+ os.rmdir(subdir)
+
rcpinfo = RecipeInfo(pn)
rcpinfo.pe = pe
rcpinfo.pv = pv
@@ -159,7 +172,7 @@ python buildhistory_emit_pkghistory() {
# Apparently the version can be different on a per-package basis (see Python)
pkgdest = d.getVar('PKGDEST', True)
- for pkg in packages.split():
+ for pkg in packagelist:
pe = getpkgvar(pkg, 'PE') or "0"
pv = getpkgvar(pkg, 'PV')
pr = getpkgvar(pkg, 'PR')
@@ -206,9 +219,6 @@ def write_recipehistory(rcpinfo, d):
pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
- if not os.path.exists(pkghistdir):
- os.makedirs(pkghistdir)
-
infofile = os.path.join(pkghistdir, "latest")
f = open(infofile, "w")
try: