From a6fe1dab21b6487c42f9fae43715337851d2b39b Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Tue, 30 Aug 2022 10:59:09 -0500 Subject: bitbake: utils: Pass lock argument in fileslocked Pass additional arguments in the fileslocked() context manager to the underlying lockfile() function. This allows the context manager to be used for any types of locks (non-blocking, shared, etc.) that the lockfile() function supports. (Bitbake rev: ce9fe70156e8f909a3a81da017b89ea61bc6fe38) Signed-off-by: Joshua Watt Signed-off-by: Richard Purdie --- bitbake/lib/bb/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'bitbake/lib/bb/utils.py') diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index d11da978d7..298017657a 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -429,12 +429,14 @@ def better_eval(source, locals, extraglobals = None): return eval(source, ctx, locals) @contextmanager -def fileslocked(files): +def fileslocked(files, *args, **kwargs): """Context manager for locking and unlocking file locks.""" locks = [] if files: for lockfile in files: - locks.append(bb.utils.lockfile(lockfile)) + l = bb.utils.lockfile(lockfile, *args, **kwargs) + if l is not None: + locks.append(l) try: yield -- cgit v1.2.3-54-g00ecf