diff options
Diffstat (limited to 'portato/backend/portage')
-rw-r--r-- | portato/backend/portage/__init__.py | 2 | ||||
-rw-r--r-- | portato/backend/portage/package.py | 16 | ||||
-rw-r--r-- | portato/backend/portage/package_22.py | 2 | ||||
-rw-r--r-- | portato/backend/portage/sets.py | 4 | ||||
-rw-r--r-- | portato/backend/portage/settings.py | 2 | ||||
-rw-r--r-- | portato/backend/portage/settings_22.py | 2 | ||||
-rw-r--r-- | portato/backend/portage/system.py | 32 | ||||
-rw-r--r-- | portato/backend/portage/system_22.py | 10 |
8 files changed, 37 insertions, 33 deletions
diff --git a/portato/backend/portage/__init__.py b/portato/backend/portage/__init__.py index 1daf51b..e559f9e 100644 --- a/portato/backend/portage/__init__.py +++ b/portato/backend/portage/__init__.py @@ -3,7 +3,7 @@ # File: portato/backend/portage/__init__.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py index 2b40e41..b34e3ef 100644 --- a/portato/backend/portage/package.py +++ b/portato/backend/portage/package.py @@ -3,7 +3,7 @@ # File: portato/backend/portage/package.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -294,18 +294,8 @@ class PortagePackage (Package): return self.get_package_settings("USE", installed = True).split() else: return [] - def compare_version(self,other): - v1 = self._scpv - v2 = portage.catpkgsplit(other.get_cpv()) - # if category is different - if v1[0] != v2[0]: - return cmp(v1[0],v2[0]) - # if name is different - elif v1[1] != v2[1]: - return cmp(v1[1],v2[1]) - # Compare versions - else: - return portage.pkgcmp(v1[1:],v2[1:]) + def __cmp__ (self, other): + return system.compare_versions(self.get_cpv(), other.get_cpv()) def matches (self, criterion): # cpv_matches needs explicit slot info diff --git a/portato/backend/portage/package_22.py b/portato/backend/portage/package_22.py index ed804ce..23e8ed5 100644 --- a/portato/backend/portage/package_22.py +++ b/portato/backend/portage/package_22.py @@ -3,7 +3,7 @@ # File: portato/backend/portage/package_22.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/portato/backend/portage/sets.py b/portato/backend/portage/sets.py index 234047b..c1971b7 100644 --- a/portato/backend/portage/sets.py +++ b/portato/backend/portage/sets.py @@ -3,7 +3,7 @@ # File: portato/backend/portage/sets.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -102,7 +102,7 @@ class InstalledSet (Set): else: t = system.settings.vartree.dbapi.match(key) if not with_version: - t = itt.imap(portage.dep.dep_getkey, t) + t = itt.imap(portage.cpv_getkey, t) return set(t) diff --git a/portato/backend/portage/settings.py b/portato/backend/portage/settings.py index 8211f3b..2f3b780 100644 --- a/portato/backend/portage/settings.py +++ b/portato/backend/portage/settings.py @@ -3,7 +3,7 @@ # File: portato/backend/portage/settings.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/portato/backend/portage/settings_22.py b/portato/backend/portage/settings_22.py index bae3424..ba4f1e8 100644 --- a/portato/backend/portage/settings_22.py +++ b/portato/backend/portage/settings_22.py @@ -3,7 +3,7 @@ # File: portato/backend/portage/settings_22.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py index d7c7806..3aaa060 100644 --- a/portato/backend/portage/system.py +++ b/portato/backend/portage/system.py @@ -3,7 +3,7 @@ # File: portato/backend/portage/system.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -68,7 +68,12 @@ class PortageSystem (SystemInterface): return PortagePackage(cpv) def get_config_path (self): - return portage.USER_CONFIG_PATH + path = portage.USER_CONFIG_PATH + + if path[0] != "/": + return os.path.join(self.settings.settings["ROOT"], path) + else: + return path def get_merge_command (self): return ["/usr/bin/python", "/usr/bin/emerge"] @@ -120,6 +125,20 @@ class PortageSystem (SystemInterface): else: return True + def compare_versions(self, v1, v2): + v1 = self.split_cpv(v1) + v2 = self.split_cpv(v2) + + # if category is different + if v1[0] != v2[0]: + return cmp(v1[0],v2[0]) + # if name is different + elif v1[1] != v2[1]: + return cmp(v1[1],v2[1]) + # Compare versions + else: + return portage.pkgcmp(v1[1:],v2[1:]) + def with_bdeps(self): """Returns whether the "--with-bdeps" option is set to true. @@ -218,8 +237,11 @@ class PortageSystem (SystemInterface): cpv = portage.dep_getcpv(cpv) return portage.catpkgsplit(cpv) - def sort_package_list(self, pkglist): - pkglist.sort(PortagePackage.compare_version) # XXX: waaah ... direct package naming... =/ + def sort_package_list(self, pkglist, only_cpv = False): + if only_cpv: + pkglist.sort(self.compare_versions) + else: + pkglist.sort() return pkglist def reload_settings (self): @@ -240,7 +262,7 @@ class PortageSystem (SystemInterface): if not best: return - if not best.is_installed() and (best.is_masked() or best.is_testing(True)): # check to not update unnecessairily + if not best.is_installed() and (best.is_masked() or best.is_testing(True)): # check to not update unnecessarily for i in inst: if i.matches(crit): debug("The installed %s matches %s. Discarding upgrade to masked version %s.", i.get_cpv(), crit, best.get_version()) diff --git a/portato/backend/portage/system_22.py b/portato/backend/portage/system_22.py index f69e15c..c3bfa5f 100644 --- a/portato/backend/portage/system_22.py +++ b/portato/backend/portage/system_22.py @@ -3,7 +3,7 @@ # File: portato/backend/portage/system_22.py # This file is part of the Portato-Project, a graphical portage-frontend. # -# Copyright (C) 2006-2009 René 'Necoro' Neumann +# Copyright (C) 2006-2010 René 'Necoro' Neumann # This is free software. You may redistribute copies of it under the terms of # the GNU General Public License version 2. # There is NO WARRANTY, to the extent permitted by law. @@ -63,11 +63,3 @@ class PortageSystem_22 (PortageSystem): def new_package (self, cpv): return PortagePackage_22(cpv) - - def get_config_path (self): - path = PortageSystem.get_config_path(self) - - if path[0] != "/": - return os.path.join(self.settings.settings["ROOT"], path) - else: - return path |