diff options
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r-- | bitbake/lib/bb/utils.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index a6f1337114..f49ee5544a 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -407,13 +407,12 @@ def lockfile(name, shared=False): | |||
407 | Use the file fn as a lock file, return when the lock has been acquired. | 407 | Use the file fn as a lock file, return when the lock has been acquired. |
408 | Returns a variable to pass to unlockfile(). | 408 | Returns a variable to pass to unlockfile(). |
409 | """ | 409 | """ |
410 | path = os.path.dirname(name) | 410 | dirname = os.path.dirname(name) |
411 | if not os.path.isdir(path): | 411 | mkdirhier(dirname) |
412 | logger.error("Lockfile destination directory '%s' does not exist", path) | ||
413 | sys.exit(1) | ||
414 | 412 | ||
415 | if not os.access(path, os.W_OK): | 413 | if not os.access(dirname, os.W_OK): |
416 | logger.error("Error, lockfile path is not writable!: %s" % path) | 414 | logger.error("Unable to acquire lock '%s', directory is not writable", |
415 | dirname) | ||
417 | sys.exit(1) | 416 | sys.exit(1) |
418 | 417 | ||
419 | op = fcntl.LOCK_EX | 418 | op = fcntl.LOCK_EX |
@@ -449,7 +448,7 @@ def unlockfile(lf): | |||
449 | Unlock a file locked using lockfile() | 448 | Unlock a file locked using lockfile() |
450 | """ | 449 | """ |
451 | try: | 450 | try: |
452 | # If we had a shared lock, we need to promote to exclusive before | 451 | # If we had a shared lock, we need to promote to exclusive before |
453 | # removing the lockfile. Attempt this, ignore failures. | 452 | # removing the lockfile. Attempt this, ignore failures. |
454 | fcntl.flock(lf.fileno(), fcntl.LOCK_EX|fcntl.LOCK_NB) | 453 | fcntl.flock(lf.fileno(), fcntl.LOCK_EX|fcntl.LOCK_NB) |
455 | os.unlink(lf.name) | 454 | os.unlink(lf.name) |