@@ -501,6 +501,27 @@ def sstate_clean_cachefiles(d):
ss = sstate_state_fromvars(ld, task)
sstate_clean_cachefile(ss, ld)
+def sstate_clean_entry(entry, canrace, prefix):
+ entry = entry.strip()
+ if prefix and not entry.startswith("/"):
+ entry = prefix + "/" + entry
+
+ bb.debug(2, "Removing manifest: %s" % 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 and not canrace:
+ # Removing directories whilst builds are in progress exposes a race. Only
+ # do it in contexts where it is safe to do so.
+ os.rmdir(entry[:-1])
+ else:
+ os.remove(entry)
+ except OSError:
+ pass
+
def sstate_clean_manifest(manifest, d, canrace=False, prefix=None):
import oe.path
@@ -509,24 +530,7 @@ def sstate_clean_manifest(manifest, d, canrace=False, prefix=None):
mfile.close()
for entry in entries:
- entry = entry.strip()
- if prefix and not entry.startswith("/"):
- entry = prefix + "/" + entry
- bb.debug(2, "Removing manifest: %s" % 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 and not canrace:
- # Removing directories whilst builds are in progress exposes a race. Only
- # do it in contexts where it is safe to do so.
- os.rmdir(entry[:-1])
- else:
- os.remove(entry)
- except OSError:
- pass
+ sstate_clean_entry(entry, canrace, prefix)
postrm = manifest + ".postrm"
if os.path.exists(manifest + ".postrm"):
Move manifest entry cleanup code from sstate_clean_manifest() to its own function, so it can be reused. Signed-off-by: Ovidiu Panait <ovidiu.panait@eng.windriver.com> --- meta/classes-global/sstate.bbclass | 40 ++++++++++++++++-------------- 1 file changed, 22 insertions(+), 18 deletions(-)