diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-29 14:56:14 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-12-31 17:05:17 +0000 |
commit | c4ecfc4dc5511a23e12ed68eb140a67fd4181127 (patch) | |
tree | 46586a8cfdac78f493d58a835b1d6009b8d13c4d /bitbake/lib/bb/cooker.py | |
parent | ff2d778f6d33a4e48406f7bbc7fdbc4e95113069 (diff) | |
download | poky-c4ecfc4dc5511a23e12ed68eb140a67fd4181127.tar.gz |
bitbake: server/process: Improve idle loop exit code
When idle handlers want to exit, returning "False" isn't very clear
and also causes challenges with the ordering of the removing the idle
handler and marking that no async command is running.
Use a specific class to signal the exit condition allowing clearer code
and allowing the async command to be cleared after the handler has been
removed, reducing any opportunity for races.
(Bitbake rev: 102e8d0d4c5c0dd8c7ba09ad26589deec77e4308)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index adc232e288..ded9369787 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -1489,23 +1489,21 @@ class BBCooker: | |||
1489 | failures += len(exc.args) | 1489 | failures += len(exc.args) |
1490 | retval = False | 1490 | retval = False |
1491 | except SystemExit as exc: | 1491 | except SystemExit as exc: |
1492 | self.command.finishAsyncCommand(str(exc)) | ||
1493 | if quietlog: | 1492 | if quietlog: |
1494 | bb.runqueue.logger.setLevel(rqloglevel) | 1493 | bb.runqueue.logger.setLevel(rqloglevel) |
1495 | return False | 1494 | return bb.server.process.idleFinish(str(exc)) |
1496 | 1495 | ||
1497 | if not retval: | 1496 | if not retval: |
1498 | if fireevents: | 1497 | if fireevents: |
1499 | bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, item, failures, interrupted), self.databuilder.mcdata[mc]) | 1498 | bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, item, failures, interrupted), self.databuilder.mcdata[mc]) |
1500 | bb.event.disable_heartbeat() | 1499 | bb.event.disable_heartbeat() |
1501 | self.command.finishAsyncCommand(msg) | ||
1502 | # We trashed self.recipecaches above | 1500 | # We trashed self.recipecaches above |
1503 | self.parsecache_valid = False | 1501 | self.parsecache_valid = False |
1504 | self.configuration.limited_deps = False | 1502 | self.configuration.limited_deps = False |
1505 | bb.parse.siggen.reset(self.data) | 1503 | bb.parse.siggen.reset(self.data) |
1506 | if quietlog: | 1504 | if quietlog: |
1507 | bb.runqueue.logger.setLevel(rqloglevel) | 1505 | bb.runqueue.logger.setLevel(rqloglevel) |
1508 | return False | 1506 | return bb.server.process.idleFinish(msg) |
1509 | if retval is True: | 1507 | if retval is True: |
1510 | return True | 1508 | return True |
1511 | return retval | 1509 | return retval |
@@ -1535,8 +1533,7 @@ class BBCooker: | |||
1535 | failures += len(exc.args) | 1533 | failures += len(exc.args) |
1536 | retval = False | 1534 | retval = False |
1537 | except SystemExit as exc: | 1535 | except SystemExit as exc: |
1538 | self.command.finishAsyncCommand(str(exc)) | 1536 | return bb.server.process.idleFinish(str(exc)) |
1539 | return False | ||
1540 | 1537 | ||
1541 | if not retval: | 1538 | if not retval: |
1542 | try: | 1539 | try: |
@@ -1544,8 +1541,8 @@ class BBCooker: | |||
1544 | bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, targets, failures, interrupted), self.databuilder.mcdata[mc]) | 1541 | bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, targets, failures, interrupted), self.databuilder.mcdata[mc]) |
1545 | finally: | 1542 | finally: |
1546 | bb.event.disable_heartbeat() | 1543 | bb.event.disable_heartbeat() |
1547 | self.command.finishAsyncCommand(msg) | 1544 | return bb.server.process.idleFinish(msg) |
1548 | return False | 1545 | |
1549 | if retval is True: | 1546 | if retval is True: |
1550 | return True | 1547 | return True |
1551 | return retval | 1548 | return retval |