diff options
author | Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> | 2015-07-07 09:46:01 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-07-09 18:00:21 +0100 |
commit | 3b5b74b430f0c62bcb4bbbcce02b18f2cb12d336 (patch) | |
tree | 88c0159da628a9541c99da62ef2ee8c9bf66c0ba /bitbake/lib/bb/ui | |
parent | 67eaefee29fa31e8862b4f93f606bd3b7a02d5dc (diff) | |
download | poky-3b5b74b430f0c62bcb4bbbcce02b18f2cb12d336.tar.gz |
bitbake: knotty.py: Make sure bitbake.lock is unlocked before exiting
Before exiting the UI, unlocks the bitbake.lock owned by cooker; this
way consecutive bitbake executions can lock it again without trouble.
[Yocto #7941]
(Bitbake rev: 69ecd15aece54753154950c55d7af42f85ad8606)
Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 2bee242eb0..9788a9287c 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
@@ -310,6 +310,7 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
310 | errors = 0 | 310 | errors = 0 |
311 | warnings = 0 | 311 | warnings = 0 |
312 | taskfailures = [] | 312 | taskfailures = [] |
313 | locktries = 10 | ||
313 | 314 | ||
314 | termfilter = tf(main, helper, console, errconsole, format) | 315 | termfilter = tf(main, helper, console, errconsole, format) |
315 | atexit.register(termfilter.finish) | 316 | atexit.register(termfilter.finish) |
@@ -537,6 +538,25 @@ def main(server, eventHandler, params, tf = TerminalFilter): | |||
537 | _, error = server.runCommand(["stateForceShutdown"]) | 538 | _, error = server.runCommand(["stateForceShutdown"]) |
538 | main.shutdown = 2 | 539 | main.shutdown = 2 |
539 | try: | 540 | try: |
541 | topdir, error = server.runCommand(["getVariable", "TOPDIR"]) | ||
542 | if error: | ||
543 | logger.warn("Unable to get the value of TOPDIR variable: %s" % error) | ||
544 | else: | ||
545 | lockfile = "%s/bitbake.lock" % topdir | ||
546 | _, error = server.runCommand(["unlockBitbake"]) | ||
547 | if error: | ||
548 | logger.warn("Unable to unlock the file %s" % lockfile) | ||
549 | else: | ||
550 | while locktries: | ||
551 | lf = bb.utils.lockfile(lockfile, False, False) | ||
552 | if not lf: | ||
553 | time.sleep(1) | ||
554 | locktries -=1 | ||
555 | else: | ||
556 | bb.utils.unlockfile(lf) | ||
557 | break | ||
558 | if not locktries: | ||
559 | logger.warn("Knotty could not lock the file ${TOPDIR}/bitbake.lock, probably locked by cooker and not unlocked yet. Immediate bitbake commands may failed") | ||
540 | summary = "" | 560 | summary = "" |
541 | if taskfailures: | 561 | if taskfailures: |
542 | summary += pluralise("\nSummary: %s task failed:", | 562 | summary += pluralise("\nSummary: %s task failed:", |