diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2010-10-01 14:07:18 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-10-01 14:07:18 +0100 |
commit | ca5fff38066207f19d3c62b9140586c1209d311c (patch) | |
tree | a02a4edf0318cab807f01fe63b6d127609b0a360 /meta/classes | |
parent | c0c657bd92911788b96d9670620eabf024453752 (diff) | |
download | poky-ca5fff38066207f19d3c62b9140586c1209d311c.tar.gz |
sstate: Deal with a potential race when cleaning packages
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/sstate.bbclass | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index bcac3638e1..855f5a45a7 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass | |||
@@ -169,13 +169,18 @@ def sstate_clean_manifest(manifest, d): | |||
169 | for entry in entries: | 169 | for entry in entries: |
170 | entry = entry.strip() | 170 | entry = entry.strip() |
171 | bb.debug(2, "Removing manifest: %s" % entry) | 171 | bb.debug(2, "Removing manifest: %s" % entry) |
172 | if entry.endswith("/"): | 172 | # We can race against another package populating directories as we're removing them |
173 | if os.path.islink(entry[:-1]): | 173 | # so we ignore errors here. |
174 | os.remove(entry[:-1]) | 174 | try: |
175 | elif os.path.exists(entry) and len(os.listdir(entry)) == 0: | 175 | if entry.endswith("/"): |
176 | os.rmdir(entry[:-1]) | 176 | if os.path.islink(entry[:-1]): |
177 | else: | 177 | os.remove(entry[:-1]) |
178 | oe.path.remove(entry) | 178 | elif os.path.exists(entry) and len(os.listdir(entry)) == 0: |
179 | os.rmdir(entry[:-1]) | ||
180 | else: | ||
181 | oe.path.remove(entry) | ||
182 | except OSError: | ||
183 | pass | ||
179 | 184 | ||
180 | oe.path.remove(manifest) | 185 | oe.path.remove(manifest) |
181 | 186 | ||