summaryrefslogtreecommitdiff
path: root/portato/backend
diff options
context:
space:
mode:
Diffstat (limited to 'portato/backend')
-rw-r--r--portato/backend/package.py6
-rw-r--r--portato/backend/portage/package.py22
-rw-r--r--portato/backend/portage/system.py12
3 files changed, 31 insertions, 9 deletions
diff --git a/portato/backend/package.py b/portato/backend/package.py
index 4d84e90..8df7dae 100644
--- a/portato/backend/package.py
+++ b/portato/backend/package.py
@@ -95,7 +95,7 @@ class Package (_Package):
@return: list of flags
@rtype: string[]"""
- i_flags = self.get_global_settings("USE").split()
+ i_flags = self.get_global_settings("USE", installed = False).split()
for f in self.get_new_use_flags():
if f[0] == '-':
@@ -311,11 +311,13 @@ class Package (_Package):
raise NotImplementedError
- def get_global_settings(self, key):
+ def get_global_settings(self, key, installed = True):
"""Returns the value of a global setting, i.e. ARCH, USE, ROOT, DISTDIR etc.
@param key: the setting to return
@type key: string
+ @param installed: get the installed settings or the ebuild settings
+ @type installed: boolean
@returns: the value of this setting
@rtype: string"""
diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py
index bc157cf..0c8e5f1 100644
--- a/portato/backend/portage/package.py
+++ b/portato/backend/portage/package.py
@@ -35,13 +35,14 @@ class PortagePackage (Package):
Package.__init__(self, cpv)
self._settings = system.settings
self._settingslock = system.settings.settingslock
+ self._settings_installed = None
self._trees = system.settings.trees
self.forced_flags = set()
with self._settingslock:
- self._settings.settings.setcpv(self._cpv)
+ self._init_settings(True)
self.forced_flags.update(self._settings.settings.usemask)
self.forced_flags.update(self._settings.settings.useforce)
@@ -52,6 +53,21 @@ class PortagePackage (Package):
if self._status and len(self._status) == 1 and self._status[0] == "corrupted":
self._status = None
+
+ def _init_settings (self, installed):
+ inst = installed and self.is_installed()
+
+ if self._settings_installed is not None and self._settings_installed != inst:
+ self._settings.settings.reset()
+
+ self._settings_installed = inst
+
+ if inst:
+ dbapi = self._settings.vartree.dbapi
+ else:
+ dbapi = self._settings.porttree.dbapi
+
+ self._settings.settings.setcpv(self.get_cpv(), mydb = dbapi)
def is_installed(self):
return self._settings.vartree.dbapi.cpv_exists(self._cpv)
@@ -237,9 +253,9 @@ class PortagePackage (Package):
return dep_pkgs
- def get_global_settings(self, key):
+ def get_global_settings(self, key, installed = True):
with self._settingslock:
- self._settings.settings.setcpv(self._cpv)
+ self._init_settings(installed)
v = self._settings.settings[key]
return v
diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py
index d4f4aef..77004a7 100644
--- a/portato/backend/portage/system.py
+++ b/portato/backend/portage/system.py
@@ -368,14 +368,14 @@ class PortageSystem (SystemInterface):
# append system packages
packages.extend(unique_array([p.get_cp() for p in self.find_all_system_packages()]))
- states = [(["RDEPEND","PDEPEND"],True), (["DEPEND"], False)]
+ states = [(["RDEPEND","PDEPEND"],True)]#, (["DEPEND"], False)]
if self.with_bdeps():
states[1] = (["DEPEND"], True)
checked = []
updating = []
raw_checked = {}
- def check (p, add_not_installed = True):
+ def check (p, add_not_installed = True, prev_appended = False):
"""Checks whether a package is updated or not."""
if p.get_slot_cp() in checked:
@@ -426,7 +426,11 @@ class PortageSystem (SystemInterface):
appended = True
if deep or tempDeep:
- for state in states:
+ if (appended or prev_appended) and len(states) < 2:
+ real_states = states + [("DEPEND", False)]
+ else:
+ real_states = states
+ for state in real_states:
for i in p.get_matched_dep_packages(state[0]):
if i not in raw_checked or raw_checked[i] == False:
raw_checked.update({i : state[1]})
@@ -436,7 +440,7 @@ class PortageSystem (SystemInterface):
else:
for pkg in bm:
if not pkg: continue
- check(pkg, state[1])
+ check(pkg, state[1], appended)
for p in self.get_new_packages(packages):
if not p: continue # if a masked package is installed we have "None" here