diff options
-rw-r--r-- | portato/backend/portage/system.py | 14 | ||||
-rw-r--r-- | portato/backend/portage/system_22.py | 7 | ||||
-rw-r--r-- | portato/gui/windows/main.py | 8 | ||||
-rw-r--r-- | portato/gui/windows/preference.py | 2 |
4 files changed, 22 insertions, 9 deletions
diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py index 229bcc9..246f20c 100644 --- a/portato/backend/portage/system.py +++ b/portato/backend/portage/system.py @@ -20,6 +20,7 @@ except ImportError: import portage_dep from collections import defaultdict +import itertools as itt from . import VERSION from .package import PortagePackage @@ -45,8 +46,11 @@ class PortageSystem (SystemInterface): def has_set_support (self): return False - def get_sets (self): - return (("world", "The world set."), ("system", "The system set.")) + def get_sets (self, description = False): + if description: + return (("world", "The world set."), ("system", "The system set.")) + else: + return ("world", "system") def get_version (self): return "Portage %s" % portage.VERSION @@ -342,9 +346,9 @@ class PortageSystem (SystemInterface): packages = [x for x in packages if x is not None and not x.is_installed()] return packages - def update_world (self, newuse = False, deep = False): - packages = self.find_packages(pkgSet="world", with_version = False) - packages.extend(self.find_packages(pkgSet = "system", with_version = False)) + def update_world (self, sets = ("world", "system"), newuse = False, deep = False): + packages = set() + map(packages.add, itt.chain(*(self.find_packages(pkgSet = s, with_version = False) for s in sets))) states = [(["RDEPEND", "PDEPEND"], True)] if self.with_bdeps(): diff --git a/portato/backend/portage/system_22.py b/portato/backend/portage/system_22.py index 88d968b..289849c 100644 --- a/portato/backend/portage/system_22.py +++ b/portato/backend/portage/system_22.py @@ -33,8 +33,11 @@ class PortageSystem_22 (PortageSystem): def has_set_support (self): return True - def get_sets (self): - return ((name, set.description) for name, set in self.settings.setsconfig.getSets().iteritems()) + def get_sets (self, description = False): + if description: + return ((name, set.description) for name, set in self.settings.setsconfig.getSets().iteritems()) + else: + return tuple(self.settings.setsconfig.getSets()) def new_package (self, cpv): return PortagePackage_22(cpv) diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 364810d..8f456d9 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -1422,7 +1422,13 @@ class MainWindow (Window): watch = gtk.gdk.Cursor(gtk.gdk.WATCH) self.window.window.set_cursor(watch) try: - updating = system.update_world(newuse = self.cfg.get_boolean("newuse"), deep = self.cfg.get_boolean("deep")) + sets = ("world", "system") # default + if system.has_set_support(): + confsets = [x.strip() for x in self.cfg.get("updatesets").split(",")] + syssets = system.get_sets() + sets = [s for s in confsets if s in syssets] + + updating = system.update_world(sets = sets, newuse = self.cfg.get_boolean("newuse"), deep = self.cfg.get_boolean("deep")) debug("updating list: %s --> length: %s", [(x.get_cpv(), y.get_cpv()) for x,y in updating], len(updating)) gobject.idle_add(cb_idle_append, updating) finally: diff --git a/portato/gui/windows/preference.py b/portato/gui/windows/preference.py index ae95cc5..8aabbba 100644 --- a/portato/gui/windows/preference.py +++ b/portato/gui/windows/preference.py @@ -177,7 +177,7 @@ class PreferenceWindow (AbstractDialog): enabled = [x.strip() for x in self.cfg.get("updatesets").split(",")] - for set, descr in system.get_sets(): + for set, descr in system.get_sets(description = True): store.append([set in enabled, "<i>%s</i>" % set, descr, set]) tCell = gtk.CellRendererToggle() |