From 26eda933379801ef1c8b4b09e67d14f498cd3813 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Tue, 28 Sep 2010 08:24:55 -0700 Subject: Queue up events before the UI is spawned - Queue up any events fired to the UI before the UI exists - At exit, check if UIs exist, and if not, flush the queue of LogRecords to the console directly. - When establishing a connection from the UI to the server, flush the queue of events to the queue in the server connection, so the UI will receive them when it begins its event loop. (Bitbake rev: 73488aeb317ed306f2ecf99cc9d3708526a5933c) Signed-off-by: Chris Larson Signed-off-by: Richard Purdie --- bitbake/lib/bb/cooker.py | 104 ++++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 51 deletions(-) (limited to 'bitbake/lib/bb/cooker.py') diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index c1e2105c5..7adda09fd 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -494,69 +494,71 @@ class BBCooker: path, _ = os.path.split(path) def parseConfigurationFiles(self, files): - try: - data = self.configuration.data - - bb.parse.init_parser(data, self.configuration.dump_signatures) - for f in files: - data = bb.parse.handle(f, data) + def _parse(f, data): + try: + return bb.parse.handle(f, data) + except (IOError, bb.parse.ParseError) as exc: + parselog.critical("Unable to parse %s: %s" % (f, exc)) + sys.exit(1) + + data = self.configuration.data - layerconf = self._findLayerConf() - if layerconf: - parselog.debug(2, "Found bblayers.conf (%s)", layerconf) - data = bb.parse.handle(layerconf, data) + bb.parse.init_parser(data, self.configuration.dump_signatures) + for f in files: + data = _parse(f, data) - layers = (bb.data.getVar('BBLAYERS', data, True) or "").split() + layerconf = self._findLayerConf() + if layerconf: + parselog.debug(2, "Found bblayers.conf (%s)", layerconf) + data = _parse(layerconf, data) - data = bb.data.createCopy(data) - for layer in layers: - parselog.debug(2, "Adding layer %s", layer) - bb.data.setVar('LAYERDIR', layer, data) - data = bb.parse.handle(os.path.join(layer, "conf", "layer.conf"), data) + layers = (bb.data.getVar('BBLAYERS', data, True) or "").split() - # XXX: Hack, relies on the local keys of the datasmart - # instance being stored in the 'dict' attribute and makes - # assumptions about how variable expansion works, but - # there's no better way to force an expansion of a single - # variable across the datastore today, and this at least - # lets us reference LAYERDIR without having to immediately - # eval all our variables that use it. - for key in data.dict: - if key != "_data": - value = data.getVar(key, False) - if value and "${LAYERDIR}" in value: - data.setVar(key, value.replace("${LAYERDIR}", layer)) + data = bb.data.createCopy(data) + for layer in layers: + parselog.debug(2, "Adding layer %s", layer) + bb.data.setVar('LAYERDIR', layer, data) + data = _parse(os.path.join(layer, "conf", "layer.conf"), data) - bb.data.delVar('LAYERDIR', data) + # XXX: Hack, relies on the local keys of the datasmart + # instance being stored in the 'dict' attribute and makes + # assumptions about how variable expansion works, but + # there's no better way to force an expansion of a single + # variable across the datastore today, and this at least + # lets us reference LAYERDIR without having to immediately + # eval all our variables that use it. + for key in data.dict: + if key != "_data": + value = data.getVar(key, False) + if value and "${LAYERDIR}" in value: + data.setVar(key, value.replace("${LAYERDIR}", layer)) - if not data.getVar("BBPATH", True): - raise SystemExit("The BBPATH variable is not set") + bb.data.delVar('LAYERDIR', data) - data = bb.parse.handle(os.path.join("conf", "bitbake.conf"), data) + if not data.getVar("BBPATH", True): + raise SystemExit("The BBPATH variable is not set") - self.configuration.data = data + data = _parse(os.path.join("conf", "bitbake.conf"), data) - # Handle any INHERITs and inherit the base class - inherits = ["base"] + (bb.data.getVar('INHERIT', self.configuration.data, True ) or "").split() - for inherit in inherits: - self.configuration.data = bb.parse.handle(os.path.join('classes', '%s.bbclass' % inherit), self.configuration.data, True ) + self.configuration.data = data - # Nomally we only register event handlers at the end of parsing .bb files - # We register any handlers we've found so far here... - for var in bb.data.getVar('__BBHANDLERS', self.configuration.data) or []: - bb.event.register(var, bb.data.getVar(var, self.configuration.data)) + # Handle any INHERITs and inherit the base class + inherits = ["base"] + (bb.data.getVar('INHERIT', self.configuration.data, True ) or "").split() + for inherit in inherits: + self.configuration.data = _parse(os.path.join('classes', '%s.bbclass' % inherit), self.configuration.data, True ) - if bb.data.getVar("BB_WORKERCONTEXT", self.configuration.data) is None: - bb.fetch.fetcher_init(self.configuration.data) - bb.codeparser.parser_cache_init(self.configuration.data) + # Nomally we only register event handlers at the end of parsing .bb files + # We register any handlers we've found so far here... + for var in bb.data.getVar('__BBHANDLERS', self.configuration.data) or []: + bb.event.register(var, bb.data.getVar(var, self.configuration.data)) - bb.parse.init_parser(data, self.configuration.dump_signatures) + if bb.data.getVar("BB_WORKERCONTEXT", self.configuration.data) is None: + bb.fetch.fetcher_init(self.configuration.data) + bb.codeparser.parser_cache_init(self.configuration.data) - bb.event.fire(bb.event.ConfigParsed(), self.configuration.data) + bb.parse.init_parser(data, self.configuration.dump_signatures) - except (IOError, bb.parse.ParseError): - parselog.exception("Error when parsing %s", files) - sys.exit(1) + bb.event.fire(bb.event.ConfigParsed(), self.configuration.data) def handleCollections( self, collections ): """Handle collections""" @@ -899,7 +901,7 @@ class BBCooker: if not base in self.appendlist: self.appendlist[base] = [] self.appendlist[base].append(f) - + return (bbfiles, masked) def get_file_appends(self, fn): @@ -909,7 +911,7 @@ class BBCooker: """ f = os.path.basename(fn) if f in self.appendlist: - return self.appendlist[f] + return self.appendlist[f] return [] def pre_serve(self): -- cgit v1.2.3