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/taskdata.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/taskdata.py')
-rw-r--r-- | bitbake/lib/bb/taskdata.py | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py index e31f967850..7dc1c0c82f 100644 --- a/bitbake/lib/bb/taskdata.py +++ b/bitbake/lib/bb/taskdata.py | |||
@@ -23,8 +23,11 @@ Task data collection and handling | |||
23 | # with this program; if not, write to the Free Software Foundation, Inc., | 23 | # with this program; if not, write to the Free Software Foundation, Inc., |
24 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 24 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
25 | 25 | ||
26 | import logging | ||
26 | import bb | 27 | import bb |
27 | 28 | ||
29 | logger = logging.getLogger("BitBake.TaskData") | ||
30 | |||
28 | def re_match_strings(target, strings): | 31 | def re_match_strings(target, strings): |
29 | """ | 32 | """ |
30 | Whether or not the string 'target' matches | 33 | Whether or not the string 'target' matches |
@@ -182,7 +185,7 @@ class TaskData: | |||
182 | if not fnid in self.depids: | 185 | if not fnid in self.depids: |
183 | dependids = {} | 186 | dependids = {} |
184 | for depend in dataCache.deps[fn]: | 187 | for depend in dataCache.deps[fn]: |
185 | bb.msg.debug(2, bb.msg.domain.TaskData, "Added dependency %s for %s" % (depend, fn)) | 188 | logger.debug(2, "Added dependency %s for %s", depend, fn) |
186 | dependids[self.getbuild_id(depend)] = None | 189 | dependids[self.getbuild_id(depend)] = None |
187 | self.depids[fnid] = dependids.keys() | 190 | self.depids[fnid] = dependids.keys() |
188 | 191 | ||
@@ -193,11 +196,11 @@ class TaskData: | |||
193 | rrecs = dataCache.runrecs[fn] | 196 | rrecs = dataCache.runrecs[fn] |
194 | for package in rdepends: | 197 | for package in rdepends: |
195 | for rdepend in bb.utils.explode_deps(rdepends[package]): | 198 | for rdepend in bb.utils.explode_deps(rdepends[package]): |
196 | bb.msg.debug(2, bb.msg.domain.TaskData, "Added runtime dependency %s for %s" % (rdepend, fn)) | 199 | logger.debug(2, "Added runtime dependency %s for %s", rdepend, fn) |
197 | rdependids[self.getrun_id(rdepend)] = None | 200 | rdependids[self.getrun_id(rdepend)] = None |
198 | for package in rrecs: | 201 | for package in rrecs: |
199 | for rdepend in bb.utils.explode_deps(rrecs[package]): | 202 | for rdepend in bb.utils.explode_deps(rrecs[package]): |
200 | bb.msg.debug(2, bb.msg.domain.TaskData, "Added runtime recommendation %s for %s" % (rdepend, fn)) | 203 | logger.debug(2, "Added runtime recommendation %s for %s", rdepend, fn) |
201 | rdependids[self.getrun_id(rdepend)] = None | 204 | rdependids[self.getrun_id(rdepend)] = None |
202 | self.rdepids[fnid] = rdependids.keys() | 205 | self.rdepids[fnid] = rdependids.keys() |
203 | 206 | ||
@@ -397,7 +400,7 @@ class TaskData: | |||
397 | fnid = self.getfn_id(fn) | 400 | fnid = self.getfn_id(fn) |
398 | if fnid in self.failed_fnids: | 401 | if fnid in self.failed_fnids: |
399 | continue | 402 | continue |
400 | bb.msg.debug(2, bb.msg.domain.Provider, "adding %s to satisfy %s" % (fn, item)) | 403 | logger.debug(2, "adding %s to satisfy %s", fn, item) |
401 | self.add_build_target(fn, item) | 404 | self.add_build_target(fn, item) |
402 | self.add_tasks(fn, dataCache) | 405 | self.add_tasks(fn, dataCache) |
403 | 406 | ||
@@ -450,7 +453,7 @@ class TaskData: | |||
450 | fnid = self.getfn_id(fn) | 453 | fnid = self.getfn_id(fn) |
451 | if fnid in self.failed_fnids: | 454 | if fnid in self.failed_fnids: |
452 | continue | 455 | continue |
453 | bb.msg.debug(2, bb.msg.domain.Provider, "adding '%s' to satisfy runtime '%s'" % (fn, item)) | 456 | logger.debug(2, "adding '%s' to satisfy runtime '%s'", fn, item) |
454 | self.add_runtime_target(fn, item) | 457 | self.add_runtime_target(fn, item) |
455 | self.add_tasks(fn, dataCache) | 458 | self.add_tasks(fn, dataCache) |
456 | 459 | ||
@@ -463,7 +466,7 @@ class TaskData: | |||
463 | """ | 466 | """ |
464 | if fnid in self.failed_fnids: | 467 | if fnid in self.failed_fnids: |
465 | return | 468 | return |
466 | bb.msg.debug(1, bb.msg.domain.Provider, "File '%s' is unbuildable, removing..." % self.fn_index[fnid]) | 469 | logger.debug(1, "File '%s' is unbuildable, removing...", self.fn_index[fnid]) |
467 | self.failed_fnids.append(fnid) | 470 | self.failed_fnids.append(fnid) |
468 | for target in self.build_targets: | 471 | for target in self.build_targets: |
469 | if fnid in self.build_targets[target]: | 472 | if fnid in self.build_targets[target]: |
@@ -485,7 +488,7 @@ class TaskData: | |||
485 | missing_list = [self.build_names_index[targetid]] | 488 | missing_list = [self.build_names_index[targetid]] |
486 | else: | 489 | else: |
487 | missing_list = [self.build_names_index[targetid]] + missing_list | 490 | missing_list = [self.build_names_index[targetid]] + missing_list |
488 | bb.msg.note(2, bb.msg.domain.Provider, "Target '%s' is unbuildable, removing...\nMissing or unbuildable dependency chain was: %s" % (self.build_names_index[targetid], missing_list)) | 491 | providerlog.verbose("Target '%s' is unbuildable, removing...\nMissing or unbuildable dependency chain was: %s", self.build_names_index[targetid], missing_list) |
489 | self.failed_deps.append(targetid) | 492 | self.failed_deps.append(targetid) |
490 | dependees = self.get_dependees(targetid) | 493 | dependees = self.get_dependees(targetid) |
491 | for fnid in dependees: | 494 | for fnid in dependees: |
@@ -498,7 +501,7 @@ class TaskData: | |||
498 | 501 | ||
499 | if self.abort and targetid in self.external_targets: | 502 | if self.abort and targetid in self.external_targets: |
500 | target = self.build_names_index[targetid] | 503 | target = self.build_names_index[targetid] |
501 | bb.msg.error(bb.msg.domain.Provider, "Required build target '%s' has no buildable providers.\nMissing or unbuildable dependency chain was: %s" % (target, missing_list)) | 504 | providerlog.error("Required build target '%s' has no buildable providers.\nMissing or unbuildable dependency chain was: %s", target, missing_list) |
502 | raise bb.providers.NoProvider(target) | 505 | raise bb.providers.NoProvider(target) |
503 | 506 | ||
504 | def remove_runtarget(self, targetid, missing_list = []): | 507 | def remove_runtarget(self, targetid, missing_list = []): |
@@ -511,7 +514,7 @@ class TaskData: | |||
511 | else: | 514 | else: |
512 | missing_list = [self.run_names_index[targetid]] + missing_list | 515 | missing_list = [self.run_names_index[targetid]] + missing_list |
513 | 516 | ||
514 | bb.msg.note(1, bb.msg.domain.Provider, "Runtime target '%s' is unbuildable, removing...\nMissing or unbuildable dependency chain was: %s" % (self.run_names_index[targetid], missing_list)) | 517 | providerlog.info("Runtime target '%s' is unbuildable, removing...\nMissing or unbuildable dependency chain was: %s", self.run_names_index[targetid], missing_list) |
515 | self.failed_rdeps.append(targetid) | 518 | self.failed_rdeps.append(targetid) |
516 | dependees = self.get_rdependees(targetid) | 519 | dependees = self.get_rdependees(targetid) |
517 | for fnid in dependees: | 520 | for fnid in dependees: |
@@ -521,7 +524,7 @@ class TaskData: | |||
521 | """ | 524 | """ |
522 | Resolve all unresolved build and runtime targets | 525 | Resolve all unresolved build and runtime targets |
523 | """ | 526 | """ |
524 | bb.msg.note(1, bb.msg.domain.TaskData, "Resolving any missing task queue dependencies") | 527 | logger.info("Resolving any missing task queue dependencies") |
525 | while True: | 528 | while True: |
526 | added = 0 | 529 | added = 0 |
527 | for target in self.get_unresolved_build_targets(dataCache): | 530 | for target in self.get_unresolved_build_targets(dataCache): |
@@ -539,7 +542,7 @@ class TaskData: | |||
539 | added = added + 1 | 542 | added = added + 1 |
540 | except bb.providers.NoRProvider: | 543 | except bb.providers.NoRProvider: |
541 | self.remove_runtarget(self.getrun_id(target)) | 544 | self.remove_runtarget(self.getrun_id(target)) |
542 | bb.msg.debug(1, bb.msg.domain.TaskData, "Resolved " + str(added) + " extra dependencies") | 545 | logger.debug(1, "Resolved " + str(added) + " extra dependencies") |
543 | if added == 0: | 546 | if added == 0: |
544 | break | 547 | break |
545 | # self.dump_data() | 548 | # self.dump_data() |
@@ -548,40 +551,40 @@ class TaskData: | |||
548 | """ | 551 | """ |
549 | Dump some debug information on the internal data structures | 552 | Dump some debug information on the internal data structures |
550 | """ | 553 | """ |
551 | bb.msg.debug(3, bb.msg.domain.TaskData, "build_names:") | 554 | logger.debug(3, "build_names:") |
552 | bb.msg.debug(3, bb.msg.domain.TaskData, ", ".join(self.build_names_index)) | 555 | logger.debug(3, ", ".join(self.build_names_index)) |
553 | 556 | ||
554 | bb.msg.debug(3, bb.msg.domain.TaskData, "run_names:") | 557 | logger.debug(3, "run_names:") |
555 | bb.msg.debug(3, bb.msg.domain.TaskData, ", ".join(self.run_names_index)) | 558 | logger.debug(3, ", ".join(self.run_names_index)) |
556 | 559 | ||
557 | bb.msg.debug(3, bb.msg.domain.TaskData, "build_targets:") | 560 | logger.debug(3, "build_targets:") |
558 | for buildid in range(len(self.build_names_index)): | 561 | for buildid in range(len(self.build_names_index)): |
559 | target = self.build_names_index[buildid] | 562 | target = self.build_names_index[buildid] |
560 | targets = "None" | 563 | targets = "None" |
561 | if buildid in self.build_targets: | 564 | if buildid in self.build_targets: |
562 | targets = self.build_targets[buildid] | 565 | targets = self.build_targets[buildid] |
563 | bb.msg.debug(3, bb.msg.domain.TaskData, " (%s)%s: %s" % (buildid, target, targets)) | 566 | logger.debug(3, " (%s)%s: %s", buildid, target, targets) |
564 | 567 | ||
565 | bb.msg.debug(3, bb.msg.domain.TaskData, "run_targets:") | 568 | logger.debug(3, "run_targets:") |
566 | for runid in range(len(self.run_names_index)): | 569 | for runid in range(len(self.run_names_index)): |
567 | target = self.run_names_index[runid] | 570 | target = self.run_names_index[runid] |
568 | targets = "None" | 571 | targets = "None" |
569 | if runid in self.run_targets: | 572 | if runid in self.run_targets: |
570 | targets = self.run_targets[runid] | 573 | targets = self.run_targets[runid] |
571 | bb.msg.debug(3, bb.msg.domain.TaskData, " (%s)%s: %s" % (runid, target, targets)) | 574 | logger.debug(3, " (%s)%s: %s", runid, target, targets) |
572 | 575 | ||
573 | bb.msg.debug(3, bb.msg.domain.TaskData, "tasks:") | 576 | logger.debug(3, "tasks:") |
574 | for task in range(len(self.tasks_name)): | 577 | for task in range(len(self.tasks_name)): |
575 | bb.msg.debug(3, bb.msg.domain.TaskData, " (%s)%s - %s: %s" % ( | 578 | logger.debug(3, " (%s)%s - %s: %s", |
576 | task, | 579 | task, |
577 | self.fn_index[self.tasks_fnid[task]], | 580 | self.fn_index[self.tasks_fnid[task]], |
578 | self.tasks_name[task], | 581 | self.tasks_name[task], |
579 | self.tasks_tdepends[task])) | 582 | self.tasks_tdepends[task]) |
580 | 583 | ||
581 | bb.msg.debug(3, bb.msg.domain.TaskData, "dependency ids (per fn):") | 584 | logger.debug(3, "dependency ids (per fn):") |
582 | for fnid in self.depids: | 585 | for fnid in self.depids: |
583 | bb.msg.debug(3, bb.msg.domain.TaskData, " %s %s: %s" % (fnid, self.fn_index[fnid], self.depids[fnid])) | 586 | logger.debug(3, " %s %s: %s", fnid, self.fn_index[fnid], self.depids[fnid]) |
584 | 587 | ||
585 | bb.msg.debug(3, bb.msg.domain.TaskData, "runtime dependency ids (per fn):") | 588 | logger.debug(3, "runtime dependency ids (per fn):") |
586 | for fnid in self.rdepids: | 589 | for fnid in self.rdepids: |
587 | bb.msg.debug(3, bb.msg.domain.TaskData, " %s %s: %s" % (fnid, self.fn_index[fnid], self.rdepids[fnid])) | 590 | logger.debug(3, " %s %s: %s", fnid, self.fn_index[fnid], self.rdepids[fnid]) |