From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: yocto@yoctoproject.org
Subject: [layerindex-web][PATCH] update: fix regression caused by previous temp dir fix
Date: Thu, 27 Sep 2018 15:38:33 +1200 [thread overview]
Message-ID: <20180927033833.9041-1-paul.eggleton@linux.intel.com> (raw)
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
reply other threads:[~2018-09-27 3:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180927033833.9041-1-paul.eggleton@linux.intel.com \
--to=paul.eggleton@linux.intel.com \
--cc=yocto@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.