diff options
| author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-08-17 12:12:16 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-08-19 18:05:44 +0100 |
| commit | 715d857174ceca82b85d6c8c7df520047ba7fb0c (patch) | |
| tree | 363aac81a06b013471f1dede8ba4c0dc7d8bbe92 /bitbake/lib/bb/taskdata.py | |
| parent | 22a653d02880c35d3c9d04811c31aabdf1e69951 (diff) | |
| download | poky-715d857174ceca82b85d6c8c7df520047ba7fb0c.tar.gz | |
bitbake: Fix default function parameter assignment to a list
With python you should not assign a list as the default value of a
function parameter - because a list is mutable, the result will be that
the first time a value is passed it will actually modify the default.
Reference:
http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments
(Bitbake rev: 7859f7388f2e3f675d0e1527cfde18625f36f637)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/taskdata.py')
| -rw-r--r-- | bitbake/lib/bb/taskdata.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py index ca58e17922..5fab7043cc 100644 --- a/bitbake/lib/bb/taskdata.py +++ b/bitbake/lib/bb/taskdata.py | |||
| @@ -514,7 +514,7 @@ class TaskData: | |||
| 514 | self.add_runtime_target(fn, item) | 514 | self.add_runtime_target(fn, item) |
| 515 | self.add_tasks(fn, dataCache) | 515 | self.add_tasks(fn, dataCache) |
| 516 | 516 | ||
| 517 | def fail_fnid(self, fnid, missing_list = []): | 517 | def fail_fnid(self, fnid, missing_list=None): |
| 518 | """ | 518 | """ |
| 519 | Mark a file as failed (unbuildable) | 519 | Mark a file as failed (unbuildable) |
| 520 | Remove any references from build and runtime provider lists | 520 | Remove any references from build and runtime provider lists |
| @@ -523,6 +523,8 @@ class TaskData: | |||
| 523 | """ | 523 | """ |
| 524 | if fnid in self.failed_fnids: | 524 | if fnid in self.failed_fnids: |
| 525 | return | 525 | return |
| 526 | if not missing_list: | ||
| 527 | missing_list = [] | ||
| 526 | logger.debug(1, "File '%s' is unbuildable, removing...", self.fn_index[fnid]) | 528 | logger.debug(1, "File '%s' is unbuildable, removing...", self.fn_index[fnid]) |
| 527 | self.failed_fnids.append(fnid) | 529 | self.failed_fnids.append(fnid) |
| 528 | for target in self.build_targets: | 530 | for target in self.build_targets: |
| @@ -536,7 +538,7 @@ class TaskData: | |||
| 536 | if len(self.run_targets[target]) == 0: | 538 | if len(self.run_targets[target]) == 0: |
| 537 | self.remove_runtarget(target, missing_list) | 539 | self.remove_runtarget(target, missing_list) |
| 538 | 540 | ||
| 539 | def remove_buildtarget(self, targetid, missing_list = []): | 541 | def remove_buildtarget(self, targetid, missing_list=None): |
| 540 | """ | 542 | """ |
| 541 | Mark a build target as failed (unbuildable) | 543 | Mark a build target as failed (unbuildable) |
| 542 | Trigger removal of any files that have this as a dependency | 544 | Trigger removal of any files that have this as a dependency |
| @@ -561,7 +563,7 @@ class TaskData: | |||
| 561 | logger.error("Required build target '%s' has no buildable providers.\nMissing or unbuildable dependency chain was: %s", target, missing_list) | 563 | logger.error("Required build target '%s' has no buildable providers.\nMissing or unbuildable dependency chain was: %s", target, missing_list) |
| 562 | raise bb.providers.NoProvider(target) | 564 | raise bb.providers.NoProvider(target) |
| 563 | 565 | ||
| 564 | def remove_runtarget(self, targetid, missing_list = []): | 566 | def remove_runtarget(self, targetid, missing_list=None): |
| 565 | """ | 567 | """ |
| 566 | Mark a run target as failed (unbuildable) | 568 | Mark a run target as failed (unbuildable) |
| 567 | Trigger removal of any files that have this as a dependency | 569 | Trigger removal of any files that have this as a dependency |
