| Message ID | 20260813124834.1770307-5-richard.purdie@linuxfoundation.org |
|---|---|
| State | New |
| Headers | show |
| Series | [1/6] fetch/__init__: Clean up minor mirror code duplication | expand |
diff --git a/lib/bb/utils.py b/lib/bb/utils.py index 92b60b39d2c..b635f68a153 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -587,6 +587,13 @@ def lockfile(name, shared=False, retry=True, block=False): if not retry: return None +def lockfile_to_exclusive(lf): + if not lf: + return + fileno = lf.fileno() + fcntl.flock(fileno, fcntl.LOCK_EX) + return + def unlockfile(lf): """ Unlock a file locked using ``bb.utils.lockfile()``.
Add a function which turns a shared lock into an exclusive lock. This is useful for planned changes to the fetcher code. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- lib/bb/utils.py | 7 +++++++ 1 file changed, 7 insertions(+)