summaryrefslogtreecommitdiff
path: root/portato/backend
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/backend/portage/sets.py17
-rw-r--r--portato/backend/portage/system_22.py18
2 files changed, 35 insertions, 0 deletions
diff --git a/portato/backend/portage/sets.py b/portato/backend/portage/sets.py
index 2305c85..7984d3d 100644
--- a/portato/backend/portage/sets.py
+++ b/portato/backend/portage/sets.py
@@ -14,7 +14,14 @@ from __future__ import absolute_import, with_statement
import re
+import portage
+try:
+ import portage.dep as portage_dep
+except ImportError:
+ import portage_dep
+
from .. import system
+from ...helper import debug
class Set(object):
@@ -57,6 +64,15 @@ class FilterSet (Set):
return t
+class PortageSet (FilterSet):
+ def __init__ (self, name):
+ FilterSet.__init__(self)
+ debug("Loading portage set '%s'", name)
+ self.portageSet = system.settings.setsconfig.getSets()[name]
+
+ def get_list(self):
+ return self.portageSet.getAtoms()
+
class SystemSet (FilterSet):
def get_list(self):
@@ -126,3 +142,4 @@ class UninstalledSet (Set):
def find (self, *args, **kwargs):
return self.all.find(*args, **kwargs) - self.installed.find(*args, **kwargs)
+
diff --git a/portato/backend/portage/system_22.py b/portato/backend/portage/system_22.py
index 289849c..18e3b4e 100644
--- a/portato/backend/portage/system_22.py
+++ b/portato/backend/portage/system_22.py
@@ -20,6 +20,7 @@ from collections import defaultdict
from .package_22 import PortagePackage_22
from .settings_22 import PortageSettings_22
from .system import PortageSystem
+from . import sets as syssets
class PortageSystem_22 (PortageSystem):
@@ -30,6 +31,13 @@ class PortageSystem_22 (PortageSystem):
self.use_descs = {}
self.local_use_descs = defaultdict(dict)
+ self.setmap = {
+ self.SET_ALL : syssets.AllSet,
+ self.SET_INSTALLED : syssets.InstalledSet,
+ self.SET_UNINSTALLED : syssets.UninstalledSet,
+ self.SET_TREE : syssets.TreeSet
+ }
+
def has_set_support (self):
return True
@@ -39,5 +47,15 @@ class PortageSystem_22 (PortageSystem):
else:
return tuple(self.settings.setsconfig.getSets())
+ def _get_set (self, pkgSet):
+ pkgSet = pkgSet.lower()
+ if pkgSet == "": pkgSet = self.SET_ALL
+
+ s = self.setmap.get(pkgSet, None)
+ if s is None:
+ return syssets.PortageSet(pkgSet)
+ else:
+ return s()
+
def new_package (self, cpv):
return PortagePackage_22(cpv)