aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/utils.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-01-19 13:30:14 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-21 13:24:22 +0000
commitf08da7b43513639915723953e957f69434e0cebc (patch)
treed37786a6a181aadf1a642fe7c56e86f434c5b19a /lib/bb/utils.py
parentebea0799d899f321d03eb8dd6217a715a3f03731 (diff)
downloadbitbake-f08da7b43513639915723953e957f69434e0cebc.tar.gz
bitbake/utils.py: Teach unlockfile about shared mode lockfiles
(From Poky rev: fd88588df029604689db9b0e30c55aad68392a5d) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/utils.py')
-rw-r--r--lib/bb/utils.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index d803c732a..343b2586a 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -445,7 +445,13 @@ def unlockfile(lf):
"""
Unlock a file locked using lockfile()
"""
- os.unlink(lf.name)
+ try:
+ # If we had a shared lock, we need to promote to exclusive before
+ # removing the lockfile. Attempt this, ignore failures.
+ fcntl.flock(lf.fileno(), fcntl.LOCK_EX|fcntl.LOCK_NB)
+ os.unlink(lf.name)
+ except IOError:
+ pass
fcntl.flock(lf.fileno(), fcntl.LOCK_UN)
lf.close()