diff options
| author | Chris Larson <chris_larson@mentor.com> | 2010-11-18 22:47:36 -0700 |
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-04 14:46:43 +0000 |
| commit | 7c9444e9a58438058ec577bd8c2e51820c98072d (patch) | |
| tree | 55074d2c00afa924707bb5b5d30b22bc6688594d /bitbake/lib/bb/ui | |
| parent | 95d2f56126d459b9e7f000d22ed7c1206d1a8f68 (diff) | |
| download | poky-7c9444e9a58438058ec577bd8c2e51820c98072d.tar.gz | |
cache: sync the cache file to disk in the background
This version uses a thread rather than a process, to avoid problems with
waitpid handling. This gives slightly less overall build time reduction than
the separate process for it did (this reduces a -c compile coreutils-native by
about 3 seconds, while the process reduced it by 7 seconds), however this time
is quite insignificant relative to a typical build.
The biggest issue with non-backgrounded syncing is the perceived delay before
work begins, and this resolves that without breaking anything, or so it seems.
(Bitbake rev: 5ab6c5c7b007b8c77c751582141afc07c183d672)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/ui')
| -rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 34 | ||||
| -rw-r--r-- | bitbake/lib/bb/ui/uievent.py | 18 |
2 files changed, 28 insertions, 24 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index a34991bb68..326f164353 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
| @@ -78,6 +78,7 @@ def init(server, eventHandler): | |||
| 78 | return 1 | 78 | return 1 |
| 79 | 79 | ||
| 80 | pbar = None | 80 | pbar = None |
| 81 | interactive = os.isatty(sys.stdout.fileno()) | ||
| 81 | shutdown = 0 | 82 | shutdown = 0 |
| 82 | return_value = 0 | 83 | return_value = 0 |
| 83 | while True: | 84 | while True: |
| @@ -132,23 +133,26 @@ def init(server, eventHandler): | |||
| 132 | if isinstance(event, bb.build.TaskBase): | 133 | if isinstance(event, bb.build.TaskBase): |
| 133 | logger.info(event._message) | 134 | logger.info(event._message) |
| 134 | continue | 135 | continue |
| 136 | if isinstance(event, bb.event.ParseStarted): | ||
| 137 | if interactive: | ||
| 138 | pbar = progressbar.ProgressBar(widgets=widgets, | ||
| 139 | maxval=event.total).start() | ||
| 140 | else: | ||
| 141 | sys.stdout.write("Parsing recipes...") | ||
| 142 | sys.stdout.flush() | ||
| 143 | continue | ||
| 135 | if isinstance(event, bb.event.ParseProgress): | 144 | if isinstance(event, bb.event.ParseProgress): |
| 136 | current, total = event.sofar, event.total | 145 | if interactive: |
| 137 | if os.isatty(sys.stdout.fileno()): | 146 | pbar.update(event.current) |
| 138 | if not pbar: | 147 | continue |
| 139 | pbar = progressbar.ProgressBar(widgets=widgets, | 148 | if isinstance(event, bb.event.ParseCompleted): |
| 140 | maxval=total).start() | 149 | if interactive: |
| 141 | pbar.update(current) | 150 | pbar.update(event.total) |
| 142 | else: | 151 | else: |
| 143 | if current == 1: | 152 | sys.stdout.write("done.\n") |
| 144 | sys.stdout.write("Parsing .bb files, please wait...") | 153 | sys.stdout.flush() |
| 145 | sys.stdout.flush() | 154 | print(("\nParsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors." |
| 146 | if current == total: | 155 | % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors))) |
| 147 | sys.stdout.write("done.") | ||
| 148 | sys.stdout.flush() | ||
| 149 | if current == total: | ||
| 150 | print(("\nParsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors." | ||
| 151 | % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors))) | ||
| 152 | continue | 156 | continue |
| 153 | 157 | ||
| 154 | if isinstance(event, bb.command.CookerCommandCompleted): | 158 | if isinstance(event, bb.command.CookerCommandCompleted): |
diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py index f1e4d791ee..b404805d81 100644 --- a/bitbake/lib/bb/ui/uievent.py +++ b/bitbake/lib/bb/ui/uievent.py | |||
| @@ -37,8 +37,8 @@ class BBUIEventQueue: | |||
| 37 | self.BBServer = BBServer | 37 | self.BBServer = BBServer |
| 38 | 38 | ||
| 39 | self.t = threading.Thread() | 39 | self.t = threading.Thread() |
| 40 | self.t.setDaemon(True) | 40 | self.t.setDaemon(True) |
| 41 | self.t.run = self.startCallbackHandler | 41 | self.t.run = self.startCallbackHandler |
| 42 | self.t.start() | 42 | self.t.start() |
| 43 | 43 | ||
| 44 | def getEvent(self): | 44 | def getEvent(self): |
| @@ -70,7 +70,7 @@ class BBUIEventQueue: | |||
| 70 | def startCallbackHandler(self): | 70 | def startCallbackHandler(self): |
| 71 | 71 | ||
| 72 | server = UIXMLRPCServer() | 72 | server = UIXMLRPCServer() |
| 73 | self.host, self.port = server.socket.getsockname() | 73 | self.host, self.port = server.socket.getsockname() |
| 74 | 74 | ||
| 75 | server.register_function( self.system_quit, "event.quit" ) | 75 | server.register_function( self.system_quit, "event.quit" ) |
| 76 | server.register_function( self.queue_event, "event.send" ) | 76 | server.register_function( self.queue_event, "event.send" ) |
| @@ -83,7 +83,7 @@ class BBUIEventQueue: | |||
| 83 | server.handle_request() | 83 | server.handle_request() |
| 84 | server.server_close() | 84 | server.server_close() |
| 85 | 85 | ||
| 86 | def system_quit( self ): | 86 | def system_quit( self ): |
| 87 | """ | 87 | """ |
| 88 | Shut down the callback thread | 88 | Shut down the callback thread |
| 89 | """ | 89 | """ |
| @@ -95,11 +95,11 @@ class BBUIEventQueue: | |||
| 95 | 95 | ||
| 96 | class UIXMLRPCServer (SimpleXMLRPCServer): | 96 | class UIXMLRPCServer (SimpleXMLRPCServer): |
| 97 | 97 | ||
| 98 | def __init__( self, interface = ("localhost", 0) ): | 98 | def __init__( self, interface = ("localhost", 0) ): |
| 99 | self.quit = False | 99 | self.quit = False |
| 100 | SimpleXMLRPCServer.__init__( self, | 100 | SimpleXMLRPCServer.__init__( self, |
| 101 | interface, | 101 | interface, |
| 102 | requestHandler=SimpleXMLRPCRequestHandler, | 102 | requestHandler=SimpleXMLRPCRequestHandler, |
| 103 | logRequests=False, allow_none=True) | 103 | logRequests=False, allow_none=True) |
| 104 | 104 | ||
| 105 | def get_request(self): | 105 | def get_request(self): |
| @@ -121,4 +121,4 @@ class UIXMLRPCServer (SimpleXMLRPCServer): | |||
| 121 | if request is None: | 121 | if request is None: |
| 122 | return | 122 | return |
| 123 | SimpleXMLRPCServer.process_request(self, request, client_address) | 123 | SimpleXMLRPCServer.process_request(self, request, client_address) |
| 124 | 124 | ||
