summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2011-07-12 14:48:59 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-07-13 12:29:17 +0100
commit80441de058f016b4fbf35ed1ea6b15457916ebae (patch)
tree6d2f61387072b3138a25c2cf96ef83fb5474a521
parente5c961714c9555de1a3ad3f49c4dd6d57ec079b9 (diff)
downloadpoky-80441de058f016b4fbf35ed1ea6b15457916ebae.tar.gz
poky-80441de058f016b4fbf35ed1ea6b15457916ebae.tar.bz2
poky-80441de058f016b4fbf35ed1ea6b15457916ebae.zip
ui/crumbs/tasklistmodel: fix automatic removal of orphaned items
The sweep_up() method intends to remove all packages with an empty brought in by column, this patch changes the implementation to be more reliable. Each time a removal is triggered we begin interating the contents model again at the beginning, only once the contents model has been iterated from start to finish without any removals can we be certain that there will be no more orphaned items. Fixes [YOCTO #1218] (Bitbake rev: 4803c6d3d1db31105d98a7f71596875333db0dc5) Signed-off-by: Joshua Lock <josh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/ui/crumbs/tasklistmodel.py34
1 files changed, 19 insertions, 15 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/tasklistmodel.py b/bitbake/lib/bb/ui/crumbs/tasklistmodel.py
index 3e74e7fd32..633931dac6 100644
--- a/bitbake/lib/bb/ui/crumbs/tasklistmodel.py
+++ b/bitbake/lib/bb/ui/crumbs/tasklistmodel.py
@@ -327,24 +327,28 @@ class TaskListModel(gtk.ListStore):
If the item isn't a package we leave it included.
"""
def sweep_up(self):
- model = self.contents
- removals = []
it = self.contents.get_iter_first()
-
- while it:
- binb = model.get_value(it, self.COL_BINB)
- itype = model.get_value(it, self.COL_TYPE)
+ while it:
+ binb = self.contents.get_value(it, self.COL_BINB)
+ itype = self.contents.get_value(it, self.COL_TYPE)
+ remove = False
if itype == 'package' and not binb:
- opath = model.convert_path_to_child_path(model.get_path(it))
- if not opath in removals:
- removals.extend(opath)
-
- it = model.iter_next(it)
-
- while removals:
- path = removals.pop()
- self.mark(path)
+ oit = self.contents.convert_iter_to_child_iter(it)
+ opath = self.get_path(oit)
+ self.mark(opath)
+ remove = True
+
+ # When we remove a package from the contents model we alter the
+ # model, so continuing to iterate is bad. *Furthermore* it's
+ # likely that the removal has affected an already iterated item
+ # so we should start from the beginning anyway.
+ # Only when we've managed to iterate the entire contents model
+ # without removing any items do we allow the loop to exit.
+ if remove:
+ it = self.contents.get_iter_first()
+ else:
+ it = self.contents.iter_next(it)
"""
Find the name of an item in the image contents which depends on the item