[oe-commits] [bitbake] 02/04: bb.utils.fileslocked: don't leak files if yield throws
git at git.openembedded.org
git at git.openembedded.org
Fri Dec 13 16:14:15 UTC 2019
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository bitbake.
commit 6beddf6214e22b4002626761031a9e9d34fb04db
Author: Chris Laplante via bitbake-devel <bitbake-devel at lists.openembedded.org>
AuthorDate: Tue Dec 10 14:10:20 2019 -0500
bb.utils.fileslocked: don't leak files if yield throws
Discovered with a recipe under devtool. The ${S}/singletask.lock file (added by
externalsrc.bbclass) was leaked, giving a warning like:
WARNING: <PN>+git999-r0 do_populate_lic: /home/laplante/yocto/sources/poky/bitbake/lib/bb/build.py:582: ResourceWarning: unclosed file <_io.TextIOWrapper name='/home/laplante/yocto/build/workspace/sources/<PN>/singletask.lock' mode='a+' encoding='UTF-8'>
exec_func(task, localdata)
Signed-off-by: Chris Laplante <chris.laplante at agilent.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
lib/bb/utils.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 8d40bcd..d65265c 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -428,10 +428,11 @@ def fileslocked(files):
for lockfile in files:
locks.append(bb.utils.lockfile(lockfile))
- yield
-
- for lock in locks:
- bb.utils.unlockfile(lock)
+ try:
+ yield
+ finally:
+ for lock in locks:
+ bb.utils.unlockfile(lock)
@contextmanager
def timeout(seconds):
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list