diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-06-27 11:04:48 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-06-28 16:32:57 +0100 |
commit | be22b92627408af79e1d62e23e838f5c01cf4fae (patch) | |
tree | c0cf7b0114b3bbd38b95c15b058d49e81b1e9d89 | |
parent | edfb2ba32c5075e2df338a549021c634659f3225 (diff) | |
download | poky-be22b92627408af79e1d62e23e838f5c01cf4fae.tar.gz |
bitbake: runqueue.py: Convert depends variable to use sets
This gives some small performance gains and sets the scene for other
improvements by removing the need for duplicate detection code.
(Bitbake rev: 6fd723479e8d49227fd58040b3485c1d5afc4bc5)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index e09e8c8080..c45287d035 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -409,7 +409,7 @@ class RunQueueData: | |||
409 | for taskname in tasknames: | 409 | for taskname in tasknames: |
410 | taskid = taskData.gettask_id_fromfnid(depdata, taskname) | 410 | taskid = taskData.gettask_id_fromfnid(depdata, taskname) |
411 | if taskid is not None: | 411 | if taskid is not None: |
412 | depends.append(taskid) | 412 | depends.add(taskid) |
413 | 413 | ||
414 | def add_runtime_dependencies(depids, tasknames, depends): | 414 | def add_runtime_dependencies(depids, tasknames, depends): |
415 | for depid in depids: | 415 | for depid in depids: |
@@ -421,10 +421,10 @@ class RunQueueData: | |||
421 | for taskname in tasknames: | 421 | for taskname in tasknames: |
422 | taskid = taskData.gettask_id_fromfnid(depdata, taskname) | 422 | taskid = taskData.gettask_id_fromfnid(depdata, taskname) |
423 | if taskid is not None: | 423 | if taskid is not None: |
424 | depends.append(taskid) | 424 | depends.add(taskid) |
425 | 425 | ||
426 | for task in xrange(len(taskData.tasks_name)): | 426 | for task in xrange(len(taskData.tasks_name)): |
427 | depends = [] | 427 | depends = set() |
428 | recrdepends = [] | 428 | recrdepends = [] |
429 | fnid = taskData.tasks_fnid[task] | 429 | fnid = taskData.tasks_fnid[task] |
430 | fn = taskData.fn_index[fnid] | 430 | fn = taskData.fn_index[fnid] |
@@ -437,7 +437,7 @@ class RunQueueData: | |||
437 | # Resolve task internal dependencies | 437 | # Resolve task internal dependencies |
438 | # | 438 | # |
439 | # e.g. addtask before X after Y | 439 | # e.g. addtask before X after Y |
440 | depends = taskData.tasks_tdepends[task] | 440 | depends = set(taskData.tasks_tdepends[task]) |
441 | 441 | ||
442 | # Resolve 'deptask' dependencies | 442 | # Resolve 'deptask' dependencies |
443 | # | 443 | # |
@@ -470,7 +470,7 @@ class RunQueueData: | |||
470 | taskid = taskData.gettask_id_fromfnid(depdata, idependtask) | 470 | taskid = taskData.gettask_id_fromfnid(depdata, idependtask) |
471 | if taskid is None: | 471 | if taskid is None: |
472 | bb.msg.fatal("RunQueue", "Task %s in %s depends upon non-existent task %s in %s" % (taskData.tasks_name[task], fn, idependtask, dep)) | 472 | bb.msg.fatal("RunQueue", "Task %s in %s depends upon non-existent task %s in %s" % (taskData.tasks_name[task], fn, idependtask, dep)) |
473 | depends.append(taskid) | 473 | depends.add(taskid) |
474 | if depdata != fnid: | 474 | if depdata != fnid: |
475 | tdepends_fnid[fnid].add(taskid) | 475 | tdepends_fnid[fnid].add(taskid) |
476 | irdepends = taskData.tasks_irdepends[task] | 476 | irdepends = taskData.tasks_irdepends[task] |
@@ -482,7 +482,7 @@ class RunQueueData: | |||
482 | taskid = taskData.gettask_id_fromfnid(depdata, idependtask) | 482 | taskid = taskData.gettask_id_fromfnid(depdata, idependtask) |
483 | if taskid is None: | 483 | if taskid is None: |
484 | bb.msg.fatal("RunQueue", "Task %s in %s rdepends upon non-existent task %s in %s" % (taskData.tasks_name[task], fn, idependtask, dep)) | 484 | bb.msg.fatal("RunQueue", "Task %s in %s rdepends upon non-existent task %s in %s" % (taskData.tasks_name[task], fn, idependtask, dep)) |
485 | depends.append(taskid) | 485 | depends.add(taskid) |
486 | if depdata != fnid: | 486 | if depdata != fnid: |
487 | tdepends_fnid[fnid].add(taskid) | 487 | tdepends_fnid[fnid].add(taskid) |
488 | 488 | ||
@@ -499,16 +499,12 @@ class RunQueueData: | |||
499 | 499 | ||
500 | # Rmove all self references | 500 | # Rmove all self references |
501 | if task in depends: | 501 | if task in depends: |
502 | newdep = [] | ||
503 | logger.debug(2, "Task %s (%s %s) contains self reference! %s", task, taskData.fn_index[taskData.tasks_fnid[task]], taskData.tasks_name[task], depends) | 502 | logger.debug(2, "Task %s (%s %s) contains self reference! %s", task, taskData.fn_index[taskData.tasks_fnid[task]], taskData.tasks_name[task], depends) |
504 | for dep in depends: | 503 | depends.remove(task) |
505 | if task != dep: | ||
506 | newdep.append(dep) | ||
507 | depends = newdep | ||
508 | 504 | ||
509 | self.runq_fnid.append(taskData.tasks_fnid[task]) | 505 | self.runq_fnid.append(taskData.tasks_fnid[task]) |
510 | self.runq_task.append(taskData.tasks_name[task]) | 506 | self.runq_task.append(taskData.tasks_name[task]) |
511 | self.runq_depends.append(set(depends)) | 507 | self.runq_depends.append(depends) |
512 | self.runq_revdeps.append(set()) | 508 | self.runq_revdeps.append(set()) |
513 | self.runq_hash.append("") | 509 | self.runq_hash.append("") |
514 | 510 | ||