summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
Diffstat (limited to 'portato')
-rw-r--r--portato/backend/portage/package.py4
-rw-r--r--portato/backend/portage/sets.py2
-rw-r--r--portato/backend/portage/settings.py11
-rw-r--r--portato/backend/portage/system.py9
-rw-r--r--portato/backend/portage/system_22.py2
5 files changed, 19 insertions, 9 deletions
diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py
index 250b491..a87ba94 100644
--- a/portato/backend/portage/package.py
+++ b/portato/backend/portage/package.py
@@ -67,7 +67,7 @@ class PortagePackage (Package):
inst = (installed and self.is_installed()) or (self.is_installed() and not self.is_in_system())
if self._settings_installed is not None and self._settings_installed != inst:
- self._settings.settings.reset()
+ self._settings.reset()
self._settings_installed = inst
@@ -76,7 +76,7 @@ class PortagePackage (Package):
else:
dbapi = self._settings.porttree.dbapi
- self._settings.settings.setcpv(self.get_cpv(), mydb = dbapi)
+ self._settings.setcpv(self.get_cpv(), mydb = dbapi)
def get_name(self):
return self._scpv[1]
diff --git a/portato/backend/portage/sets.py b/portato/backend/portage/sets.py
index 24dd89a..4d7df73 100644
--- a/portato/backend/portage/sets.py
+++ b/portato/backend/portage/sets.py
@@ -77,7 +77,7 @@ class PortageSet (FilterSet):
class SystemSet (FilterSet):
def get_list(self):
- for cp in system.settings.settings.packages:
+ for cp in system.settings.global_settings.packages:
if cp[0] == "*": yield cp[1:]
class WorldSet (FilterSet):
diff --git a/portato/backend/portage/settings.py b/portato/backend/portage/settings.py
index 0e7eccb..951d1a4 100644
--- a/portato/backend/portage/settings.py
+++ b/portato/backend/portage/settings.py
@@ -54,5 +54,16 @@ class PortageSettings:
self.porttree = self.trees[root]["porttree"]
self.vartree = self.trees[root]["vartree"]
self.virtuals = self.trees[root]["virtuals"]
+ self.global_settings = portage.config(clone=self.settings)
+ self._cpv = None
portage.settings = None # we use our own one ...
+
+ def setcpv (self, cpv, **kwargs):
+ if self._cpv is not None and cpv != self._cpv:
+ self.settings.setcpv(cpv, **kwargs)
+ self._cpv = cpv
+
+ def reset (self):
+ self.settings.reset()
+ self._cpv = None
diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py
index a32ebd0..ddee835 100644
--- a/portato/backend/portage/system.py
+++ b/portato/backend/portage/system.py
@@ -39,7 +39,7 @@ class PortageSystem (SystemInterface):
def __init__ (self):
"""Constructor."""
self.settings = PortageSettings()
- portage.WORLD_FILE = os.path.join(self.settings.settings["ROOT"],portage.WORLD_FILE)
+ portage.WORLD_FILE = os.path.join(self.settings.global_settings["ROOT"],portage.WORLD_FILE)
self.use_descs = {}
self.local_use_descs = defaultdict(dict)
@@ -173,8 +173,7 @@ class PortageSystem (SystemInterface):
return list_of_packages
def get_global_settings (self, key):
- self.settings.settings.reset()
- return self.settings.settings[key]
+ return self.settings.global_settings[key]
def find_best (self, list, only_cpv = False):
if only_cpv:
@@ -213,7 +212,7 @@ class PortageSystem (SystemInterface):
return self.geneticize_list(self._get_set(pkgSet).find(key, masked, with_version, only_cpv), only_cpv or not with_version)
def list_categories (self, name = None):
- categories = self.settings.settings.categories
+ categories = self.settings.global_settings.categories
return filter(self.find_lambda(name), categories)
def split_cpv (self, cpv):
@@ -374,7 +373,7 @@ class PortageSystem (SystemInterface):
# fill cache if needed
if not self.use_descs and not self.local_use_descs:
- for dir in [self.settings.settings["PORTDIR"]] + self.settings.settings["PORTDIR_OVERLAY"].split():
+ for dir in [self.settings.global_settings["PORTDIR"]] + self.settings.global_settings["PORTDIR_OVERLAY"].split():
# read use.desc
try:
diff --git a/portato/backend/portage/system_22.py b/portato/backend/portage/system_22.py
index d5b605f..8ce3cd9 100644
--- a/portato/backend/portage/system_22.py
+++ b/portato/backend/portage/system_22.py
@@ -26,7 +26,7 @@ class PortageSystem_22 (PortageSystem):
def __init__ (self):
self.settings = PortageSettings_22()
- portage.WORLD_FILE = os.path.join(self.settings.settings["ROOT"],portage.WORLD_FILE)
+ portage.WORLD_FILE = os.path.join(self.settings.global_settings["ROOT"],portage.WORLD_FILE)
self.use_descs = {}
self.local_use_descs = defaultdict(dict)