summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb/ui/knotty.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-11-18 22:47:36 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:43 +0000
commit7c9444e9a58438058ec577bd8c2e51820c98072d (patch)
tree55074d2c00afa924707bb5b5d30b22bc6688594d /bitbake/lib/bb/ui/knotty.py
parent95d2f56126d459b9e7f000d22ed7c1206d1a8f68 (diff)
downloadopenembedded-core-7c9444e9a58438058ec577bd8c2e51820c98072d.tar.gz
openembedded-core-7c9444e9a58438058ec577bd8c2e51820c98072d.tar.bz2
openembedded-core-7c9444e9a58438058ec577bd8c2e51820c98072d.tar.xz
openembedded-core-7c9444e9a58438058ec577bd8c2e51820c98072d.zip
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/knotty.py')
-rw-r--r--bitbake/lib/bb/ui/knotty.py34
1 files changed, 19 insertions, 15 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index a34991bb6..326f16435 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -78,6 +78,7 @@ def init(server, eventHandler):
return 1
pbar = None
+ interactive = os.isatty(sys.stdout.fileno())
shutdown = 0
return_value = 0
while True:
@@ -132,23 +133,26 @@ def init(server, eventHandler):
if isinstance(event, bb.build.TaskBase):
logger.info(event._message)
continue
+ if isinstance(event, bb.event.ParseStarted):
+ if interactive:
+ pbar = progressbar.ProgressBar(widgets=widgets,
+ maxval=event.total).start()
+ else:
+ sys.stdout.write("Parsing recipes...")
+ sys.stdout.flush()
+ continue
if isinstance(event, bb.event.ParseProgress):
- current, total = event.sofar, event.total
- if os.isatty(sys.stdout.fileno()):
- if not pbar:
- pbar = progressbar.ProgressBar(widgets=widgets,
- maxval=total).start()
- pbar.update(current)
+ if interactive:
+ pbar.update(event.current)
+ continue
+ if isinstance(event, bb.event.ParseCompleted):
+ if interactive:
+ pbar.update(event.total)
else:
- if current == 1:
- sys.stdout.write("Parsing .bb files, please wait...")
- sys.stdout.flush()
- if current == total:
- sys.stdout.write("done.")
- sys.stdout.flush()
- if current == total:
- print(("\nParsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors."
- % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors)))
+ sys.stdout.write("done.\n")
+ sys.stdout.flush()
+ print(("\nParsing of %d .bb files complete (%d cached, %d parsed). %d targets, %d skipped, %d masked, %d errors."
+ % ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors)))
continue
if isinstance(event, bb.command.CookerCommandCompleted):