summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-10-01 14:07:18 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-10-01 14:07:18 +0100
commitca5fff38066207f19d3c62b9140586c1209d311c (patch)
treea02a4edf0318cab807f01fe63b6d127609b0a360
parentc0c657bd92911788b96d9670620eabf024453752 (diff)
downloadopenembedded-core-ca5fff38066207f19d3c62b9140586c1209d311c.tar.gz
openembedded-core-ca5fff38066207f19d3c62b9140586c1209d311c.tar.bz2
openembedded-core-ca5fff38066207f19d3c62b9140586c1209d311c.tar.xz
openembedded-core-ca5fff38066207f19d3c62b9140586c1209d311c.zip
sstate: Deal with a potential race when cleaning packages
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rw-r--r--meta/classes/sstate.bbclass19
1 files changed, 12 insertions, 7 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index bcac3638e..855f5a45a 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -169,13 +169,18 @@ def sstate_clean_manifest(manifest, d):
for entry in entries:
entry = entry.strip()
bb.debug(2, "Removing manifest: %s" % entry)
- if entry.endswith("/"):
- if os.path.islink(entry[:-1]):
- os.remove(entry[:-1])
- elif os.path.exists(entry) and len(os.listdir(entry)) == 0:
- os.rmdir(entry[:-1])
- else:
- oe.path.remove(entry)
+ # We can race against another package populating directories as we're removing them
+ # so we ignore errors here.
+ try:
+ if entry.endswith("/"):
+ if os.path.islink(entry[:-1]):
+ os.remove(entry[:-1])
+ elif os.path.exists(entry) and len(os.listdir(entry)) == 0:
+ os.rmdir(entry[:-1])
+ else:
+ oe.path.remove(entry)
+ except OSError:
+ pass
oe.path.remove(manifest)