diff options
| author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-08-02 10:23:02 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-06 15:29:45 +0100 |
| commit | d0b07eb77891037fe229f3ed488e3d0c8f0fd219 (patch) | |
| tree | e9e25ba7156615b09709e8a0395725c102f0dae9 | |
| parent | 2f6ceff312ac0348771679a134e8a2687702fa02 (diff) | |
| download | poky-d0b07eb77891037fe229f3ed488e3d0c8f0fd219.tar.gz | |
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.
(From OE-Core rev: 223b183197b363edef0c11a25bad33555fca5a15)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/classes/buildhistory.bbclass | 18 |
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() { | |||
| 149 | pr = d.getVar('PR', True) | 149 | pr = d.getVar('PR', True) |
| 150 | packages = squashspaces(d.getVar('PACKAGES', True)) | 150 | packages = squashspaces(d.getVar('PACKAGES', True)) |
| 151 | 151 | ||
| 152 | packagelist = packages.split() | ||
| 153 | if not os.path.exists(pkghistdir): | ||
| 154 | os.makedirs(pkghistdir) | ||
| 155 | else: | ||
| 156 | # Remove files for packages that no longer exist | ||
| 157 | for item in os.listdir(pkghistdir): | ||
| 158 | if item != "latest": | ||
| 159 | if item not in packagelist: | ||
| 160 | subdir = os.path.join(pkghistdir, item) | ||
| 161 | for subfile in os.listdir(subdir): | ||
| 162 | os.unlink(os.path.join(subdir, subfile)) | ||
| 163 | os.rmdir(subdir) | ||
| 164 | |||
| 152 | rcpinfo = RecipeInfo(pn) | 165 | rcpinfo = RecipeInfo(pn) |
| 153 | rcpinfo.pe = pe | 166 | rcpinfo.pe = pe |
| 154 | rcpinfo.pv = pv | 167 | rcpinfo.pv = pv |
| @@ -159,7 +172,7 @@ python buildhistory_emit_pkghistory() { | |||
| 159 | 172 | ||
| 160 | # Apparently the version can be different on a per-package basis (see Python) | 173 | # Apparently the version can be different on a per-package basis (see Python) |
| 161 | pkgdest = d.getVar('PKGDEST', True) | 174 | pkgdest = d.getVar('PKGDEST', True) |
| 162 | for pkg in packages.split(): | 175 | for pkg in packagelist: |
| 163 | pe = getpkgvar(pkg, 'PE') or "0" | 176 | pe = getpkgvar(pkg, 'PE') or "0" |
| 164 | pv = getpkgvar(pkg, 'PV') | 177 | pv = getpkgvar(pkg, 'PV') |
| 165 | pr = getpkgvar(pkg, 'PR') | 178 | pr = getpkgvar(pkg, 'PR') |
| @@ -206,9 +219,6 @@ def write_recipehistory(rcpinfo, d): | |||
| 206 | 219 | ||
| 207 | pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) | 220 | pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) |
| 208 | 221 | ||
| 209 | if not os.path.exists(pkghistdir): | ||
| 210 | os.makedirs(pkghistdir) | ||
| 211 | |||
| 212 | infofile = os.path.join(pkghistdir, "latest") | 222 | infofile = os.path.join(pkghistdir, "latest") |
| 213 | f = open(infofile, "w") | 223 | f = open(infofile, "w") |
| 214 | try: | 224 | try: |
