summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorJoshua Watt <JPEWhacker@gmail.com>2022-08-30 10:59:09 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-09-02 11:45:32 +0100
commita6fe1dab21b6487c42f9fae43715337851d2b39b (patch)
treefa93f726aefd8ee63563395375e8d5a11b338196 /bitbake
parent366fde882fcc6d187e77c556357fb7e9a5d8e903 (diff)
downloadpoky-a6fe1dab21b6487c42f9fae43715337851d2b39b.tar.gz
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 <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/utils.py6
1 files changed, 4 insertions, 2 deletions
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):
429 return eval(source, ctx, locals) 429 return eval(source, ctx, locals)
430 430
431@contextmanager 431@contextmanager
432def fileslocked(files): 432def fileslocked(files, *args, **kwargs):
433 """Context manager for locking and unlocking file locks.""" 433 """Context manager for locking and unlocking file locks."""
434 locks = [] 434 locks = []
435 if files: 435 if files:
436 for lockfile in files: 436 for lockfile in files:
437 locks.append(bb.utils.lockfile(lockfile)) 437 l = bb.utils.lockfile(lockfile, *args, **kwargs)
438 if l is not None:
439 locks.append(l)
438 440
439 try: 441 try:
440 yield 442 yield