classes/buildhistory: handle additional files at recipe level

Avoid an error when attempting to remove previous data if it's not a
subdirectory - we were assuming that anything that wasn't named "latest"
or "latest_srcrev" had to be a directory. This makes it possible to have
a buildhistory_emit_pkghistory_append which writes additional files at
the recipe level.

(From OE-Core rev: b018a046a578e41b105cf72b9fdeed0220ae3046)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton 2015-08-21 13:55:00 +01:00 committed by Richard Purdie
parent 846cb34afa
commit 2a08f4a0e5
1 changed files with 7 additions and 4 deletions

View File

@ -172,10 +172,13 @@ python buildhistory_emit_pkghistory() {
for item in os.listdir(pkghistdir):
if item != "latest" and item != "latest_srcrev":
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)
itempath = os.path.join(pkghistdir, item)
if os.path.isdir(itempath):
for subfile in os.listdir(itempath):
os.unlink(os.path.join(itempath, subfile))
os.rmdir(itempath)
else:
os.unlink(itempath)
rcpinfo = RecipeInfo(pn)
rcpinfo.pe = pe