In c26604146a74149487a1a2dfc40d40d53aa68bdf I made a fix to change where
the bitbake code writes out bitbake.lock and other files it creates
during parsing, but didn't adequately test it and it turns out our
call to delete the temp directory races against bitbake deleting
bitbake.lock and bitbake.sock. For now the simplest way to deal with
this is to ignore the errors since we don't care about these files,
we just want the temp dir gone.

Signed-off-by: Paul Eggleton <paul.eggle...@linux.intel.com>
---
 layerindex/update_layer.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/layerindex/update_layer.py b/layerindex/update_layer.py
index eb04fc44..97b84372 100644
--- a/layerindex/update_layer.py
+++ b/layerindex/update_layer.py
@@ -16,6 +16,7 @@ from datetime import datetime
 import re
 import tempfile
 import shutil
+import errno
 from distutils.version import LooseVersion
 import itertools
 import utils
@@ -39,6 +40,14 @@ class DryRunRollbackException(Exception):
     pass
 
 
+def rm_tempdir_onerror(fn, fullname, exc_info):
+    # Avoid errors when we're racing against bitbake deleting 
bitbake.lock/bitbake.sock
+    # (and anything else it happens to create in our temporary build directory 
in future)
+    if isinstance(exc_info[1], OSError) and exc_info[1].errno == errno.ENOENT:
+        pass
+    else:
+        raise
+
 def check_machine_conf(path, subdir_start):
     subpath = path[len(subdir_start):]
     res = conf_re.match(subpath)
@@ -828,7 +837,7 @@ def main():
             logger.debug('Preserving temp directory %s' % tempdir)
         else:
             logger.debug('Deleting temp directory')
-            shutil.rmtree(tempdir)
+            shutil.rmtree(tempdir, onerror=rm_tempdir_onerror)
     sys.exit(0)
 
 
-- 
2.17.1

-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to