update: fix regression caused by previous temp dir fix
PATCH 1/1 update: fix regression caused by previous temp dir fix
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 <[email protected]>
--- layerindex/update_layer.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
layerindex/update_layer.py +10 -1
@@ -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)
Signature · 1 line
2.17.1