]> code.ossystems Code Review - openembedded-core.git/commitdiff
sstate: Deal with a potential race when cleaning packages
authorRichard Purdie <rpurdie@linux.intel.com>
Fri, 1 Oct 2010 13:07:18 +0000 (14:07 +0100)
committerRichard Purdie <rpurdie@linux.intel.com>
Fri, 1 Oct 2010 13:07:18 +0000 (14:07 +0100)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
meta/classes/sstate.bbclass

index bcac3638e1a7fae89ac8498dbcee0937132e9a31..855f5a45a7dfe5e834095d05da012ab7c021d890 100644 (file)
@@ -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)