* [layerindex-web][PATCH] update: fix regression caused by previous temp dir fix
@ 2018-09-27 3:38 Paul Eggleton
0 siblings, 0 replies; only message in thread
From: Paul Eggleton @ 2018-09-27 3:38 UTC (permalink / raw)
To: yocto
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.eggleton@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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-09-27 3:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-27 3:38 [layerindex-web][PATCH] update: fix regression caused by previous temp dir fix Paul Eggleton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.