From 6b109860bfa093b7f1fe7ddae2e60595d070735b Mon Sep 17 00:00:00 2001 From: Joshua Lock Date: Mon, 25 Jul 2011 20:32:53 -0700 Subject: ui/crumbs/tasklistmodel: work around overly aggressive package removal The mark() method, which removes dependent and rdependent items, is overly aggressive removing items which are actually required by user selected items and then causing a removal of those items. Because the data structures used are not fine grained enough to do more intelligent dependency tracking the simplest "fix" is to track removals which are marked as "User Selected" and re-add those (and therefore their dependencies) once the aggressive removal is completed. Because the aggressive removal already ignores images and tasks this should make the removal behave as expected though certainly leaves area for improvement in future. Fixes [YOCTO #1280]. (Bitbake rev: 1e1055262450de994202fc3e5943b8b19f628681) Signed-off-by: Joshua Lock Signed-off-by: Richard Purdie --- bitbake/lib/bb/ui/crumbs/tasklistmodel.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/bitbake/lib/bb/ui/crumbs/tasklistmodel.py b/bitbake/lib/bb/ui/crumbs/tasklistmodel.py index ee6ebf8754..d7dff3c053 100644 --- a/bitbake/lib/bb/ui/crumbs/tasklistmodel.py +++ b/bitbake/lib/bb/ui/crumbs/tasklistmodel.py @@ -306,11 +306,15 @@ class TaskListModel(gtk.ListStore): self[path][self.COL_INC] = False """ - recursively called to mark the item at opath and any package which - depends on it for removal + Recursively called to mark the item at opath and any package which + depends on it for removal. + NOTE: This method dumbly removes user selected packages and since we don't + do significant reverse dependency tracking it's easier and simpler to save + the items marked as user selected and re-add them once the removal sweep is + complete. """ def mark(self, opath): - removals = [] + usersel = {} it = self.get_iter_first() name = self[opath][self.COL_NAME] @@ -325,19 +329,34 @@ class TaskListModel(gtk.ListStore): deps = self[path][self.COL_DEPS] binb = self[path][self.COL_BINB] itype = self[path][self.COL_TYPE] + iname = self[path][self.COL_NAME] # We ignore anything that isn't a package if not itype == "package": continue + # If the user added this item and it's not the item we're removing + # we should keep it and its dependencies, the easiest way to do so + # is to save its name and re-mark it for inclusion once dependency + # processing is complete + if binb == "User Selected": + usersel[iname] = self[path][self.COL_IMG] + # FIXME: need to ensure partial name matching doesn't happen if inc and deps.count(name): # found a dependency, remove it self.mark(path) + if inc and binb.count(name): bib = self.find_alt_dependency(name) self[path][self.COL_BINB] = bib + # Re-add any removed user selected items + for u in usersel: + npath = self.find_path_for_item(u) + self.include_item(item_path=npath, + binb="User Selected", + image_contents=usersel[u]) """ Remove items from contents if the have an empty COL_BINB (brought in by) caused by all packages they are a dependency of being removed. -- cgit v1.2.3-54-g00ecf