From 09f790063e70515fbcb828676f639740b1c67885 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Wed, 9 Jul 2008 21:49:33 +0200 Subject: Make update_world set compatible --- portato/gui/windows/main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'portato/gui/windows/main.py') 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: -- cgit v1.2.3-54-g00ecf From 01fa05da0d80aab1aa1526a5302b3a798d0f0179 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Wed, 9 Jul 2008 22:00:49 +0200 Subject: Renamed generic package sets --- portato/backend/portage/package.py | 2 +- portato/backend/portage/system.py | 30 +++++++++++++++--------------- portato/backend/system_interface.py | 7 ++++++- portato/gui/queue.py | 4 ++-- portato/gui/utils.py | 2 +- portato/gui/windows/main.py | 2 +- 6 files changed, 26 insertions(+), 21 deletions(-) (limited to 'portato/gui/windows/main.py') diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py index 78125ee..351b7e0 100644 --- a/portato/backend/portage/package.py +++ b/portato/backend/portage/package.py @@ -226,7 +226,7 @@ class PortagePackage (Package): for dep in deps: if dep[0] == '!': # blocking sth - blocked = system.find_packages(dep, "installed") + blocked = system.find_packages(dep, system.SET_INSTALLED) if len(blocked) == 1: # only exact one match allowed to be harmless if blocked[0].get_slot_cp() == self.get_slot_cp(): # blocks in the same slot are harmless continue diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py index 246f20c..edbb4f0 100644 --- a/portato/backend/portage/system.py +++ b/portato/backend/portage/system.py @@ -174,16 +174,16 @@ class PortageSystem (SystemInterface): t = [] if not only_installed: - pkgSet = "tree" + pkgSet = self.SET_TREE else: - pkgSet = "installed" + pkgSet = self.SET_INSTALLED t = self.find_packages(search_key, pkgSet = pkgSet, masked = masked, with_version = True, only_cpv = True) if VERSION >= (2,1,5): - t += [pkg.get_cpv() for pkg in self.find_packages(search_key, "installed") if not (pkg.is_testing(True) or pkg.is_masked())] + t += [pkg.get_cpv() for pkg in self.find_packages(search_key, self.SET_INSTALLED) if not (pkg.is_testing(True) or pkg.is_masked())] else: - t = self.find_packages(search_key, "installed", only_cpv=True) + t = self.find_packages(search_key, self.SET_INSTALLED, only_cpv=True) if t: t = unique_array(t) @@ -191,7 +191,7 @@ class PortageSystem (SystemInterface): return None - def find_packages (self, key = "", pkgSet = "all", masked = False, with_version = True, only_cpv = False): + def find_packages (self, key = "", pkgSet = SystemInterface.SET_ALL, masked = False, with_version = True, only_cpv = False): if key is None: key = "" is_regexp = key == "" or ("*" in key and key[0] not in ("*","=","<",">","~","!")) @@ -261,12 +261,12 @@ class PortageSystem (SystemInterface): yield self.find_best_match(cp, only_cpv = True) funcmap = { - "all" : all, - "installed" : installed, - "uninstalled" : uninstalled, + self.SET_ALL : all, + self.SET_INSTALLED : installed, + self.SET_UNINSTALLED : uninstalled, + self.SET_TREE : tree, "world" : world, - "system" : system, - "tree" : tree + "system" : system } pkgSet = pkgSet.lower() @@ -316,7 +316,7 @@ class PortageSystem (SystemInterface): new_packages = [] for p in packages: - inst = self.find_packages(p, "installed") + inst = self.find_packages(p, self.SET_INSTALLED) best_p = self.find_best_match(p) if best_p is None: @@ -342,7 +342,7 @@ class PortageSystem (SystemInterface): return new_packages def get_updated_packages (self): - packages = self.get_new_packages(self.find_packages(pkgSet = "installed", with_version = False)) + packages = self.get_new_packages(self.find_packages(pkgSet = self.SET_INSTALLED, with_version = False)) packages = [x for x in packages if x is not None and not x.is_installed()] return packages @@ -374,11 +374,11 @@ class PortageSystem (SystemInterface): tempDeep = False if not p.is_installed(): - oldList = self.find_packages(p.get_slot_cp(), "installed") + oldList = self.find_packages(p.get_slot_cp(), self.SET_INSTALLED) if oldList: old = oldList[0] # we should only have one package here - else it is a bug else: - oldList = self.sort_package_list(self.find_packages(p.get_cp(), "installed")) + oldList = self.sort_package_list(self.find_packages(p.get_cp(), self.SET_INSTALLED)) if not oldList: info(_("Found a not installed dependency: %s.") % p.get_cpv()) oldList = [p] @@ -428,7 +428,7 @@ class PortageSystem (SystemInterface): if not pkg: continue if not pkg.is_installed() and (pkg.is_masked() or pkg.is_testing(True)): # check to not update unnecessairily cont = False - for inst in self.find_packages(pkg.get_cp(), "installed", only_cpv = True): + for inst in self.find_packages(pkg.get_cp(), self.SET_INSTALLED, only_cpv = True): if self.cpv_matches(inst, i): debug("The installed %s matches %s. Discarding upgrade to masked version.", inst, i) cont = True diff --git a/portato/backend/system_interface.py b/portato/backend/system_interface.py index c118f6d..1cb0ed1 100644 --- a/portato/backend/system_interface.py +++ b/portato/backend/system_interface.py @@ -11,6 +11,11 @@ # Written by René 'Necoro' Neumann class SystemInterface (object): + + SET_ALL = "__portato_all__" + SET_TREE = "__portato_tree__" + SET_INSTALLED = "__portato_installed__" + SET_UNINSTALLED = "__portato_uninstalled__" def has_set_support (self): """Signals, whether this backend supports sets. @@ -90,7 +95,7 @@ class SystemInterface (object): raise NotImplementedError - def find_packages (self, key, pkgSet = "all", masked = False, with_version = True, only_cpv = False): + def find_packages (self, key, pkgSet = SET_ALL, masked = False, with_version = True, only_cpv = False): """This returns a list of packages matching the key. As key, it is allowed to use basic regexps (".*") and the normal package specs. But not a combination of them. diff --git a/portato/gui/queue.py b/portato/gui/queue.py index ce7e620..cb5b334 100644 --- a/portato/gui/queue.py +++ b/portato/gui/queue.py @@ -143,7 +143,7 @@ class EmergeQueue: try: pkg = self._get_pkg_from_cpv(cpv, unmask) if not pkg.is_installed(): - old = system.find_packages(pkg.get_slot_cp(), "installed") + old = system.find_packages(pkg.get_slot_cp(), system.SET_INSTALLED) if old: old = old[0] # assume we have only one there cmp = pkg.compare_version(old) @@ -272,7 +272,7 @@ class EmergeQueue: # get the blocks that block an installed package inst = [] for block in self.blocks[type]: - pkgs = system.find_packages(block, "installed") + pkgs = system.find_packages(block, system.SET_INSTALLED) if pkgs: inst.append((pkgs, block)) diff --git a/portato/gui/utils.py b/portato/gui/utils.py index 035d1c6..a4e1e6e 100644 --- a/portato/gui/utils.py +++ b/portato/gui/utils.py @@ -185,7 +185,7 @@ class Database (object): # get the lists packages = system.find_packages(category, with_version = False) - installed = system.find_packages(category, "installed", with_version = False) + installed = system.find_packages(category, system.SET_INSTALLED, with_version = False) # cycle through packages for p in packages: diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 8f456d9..188a5e1 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -1315,7 +1315,7 @@ class MainWindow (Window): if pkg.is_installed(): installed = set(pkg.get_iuse_flags()).intersection(pkg.get_installed_use_flags()) else: - inst = system.find_packages(pkg.get_slot_cp(), "installed") + inst = system.find_packages(pkg.get_slot_cp(), system.SET_INSTALLED) if inst: installed = set(inst[0].get_iuse_flags()).intersection(inst[0].get_installed_use_flags()) else: -- cgit v1.2.3-54-g00ecf -05 01:58:15 +0100'>2010-03-05Ignore swap files in gitRené 'Necoro' Neumann1-0/+1 2010-03-05Added some textual descriptionsRené 'Necoro' Neumann2-1/+8 2010-03-05Add description support to the databasesRené 'Necoro' Neumann4-8/+55 2010-03-04Also parse descriptions from eixRené 'Necoro' Neumann1-2/+2 2009-11-08Added Italian translation. Thanks to Ponsi.René 'Necoro' Neumann3-0/+1166 2009-10-28Changelogv0.13.10.13René 'Necoro' Neumann1-0/+4 2009-10-28Corrected config path handling.René 'Necoro' Neumann2-9/+6 2009-10-28Corrected config path handling.René 'Necoro' Neumann2-9/+6 2009-10-24Fix the segfault in GLib due to wrong encodingRené 'Necoro' Neumann1-0/+1 2009-10-24Wrong debug message in new_version pluginRené 'Necoro' Neumann1-1/+1 2009-10-24Update TRANSLATING to use gitRené 'Necoro' Neumann1-2/+15 2009-10-24Also show revision during startup and with -vRené 'Necoro' Neumann1-1/+5 2009-10-24Adding revison info to version output.René 'Necoro' Neumann3-2/+44 2009-10-23Turn new_version plugin from a mess into sth useful.René 'Necoro' Neumann2-10/+10 2009-10-23Honor branches different from masterRené 'Necoro' Neumann1-2/+4 2009-10-23Change the new_version plugin to use git.René 'Necoro' Neumann2-32/+33 2009-10-15Objectified all the functional stuff in backend.__init__.René 'Necoro' Neumann2-32/+34 2009-10-08Enhance the splash window handling.René 'Necoro' Neumann2-2/+9 2009-10-08Enhance the splash window handling.René 'Necoro' Neumann2-2/+9 2009-10-05Some more stuff to ignoreRené 'Necoro' Neumann1-0/+3 2009-10-05Renamed the ignore fileRené 'Necoro' Neumann1-0/+0 2009-10-05Update NEWSRené 'Necoro' Neumann1-0/+1 2009-10-05Also allow 'unselect all' in the PkgListRené 'Necoro' Neumann1-1/+10 2009-10-05Now have it the sorted way in PkgListsRené 'Necoro' Neumann2-3/+9 2009-10-05Enhanced system.sort_package_list to also sort CPVsRené 'Necoro' Neumann5-27/+38 2009-10-05Added an PkgList window and rewrote UpdateWindow and WorldListWindow to use itRené 'Necoro' Neumann3-39/+63 2009-10-05Add uninstall button and rename to PkgListWindowRené 'Necoro' Neumann1-2/+17 2009-10-05First quick hack to have a world listRené 'Necoro' Neumann3-2/+24