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 <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joshua Lock 2011-07-25 20:32:53 -07:00 committed by Richard Purdie
parent 052f04e460
commit 6b109860bf
1 changed files with 22 additions and 3 deletions

View File

@ -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.