update: fix regression caused by previous temp dir fix

In c26604146a 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>
This commit is contained in:
Paul Eggleton 2018-09-27 15:35:19 +12:00
parent c26604146a
commit 2554449baa

View File

@ -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)