diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-06-10 10:35:31 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-04 14:46:33 +0000 |
commit | ecc68fa4fbb579e97ea45156e79a293b073697a0 (patch) | |
tree | 6d08682e43476e37ccf48ee14c8d81e208d1c897 /bitbake/lib/bb/cooker.py | |
parent | d3a45c7d41a88d79389fc40eb68816e4939fb6f9 (diff) | |
download | poky-ecc68fa4fbb579e97ea45156e79a293b073697a0.tar.gz |
Switch bitbake internals to use logging directly rather than bb.msg
We use a custom Logger subclass for our loggers
This logger provides:
- 'debug' method which accepts a debug level
- 'plain' method which bypasses log formatting
- 'verbose' method which is more detail than info, but less than debug
(Bitbake rev: 3b2c1fe5ca56daebb24073a9dd45723d3efd2a8d)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 126 |
1 files changed, 61 insertions, 65 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 95f38f6236..de213f03f4 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -23,12 +23,19 @@ | |||
23 | 23 | ||
24 | from __future__ import print_function | 24 | from __future__ import print_function |
25 | import sys, os, glob, os.path, re, time | 25 | import sys, os, glob, os.path, re, time |
26 | import logging | ||
26 | import sre_constants | 27 | import sre_constants |
27 | from cStringIO import StringIO | 28 | from cStringIO import StringIO |
28 | from contextlib import closing | 29 | from contextlib import closing |
29 | import bb | 30 | import bb |
30 | from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue | 31 | from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue |
31 | 32 | ||
33 | logger = logging.getLogger("BitBake") | ||
34 | collectlog = logging.getLogger("BitBake.Collection") | ||
35 | buildlog = logging.getLogger("BitBake.Build") | ||
36 | parselog = logging.getLogger("BitBake.Parsing") | ||
37 | providerlog = logging.getLogger("BitBake.Provider") | ||
38 | |||
32 | class MultipleMatches(Exception): | 39 | class MultipleMatches(Exception): |
33 | """ | 40 | """ |
34 | Exception raised when multiple file matches are found | 41 | Exception raised when multiple file matches are found |
@@ -102,7 +109,7 @@ class BBCooker: | |||
102 | import termios | 109 | import termios |
103 | tcattr = termios.tcgetattr(fd) | 110 | tcattr = termios.tcgetattr(fd) |
104 | if tcattr[3] & termios.TOSTOP: | 111 | if tcattr[3] & termios.TOSTOP: |
105 | bb.msg.note(1, bb.msg.domain.Build, "The terminal had the TOSTOP bit set, clearing...") | 112 | buildlog.info("The terminal had the TOSTOP bit set, clearing...") |
106 | tcattr[3] = tcattr[3] & ~termios.TOSTOP | 113 | tcattr[3] = tcattr[3] & ~termios.TOSTOP |
107 | termios.tcsetattr(fd, termios.TCSANOW, tcattr) | 114 | termios.tcsetattr(fd, termios.TCSANOW, tcattr) |
108 | 115 | ||
@@ -118,7 +125,7 @@ class BBCooker: | |||
118 | if nice: | 125 | if nice: |
119 | curnice = os.nice(0) | 126 | curnice = os.nice(0) |
120 | nice = int(nice) - curnice | 127 | nice = int(nice) - curnice |
121 | bb.msg.note(2, bb.msg.domain.Build, "Renice to %s " % os.nice(nice)) | 128 | buildlog.verbose("Renice to %s " % os.nice(nice)) |
122 | 129 | ||
123 | def parseCommandLine(self): | 130 | def parseCommandLine(self): |
124 | # Parse any commandline into actions | 131 | # Parse any commandline into actions |
@@ -126,11 +133,11 @@ class BBCooker: | |||
126 | self.commandlineAction = None | 133 | self.commandlineAction = None |
127 | 134 | ||
128 | if 'world' in self.configuration.pkgs_to_build: | 135 | if 'world' in self.configuration.pkgs_to_build: |
129 | bb.msg.error(bb.msg.domain.Build, "'world' is not a valid target for --environment.") | 136 | buildlog.error("'world' is not a valid target for --environment.") |
130 | elif len(self.configuration.pkgs_to_build) > 1: | 137 | elif len(self.configuration.pkgs_to_build) > 1: |
131 | bb.msg.error(bb.msg.domain.Build, "Only one target can be used with the --environment option.") | 138 | buildlog.error("Only one target can be used with the --environment option.") |
132 | elif self.configuration.buildfile and len(self.configuration.pkgs_to_build) > 0: | 139 | elif self.configuration.buildfile and len(self.configuration.pkgs_to_build) > 0: |
133 | bb.msg.error(bb.msg.domain.Build, "No target should be used with the --environment and --buildfile options.") | 140 | buildlog.error("No target should be used with the --environment and --buildfile options.") |
134 | elif len(self.configuration.pkgs_to_build) > 0: | 141 | elif len(self.configuration.pkgs_to_build) > 0: |
135 | self.commandlineAction = ["showEnvironmentTarget", self.configuration.pkgs_to_build] | 142 | self.commandlineAction = ["showEnvironmentTarget", self.configuration.pkgs_to_build] |
136 | else: | 143 | else: |
@@ -148,13 +155,13 @@ class BBCooker: | |||
148 | self.commandlineAction = ["generateDotGraph", self.configuration.pkgs_to_build, self.configuration.cmd] | 155 | self.commandlineAction = ["generateDotGraph", self.configuration.pkgs_to_build, self.configuration.cmd] |
149 | else: | 156 | else: |
150 | self.commandlineAction = None | 157 | self.commandlineAction = None |
151 | bb.msg.error(bb.msg.domain.Build, "Please specify a package name for dependency graph generation.") | 158 | buildlog.error("Please specify a package name for dependency graph generation.") |
152 | else: | 159 | else: |
153 | if self.configuration.pkgs_to_build: | 160 | if self.configuration.pkgs_to_build: |
154 | self.commandlineAction = ["buildTargets", self.configuration.pkgs_to_build, self.configuration.cmd] | 161 | self.commandlineAction = ["buildTargets", self.configuration.pkgs_to_build, self.configuration.cmd] |
155 | else: | 162 | else: |
156 | self.commandlineAction = None | 163 | self.commandlineAction = None |
157 | bb.msg.error(bb.msg.domain.Build, "Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") | 164 | buildlog.error("Nothing to do. Use 'bitbake world' to build everything, or run 'bitbake --help' for usage information.") |
158 | 165 | ||
159 | def runCommands(self, server, data, abort): | 166 | def runCommands(self, server, data, abort): |
160 | """ | 167 | """ |
@@ -180,8 +187,8 @@ class BBCooker: | |||
180 | preferred_versions[pn] = (pref_ver, pref_file) | 187 | preferred_versions[pn] = (pref_ver, pref_file) |
181 | latest_versions[pn] = (last_ver, last_file) | 188 | latest_versions[pn] = (last_ver, last_file) |
182 | 189 | ||
183 | bb.msg.plain("%-35s %25s %25s" % ("Package Name", "Latest Version", "Preferred Version")) | 190 | logger.plain("%-35s %25s %25s", "Package Name", "Latest Version", "Preferred Version") |
184 | bb.msg.plain("%-35s %25s %25s\n" % ("============", "==============", "=================")) | 191 | logger.plain("%-35s %25s %25s\n", "============", "==============", "=================") |
185 | 192 | ||
186 | for p in sorted(pkg_pn): | 193 | for p in sorted(pkg_pn): |
187 | pref = preferred_versions[p] | 194 | pref = preferred_versions[p] |
@@ -193,7 +200,7 @@ class BBCooker: | |||
193 | if pref == latest: | 200 | if pref == latest: |
194 | prefstr = "" | 201 | prefstr = "" |
195 | 202 | ||
196 | bb.msg.plain("%-35s %25s %25s" % (p, lateststr, prefstr)) | 203 | logger.plain("%-35s %25s %25s", p, lateststr, prefstr) |
197 | 204 | ||
198 | def compareRevisions(self): | 205 | def compareRevisions(self): |
199 | ret = bb.fetch.fetcher_compare_revisons(self.configuration.data) | 206 | ret = bb.fetch.fetcher_compare_revisons(self.configuration.data) |
@@ -230,27 +237,21 @@ class BBCooker: | |||
230 | if fn: | 237 | if fn: |
231 | try: | 238 | try: |
232 | envdata = self.bb_cache.loadDataFull(fn, self.get_file_appends(fn), self.configuration.data) | 239 | envdata = self.bb_cache.loadDataFull(fn, self.get_file_appends(fn), self.configuration.data) |
233 | except IOError as e: | 240 | except Exception, e: |
234 | bb.msg.error(bb.msg.domain.Parsing, "Unable to read %s: %s" % (fn, e)) | 241 | parselog.exception("Unable to read %s", fn) |
235 | raise | ||
236 | except Exception as e: | ||
237 | bb.msg.error(bb.msg.domain.Parsing, "%s" % e) | ||
238 | raise | 242 | raise |
239 | 243 | ||
240 | # emit variables and shell functions | 244 | # emit variables and shell functions |
241 | try: | 245 | data.update_data(envdata) |
242 | data.update_data(envdata) | 246 | with closing(StringIO()) as env: |
243 | with closing(StringIO()) as env: | 247 | data.emit_env(env, envdata, True) |
244 | data.emit_env(env, envdata, True) | 248 | logger.plain(env.getvalue()) |
245 | bb.msg.plain(env.getvalue()) | ||
246 | except Exception as e: | ||
247 | bb.msg.fatal(bb.msg.domain.Parsing, "%s" % e) | ||
248 | 249 | ||
249 | # emit the metadata which isnt valid shell | 250 | # emit the metadata which isnt valid shell |
250 | data.expandKeys(envdata) | 251 | data.expandKeys(envdata) |
251 | for e in envdata.keys(): | 252 | for e in envdata.keys(): |
252 | if data.getVarFlag( e, 'python', envdata ): | 253 | if data.getVarFlag( e, 'python', envdata ): |
253 | bb.msg.plain("\npython %s () {\n%s}\n" % (e, data.getVar(e, envdata, 1))) | 254 | logger.plain("\npython %s () {\n%s}\n", e, data.getVar(e, envdata, 1)) |
254 | 255 | ||
255 | def generateDepTreeData(self, pkgs_to_build, task): | 256 | def generateDepTreeData(self, pkgs_to_build, task): |
256 | """ | 257 | """ |
@@ -374,7 +375,7 @@ class BBCooker: | |||
374 | for rdepend in depgraph["rdepends-pn"][pn]: | 375 | for rdepend in depgraph["rdepends-pn"][pn]: |
375 | print('"%s" -> "%s" [style=dashed]' % (pn, rdepend), file=depends_file) | 376 | print('"%s" -> "%s" [style=dashed]' % (pn, rdepend), file=depends_file) |
376 | print("}", file=depends_file) | 377 | print("}", file=depends_file) |
377 | bb.msg.plain("PN dependencies saved to 'pn-depends.dot'") | 378 | logger.info("PN dependencies saved to 'pn-depends.dot'") |
378 | 379 | ||
379 | depends_file = file('package-depends.dot', 'w' ) | 380 | depends_file = file('package-depends.dot', 'w' ) |
380 | print("digraph depends {", file=depends_file) | 381 | print("digraph depends {", file=depends_file) |
@@ -395,7 +396,7 @@ class BBCooker: | |||
395 | for rdepend in depgraph["rrecs-pkg"][package]: | 396 | for rdepend in depgraph["rrecs-pkg"][package]: |
396 | print('"%s" -> "%s" [style=dashed]' % (package, rdepend), file=depends_file) | 397 | print('"%s" -> "%s" [style=dashed]' % (package, rdepend), file=depends_file) |
397 | print("}", file=depends_file) | 398 | print("}", file=depends_file) |
398 | bb.msg.plain("Package dependencies saved to 'package-depends.dot'") | 399 | logger.info("Package dependencies saved to 'package-depends.dot'") |
399 | 400 | ||
400 | tdepends_file = file('task-depends.dot', 'w' ) | 401 | tdepends_file = file('task-depends.dot', 'w' ) |
401 | print("digraph depends {", file=tdepends_file) | 402 | print("digraph depends {", file=tdepends_file) |
@@ -407,7 +408,7 @@ class BBCooker: | |||
407 | for dep in depgraph["tdepends"][task]: | 408 | for dep in depgraph["tdepends"][task]: |
408 | print('"%s" -> "%s"' % (task, dep), file=tdepends_file) | 409 | print('"%s" -> "%s"' % (task, dep), file=tdepends_file) |
409 | print("}", file=tdepends_file) | 410 | print("}", file=tdepends_file) |
410 | bb.msg.plain("Task dependencies saved to 'task-depends.dot'") | 411 | logger.info("Task dependencies saved to 'task-depends.dot'") |
411 | 412 | ||
412 | def buildDepgraph( self ): | 413 | def buildDepgraph( self ): |
413 | all_depends = self.status.all_depends | 414 | all_depends = self.status.all_depends |
@@ -431,10 +432,10 @@ class BBCooker: | |||
431 | try: | 432 | try: |
432 | (providee, provider) = p.split(':') | 433 | (providee, provider) = p.split(':') |
433 | except: | 434 | except: |
434 | bb.msg.fatal(bb.msg.domain.Provider, "Malformed option in PREFERRED_PROVIDERS variable: %s" % p) | 435 | providerlog.critical("Malformed option in PREFERRED_PROVIDERS variable: %s" % p) |
435 | continue | 436 | continue |
436 | if providee in self.status.preferred and self.status.preferred[providee] != provider: | 437 | if providee in self.status.preferred and self.status.preferred[providee] != provider: |
437 | bb.msg.error(bb.msg.domain.Provider, "conflicting preferences for %s: both %s and %s specified" % (providee, provider, self.status.preferred[providee])) | 438 | providerlog.error("conflicting preferences for %s: both %s and %s specified", providee, provider, self.status.preferred[providee]) |
438 | self.status.preferred[providee] = provider | 439 | self.status.preferred[providee] = provider |
439 | 440 | ||
440 | # Calculate priorities for each file | 441 | # Calculate priorities for each file |
@@ -443,8 +444,7 @@ class BBCooker: | |||
443 | 444 | ||
444 | for collection, pattern, regex, _ in self.status.bbfile_config_priorities: | 445 | for collection, pattern, regex, _ in self.status.bbfile_config_priorities: |
445 | if not regex in matched: | 446 | if not regex in matched: |
446 | bb.msg.warn(bb.msg.domain.Provider, "No bb files matched BBFILE_PATTERN_%s '%s'" % | 447 | collectlog.warn("No bb files matched BBFILE_PATTERN_%s '%s'" % (collection, pattern)) |
447 | (collection, pattern)) | ||
448 | 448 | ||
449 | def buildWorldTargetList(self): | 449 | def buildWorldTargetList(self): |
450 | """ | 450 | """ |
@@ -452,19 +452,19 @@ class BBCooker: | |||
452 | """ | 452 | """ |
453 | all_depends = self.status.all_depends | 453 | all_depends = self.status.all_depends |
454 | pn_provides = self.status.pn_provides | 454 | pn_provides = self.status.pn_provides |
455 | bb.msg.debug(1, bb.msg.domain.Parsing, "collating packages for \"world\"") | 455 | parselog.debug(1, "collating packages for \"world\"") |
456 | for f in self.status.possible_world: | 456 | for f in self.status.possible_world: |
457 | terminal = True | 457 | terminal = True |
458 | pn = self.status.pkg_fn[f] | 458 | pn = self.status.pkg_fn[f] |
459 | 459 | ||
460 | for p in pn_provides[pn]: | 460 | for p in pn_provides[pn]: |
461 | if p.startswith('virtual/'): | 461 | if p.startswith('virtual/'): |
462 | bb.msg.debug(2, bb.msg.domain.Parsing, "World build skipping %s due to %s provider starting with virtual/" % (f, p)) | 462 | parselog.debug(2, "World build skipping %s due to %s provider starting with virtual/", f, p) |
463 | terminal = False | 463 | terminal = False |
464 | break | 464 | break |
465 | for pf in self.status.providers[p]: | 465 | for pf in self.status.providers[p]: |
466 | if self.status.pkg_fn[pf] != pn: | 466 | if self.status.pkg_fn[pf] != pn: |
467 | bb.msg.debug(2, bb.msg.domain.Parsing, "World build skipping %s due to both us and %s providing %s" % (f, pf, p)) | 467 | parselog.debug(2, "World build skipping %s due to both us and %s providing %s", f, pf, p) |
468 | terminal = False | 468 | terminal = False |
469 | break | 469 | break |
470 | if terminal: | 470 | if terminal: |
@@ -478,8 +478,9 @@ class BBCooker: | |||
478 | """Drop off into a shell""" | 478 | """Drop off into a shell""" |
479 | try: | 479 | try: |
480 | from bb import shell | 480 | from bb import shell |
481 | except ImportError as details: | 481 | except ImportError: |
482 | bb.msg.fatal(bb.msg.domain.Parsing, "Sorry, shell not available (%s)" % details ) | 482 | parselog.exception("Interactive mode not available") |
483 | sys.exit(1) | ||
483 | else: | 484 | else: |
484 | shell.start( self ) | 485 | shell.start( self ) |
485 | 486 | ||
@@ -502,14 +503,14 @@ class BBCooker: | |||
502 | 503 | ||
503 | layerconf = self._findLayerConf() | 504 | layerconf = self._findLayerConf() |
504 | if layerconf: | 505 | if layerconf: |
505 | bb.msg.debug(2, bb.msg.domain.Parsing, "Found bblayers.conf (%s)" % layerconf) | 506 | parselog.debug(2, "Found bblayers.conf (%s)", layerconf) |
506 | data = bb.parse.handle(layerconf, data) | 507 | data = bb.parse.handle(layerconf, data) |
507 | 508 | ||
508 | layers = (bb.data.getVar('BBLAYERS', data, True) or "").split() | 509 | layers = (bb.data.getVar('BBLAYERS', data, True) or "").split() |
509 | 510 | ||
510 | data = bb.data.createCopy(data) | 511 | data = bb.data.createCopy(data) |
511 | for layer in layers: | 512 | for layer in layers: |
512 | bb.msg.debug(2, bb.msg.domain.Parsing, "Adding layer %s" % layer) | 513 | parselog.debug(2, "Adding layer %s", layer) |
513 | bb.data.setVar('LAYERDIR', layer, data) | 514 | bb.data.setVar('LAYERDIR', layer, data) |
514 | data = bb.parse.handle(os.path.join(layer, "conf", "layer.conf"), data) | 515 | data = bb.parse.handle(os.path.join(layer, "conf", "layer.conf"), data) |
515 | 516 | ||
@@ -529,7 +530,7 @@ class BBCooker: | |||
529 | bb.data.delVar('LAYERDIR', data) | 530 | bb.data.delVar('LAYERDIR', data) |
530 | 531 | ||
531 | if not data.getVar("BBPATH", True): | 532 | if not data.getVar("BBPATH", True): |
532 | bb.fatal("The BBPATH variable is not set") | 533 | raise SystemExit("The BBPATH variable is not set") |
533 | 534 | ||
534 | data = bb.parse.handle(os.path.join("conf", "bitbake.conf"), data) | 535 | data = bb.parse.handle(os.path.join("conf", "bitbake.conf"), data) |
535 | 536 | ||
@@ -553,10 +554,9 @@ class BBCooker: | |||
553 | 554 | ||
554 | bb.event.fire(bb.event.ConfigParsed(), self.configuration.data) | 555 | bb.event.fire(bb.event.ConfigParsed(), self.configuration.data) |
555 | 556 | ||
556 | except IOError as e: | 557 | except (IOError, bb.parse.ParseError): |
557 | bb.msg.fatal(bb.msg.domain.Parsing, "Error when parsing %s: %s" % (files, str(e))) | 558 | parselog.exception("Error when parsing %s", files) |
558 | except bb.parse.ParseError as details: | 559 | sys.exit(1) |
559 | bb.msg.fatal(bb.msg.domain.Parsing, "Unable to parse %s (%s)" % (files, details) ) | ||
560 | 560 | ||
561 | def handleCollections( self, collections ): | 561 | def handleCollections( self, collections ): |
562 | """Handle collections""" | 562 | """Handle collections""" |
@@ -565,22 +565,22 @@ class BBCooker: | |||
565 | for c in collection_list: | 565 | for c in collection_list: |
566 | regex = bb.data.getVar("BBFILE_PATTERN_%s" % c, self.configuration.data, 1) | 566 | regex = bb.data.getVar("BBFILE_PATTERN_%s" % c, self.configuration.data, 1) |
567 | if regex == None: | 567 | if regex == None: |
568 | bb.msg.error(bb.msg.domain.Parsing, "BBFILE_PATTERN_%s not defined" % c) | 568 | parselog.error("BBFILE_PATTERN_%s not defined" % c) |
569 | continue | 569 | continue |
570 | priority = bb.data.getVar("BBFILE_PRIORITY_%s" % c, self.configuration.data, 1) | 570 | priority = bb.data.getVar("BBFILE_PRIORITY_%s" % c, self.configuration.data, 1) |
571 | if priority == None: | 571 | if priority == None: |
572 | bb.msg.error(bb.msg.domain.Parsing, "BBFILE_PRIORITY_%s not defined" % c) | 572 | parselog.error("BBFILE_PRIORITY_%s not defined" % c) |
573 | continue | 573 | continue |
574 | try: | 574 | try: |
575 | cre = re.compile(regex) | 575 | cre = re.compile(regex) |
576 | except re.error: | 576 | except re.error: |
577 | bb.msg.error(bb.msg.domain.Parsing, "BBFILE_PATTERN_%s \"%s\" is not a valid regular expression" % (c, regex)) | 577 | parselog.error("BBFILE_PATTERN_%s \"%s\" is not a valid regular expression", c, regex) |
578 | continue | 578 | continue |
579 | try: | 579 | try: |
580 | pri = int(priority) | 580 | pri = int(priority) |
581 | self.status.bbfile_config_priorities.append((c, regex, cre, pri)) | 581 | self.status.bbfile_config_priorities.append((c, regex, cre, pri)) |
582 | except ValueError: | 582 | except ValueError: |
583 | bb.msg.error(bb.msg.domain.Parsing, "invalid value for BBFILE_PRIORITY_%s: \"%s\"" % (c, priority)) | 583 | parselog.error("invalid value for BBFILE_PRIORITY_%s: \"%s\"", c, priority) |
584 | 584 | ||
585 | def buildSetVars(self): | 585 | def buildSetVars(self): |
586 | """ | 586 | """ |
@@ -616,9 +616,9 @@ class BBCooker: | |||
616 | """ | 616 | """ |
617 | matches = self.matchFiles(buildfile) | 617 | matches = self.matchFiles(buildfile) |
618 | if len(matches) != 1: | 618 | if len(matches) != 1: |
619 | bb.msg.error(bb.msg.domain.Parsing, "Unable to match %s (%s matches found):" % (buildfile, len(matches))) | 619 | parselog.error("Unable to match %s (%s matches found):" % (buildfile, len(matches))) |
620 | for f in matches: | 620 | for f in matches: |
621 | bb.msg.error(bb.msg.domain.Parsing, " %s" % f) | 621 | parselog.error(" %s" % f) |
622 | raise MultipleMatches | 622 | raise MultipleMatches |
623 | return matches[0] | 623 | return matches[0] |
624 | 624 | ||
@@ -662,7 +662,7 @@ class BBCooker: | |||
662 | 662 | ||
663 | # Remove stamp for target if force mode active | 663 | # Remove stamp for target if force mode active |
664 | if self.configuration.force: | 664 | if self.configuration.force: |
665 | bb.msg.note(2, bb.msg.domain.RunQueue, "Remove stamp %s, %s" % (task, fn)) | 665 | logger.verbose("Remove stamp %s, %s", task, fn) |
666 | bb.build.del_stamp('do_%s' % task, self.status, fn) | 666 | bb.build.del_stamp('do_%s' % task, self.status, fn) |
667 | 667 | ||
668 | # Setup taskdata structure | 668 | # Setup taskdata structure |
@@ -691,7 +691,7 @@ class BBCooker: | |||
691 | retval = rq.execute_runqueue() | 691 | retval = rq.execute_runqueue() |
692 | except runqueue.TaskFailure as exc: | 692 | except runqueue.TaskFailure as exc: |
693 | for fnid in exc.args: | 693 | for fnid in exc.args: |
694 | bb.msg.error(bb.msg.domain.Build, "'%s' failed" % taskdata.fn_index[fnid]) | 694 | buildlog.error("'%s' failed" % taskdata.fn_index[fnid]) |
695 | failures = failures + 1 | 695 | failures = failures + 1 |
696 | retval = False | 696 | retval = False |
697 | if not retval: | 697 | if not retval: |
@@ -728,7 +728,7 @@ class BBCooker: | |||
728 | retval = rq.execute_runqueue() | 728 | retval = rq.execute_runqueue() |
729 | except runqueue.TaskFailure as exc: | 729 | except runqueue.TaskFailure as exc: |
730 | for fnid in exc.args: | 730 | for fnid in exc.args: |
731 | bb.msg.error(bb.msg.domain.Build, "'%s' failed" % taskdata.fn_index[fnid]) | 731 | buildlog.error("'%s' failed" % taskdata.fn_index[fnid]) |
732 | failures = failures + 1 | 732 | failures = failures + 1 |
733 | retval = False | 733 | retval = False |
734 | if not retval: | 734 | if not retval: |
@@ -779,11 +779,11 @@ class BBCooker: | |||
779 | try: | 779 | try: |
780 | import psyco | 780 | import psyco |
781 | except ImportError: | 781 | except ImportError: |
782 | bb.msg.note(1, bb.msg.domain.Collection, "Psyco JIT Compiler (http://psyco.sf.net) not available. Install it to increase performance.") | 782 | collectlog.info("Psyco JIT Compiler (http://psyco.sf.net) not available. Install it to increase performance.") |
783 | else: | 783 | else: |
784 | psyco.bind( CookerParser.parse_next ) | 784 | psyco.bind( CookerParser.parse_next ) |
785 | else: | 785 | else: |
786 | bb.msg.note(1, bb.msg.domain.Collection, "You have disabled Psyco. This decreases performance.") | 786 | collectlog.info("You have disabled Psyco. This decreases performance.") |
787 | 787 | ||
788 | self.status = bb.cache.CacheData() | 788 | self.status = bb.cache.CacheData() |
789 | 789 | ||
@@ -802,7 +802,7 @@ class BBCooker: | |||
802 | self.cookerState = cookerParsing | 802 | self.cookerState = cookerParsing |
803 | 803 | ||
804 | if not self.parser.parse_next(): | 804 | if not self.parser.parse_next(): |
805 | bb.msg.debug(1, bb.msg.domain.Collection, "parsing complete") | 805 | collectlog.debug(1, "parsing complete") |
806 | self.buildDepgraph() | 806 | self.buildDepgraph() |
807 | self.cookerState = cookerParsed | 807 | self.cookerState = cookerParsed |
808 | return None | 808 | return None |
@@ -850,7 +850,7 @@ class BBCooker: | |||
850 | parsed, cached, skipped, masked = 0, 0, 0, 0 | 850 | parsed, cached, skipped, masked = 0, 0, 0, 0 |
851 | self.bb_cache = bb.cache.init(self) | 851 | self.bb_cache = bb.cache.init(self) |
852 | 852 | ||
853 | bb.msg.debug(1, bb.msg.domain.Collection, "collecting .bb files") | 853 | collectlog.debug(1, "collecting .bb files") |
854 | 854 | ||
855 | files = (data.getVar( "BBFILES", self.configuration.data, 1 ) or "").split() | 855 | files = (data.getVar( "BBFILES", self.configuration.data, 1 ) or "").split() |
856 | data.setVar("BBFILES", " ".join(files), self.configuration.data) | 856 | data.setVar("BBFILES", " ".join(files), self.configuration.data) |
@@ -859,7 +859,7 @@ class BBCooker: | |||
859 | files = self.get_bbfiles() | 859 | files = self.get_bbfiles() |
860 | 860 | ||
861 | if not len(files): | 861 | if not len(files): |
862 | bb.msg.error(bb.msg.domain.Collection, "no recipe files to build, check your BBPATH and BBFILES?") | 862 | collectlog.error("no recipe files to build, check your BBPATH and BBFILES?") |
863 | bb.event.fire(CookerExit(), self.configuration.event_data) | 863 | bb.event.fire(CookerExit(), self.configuration.event_data) |
864 | 864 | ||
865 | newfiles = set() | 865 | newfiles = set() |
@@ -879,13 +879,14 @@ class BBCooker: | |||
879 | try: | 879 | try: |
880 | bbmask_compiled = re.compile(bbmask) | 880 | bbmask_compiled = re.compile(bbmask) |
881 | except sre_constants.error: | 881 | except sre_constants.error: |
882 | bb.msg.fatal(bb.msg.domain.Collection, "BBMASK is not a valid regular expression.") | 882 | collectlog.critical("BBMASK is not a valid regular expression, ignoring.") |
883 | return list(newfiles), 0 | ||
883 | 884 | ||
884 | bbfiles = [] | 885 | bbfiles = [] |
885 | bbappend = [] | 886 | bbappend = [] |
886 | for f in newfiles: | 887 | for f in newfiles: |
887 | if bbmask and bbmask_compiled.search(f): | 888 | if bbmask and bbmask_compiled.search(f): |
888 | bb.msg.debug(1, bb.msg.domain.Collection, "skipping masked file %s" % f) | 889 | collectlog.debug(1, "skipping masked file %s", f) |
889 | masked += 1 | 890 | masked += 1 |
890 | continue | 891 | continue |
891 | if f.endswith('.bb'): | 892 | if f.endswith('.bb'): |
@@ -893,7 +894,7 @@ class BBCooker: | |||
893 | elif f.endswith('.bbappend'): | 894 | elif f.endswith('.bbappend'): |
894 | bbappend.append(f) | 895 | bbappend.append(f) |
895 | else: | 896 | else: |
896 | bb.msg.note(1, bb.msg.domain.Collection, "File %s of unknown filetype in BBFILES? Ignorning..." % f) | 897 | collectlog.debug(1, "skipping %s: unknown file extension", f) |
897 | 898 | ||
898 | # Build a list of .bbappend files for each .bb file | 899 | # Build a list of .bbappend files for each .bb file |
899 | self.appendlist = {} | 900 | self.appendlist = {} |
@@ -1008,11 +1009,6 @@ class CookerParser: | |||
1008 | self.skipped += skipped | 1009 | self.skipped += skipped |
1009 | self.virtuals += virtuals | 1010 | self.virtuals += virtuals |
1010 | 1011 | ||
1011 | except IOError as e: | ||
1012 | self.error += 1 | ||
1013 | cooker.bb_cache.remove(f) | ||
1014 | bb.msg.error(bb.msg.domain.Collection, "opening %s: %s" % (f, e)) | ||
1015 | pass | ||
1016 | except KeyboardInterrupt: | 1012 | except KeyboardInterrupt: |
1017 | cooker.bb_cache.remove(f) | 1013 | cooker.bb_cache.remove(f) |
1018 | cooker.bb_cache.sync() | 1014 | cooker.bb_cache.sync() |
@@ -1020,7 +1016,7 @@ class CookerParser: | |||
1020 | except Exception as e: | 1016 | except Exception as e: |
1021 | self.error += 1 | 1017 | self.error += 1 |
1022 | cooker.bb_cache.remove(f) | 1018 | cooker.bb_cache.remove(f) |
1023 | bb.msg.error(bb.msg.domain.Collection, "%s while parsing %s" % (e, f)) | 1019 | parselog.exception("Unable to open %s", f) |
1024 | except: | 1020 | except: |
1025 | cooker.bb_cache.remove(f) | 1021 | cooker.bb_cache.remove(f) |
1026 | raise | 1022 | raise |