diff options
author | Joshua Watt <JPEWhacker@gmail.com> | 2022-08-30 10:59:09 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-31 10:40:07 +0100 |
commit | 79cc8584e6e29574ce271eb4a43d0dd9c8879e2c (patch) | |
tree | c808f6fce4cbc6935cbbafb7b28c1d6ac6189a1a | |
parent | de284c467a99fa17b98531206b0dc51a4401de64 (diff) | |
download | poky-79cc8584e6e29574ce271eb4a43d0dd9c8879e2c.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: 7a8eb8da8e8495051e174721062da08e06168024)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/utils.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index b8b90df8d3..92d44c5260 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -431,12 +431,14 @@ def better_eval(source, locals, extraglobals = None): | |||
431 | return eval(source, ctx, locals) | 431 | return eval(source, ctx, locals) |
432 | 432 | ||
433 | @contextmanager | 433 | @contextmanager |
434 | def fileslocked(files): | 434 | def fileslocked(files, *args, **kwargs): |
435 | """Context manager for locking and unlocking file locks.""" | 435 | """Context manager for locking and unlocking file locks.""" |
436 | locks = [] | 436 | locks = [] |
437 | if files: | 437 | if files: |
438 | for lockfile in files: | 438 | for lockfile in files: |
439 | locks.append(bb.utils.lockfile(lockfile)) | 439 | l = bb.utils.lockfile(lockfile, *args, **kwargs) |
440 | if l is not None: | ||
441 | locks.append(l) | ||
440 | 442 | ||
441 | try: | 443 | try: |
442 | yield | 444 | yield |