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:35 +0100
commit87377eacc0a9b17be3ba69efe11f54bbd93fdc79 (patch)
tree72870a7076cecaf08c2ea4bdb5a5a90efada6b5d /bitbake
parentbc294f9573ef3f5a30732e23c28aab0361a4acdb (diff)
downloadpoky-87377eacc0a9b17be3ba69efe11f54bbd93fdc79.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: 048d682b031644fb9f0d41a489bacb873aa27bd7) 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 fab16ffc58..6592eb00dd 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -421,12 +421,14 @@ def better_eval(source, locals, extraglobals = None):
421 return eval(source, ctx, locals) 421 return eval(source, ctx, locals)
422 422
423@contextmanager 423@contextmanager
424def fileslocked(files): 424def fileslocked(files, *args, **kwargs):
425 """Context manager for locking and unlocking file locks.""" 425 """Context manager for locking and unlocking file locks."""
426 locks = [] 426 locks = []
427 if files: 427 if files:
428 for lockfile in files: 428 for lockfile in files:
429 locks.append(bb.utils.lockfile(lockfile)) 429 l = bb.utils.lockfile(lockfile, *args, **kwargs)
430 if l is not None:
431 locks.append(l)
430 432
431 try: 433 try:
432 yield 434 yield