summaryrefslogtreecommitdiff
path: root/portato/backend
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/backend/flags.py17
-rw-r--r--portato/backend/package.py26
-rw-r--r--portato/backend/portage/package.py22
-rw-r--r--portato/backend/portage/system.py18
4 files changed, 45 insertions, 38 deletions
diff --git a/portato/backend/flags.py b/portato/backend/flags.py
index b9fcae2..61d27aa 100644
--- a/portato/backend/flags.py
+++ b/portato/backend/flags.py
@@ -213,6 +213,23 @@ def sort_use_flag_list (flaglist):
flaglist.sort(key = flag_key)
return flaglist
+def filter_defaults (flaglist):
+ """
+ Removes "+" and "-" from IUSE defaults.
+
+ @param flaglist: the list of useflags
+ @type flaglist: string<iterator>
+
+ @returns: the "cleaned" list
+ @rtype: string<iterator>
+ """
+
+ for flag in flaglist:
+ if flag.startswith(("+","-")):
+ yield flag[1:]
+ else:
+ yield flag
+
def set_use_flag (pkg, flag):
"""Sets the useflag for a given package.
diff --git a/portato/backend/package.py b/portato/backend/package.py
index 16cee0e..da44e8a 100644
--- a/portato/backend/package.py
+++ b/portato/backend/package.py
@@ -68,20 +68,6 @@ class Package (_Package):
return flags.is_locally_masked(self)
- def get_installed_use_flags (self):
- """Returns a list of the useflags enabled at installation time. If package is not installed, it returns an empty list.
-
- @returns: list of useflags enabled at installation time or an empty list
- @rtype: string[]"""
-
- if self.is_installed():
- uses = set(self.get_use_flags().split()) # all set at installation time
- iuses = set(self.get_iuse_flags(installed=True)) # all you can set for the package
-
- return list(uses.intersection(iuses))
- else:
- return []
-
def get_new_use_flags (self):
"""Returns a list of the new useflags, i.e. these flags which are not written to the portage-system yet.
@@ -276,13 +262,13 @@ class Package (_Package):
@returns: the reason for masking the package
@rtype: string"""
- def get_iuse_flags (self, installed = False, keep = False):
+ def get_iuse_flags (self, installed = False, removeForced = True):
"""Returns a list of _all_ useflags for this package, i.e. all useflags you can set for this package.
@param installed: do not take the ones stated in the ebuild, but the ones it has been installed with
@type installed: boolean
- @param keep: keep the "+" or "-" signs for forced flags
- @type keep: boolean
+ @param removeForced: remove forced flags (i.e. usemask / useforce) from the iuse flags as they cannot be set from the user
+ @type removeForced: boolean
@returns: list of use-flags
@rtype: string[]"""
@@ -360,11 +346,11 @@ class Package (_Package):
raise NotImplementedError
- def get_use_flags(self):
+ def get_installed_use_flags(self):
"""Returns _all_ (not only the package-specific) useflags which were set at the installation time of the package.
- @returns: string holding all useflags
- @rtype: string"""
+ @returns: list of use flags
+ @rtype: string[]"""
raise NotImplementedError
diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py
index 42badbe..4760acb 100644
--- a/portato/backend/portage/package.py
+++ b/portato/backend/portage/package.py
@@ -146,21 +146,21 @@ class PortagePackage (Package):
else:
return reason
- def get_iuse_flags (self, installed = False, keep = False):
+ def get_iuse_flags (self, installed = False, removeForced = True):
if installed or not self.is_in_system():
tree = self._settings.vartree
else:
tree = self._settings.porttree
- flags = self.get_package_settings("IUSE", tree = tree).split()
+ iuse = flags.filter_defaults(self.get_package_settings("IUSE", tree = tree).split())
- if not keep: # remove "+"/"-"
- for ctr, f in enumerate(flags):
- if f.startswith(("+","-")):
- flags[ctr] = f[1:]
-
- return list(set(flags).difference(self.forced_flags))
+ iuse = set(iuse)
+ if removeForced:
+ return list(iuse.difference(self.forced_flags))
+ else:
+ return list(iuse)
+
def get_matched_dep_packages (self, depvar):
# change the useflags, because we have internally changed some, but not made them visible for portage
actual = self.get_actual_use_flags()
@@ -281,10 +281,10 @@ class PortagePackage (Package):
return r[0]
- def get_use_flags(self):
+ def get_installed_use_flags(self):
if self.is_installed():
- return self.get_package_settings("USE", tree = self._settings.vartree)
- else: return ""
+ return self.get_package_settings("USE", tree = self._settings.vartree).split()
+ else: return []
def compare_version(self,other):
v1 = self._scpv
diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py
index a1ac90c..e2a00cb 100644
--- a/portato/backend/portage/system.py
+++ b/portato/backend/portage/system.py
@@ -370,9 +370,9 @@ 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"], True)]
if self.with_bdeps():
- states[1] = (["DEPEND"], True)
+ states.append((["DEPEND"], True))
checked = []
updating = []
@@ -413,15 +413,19 @@ class PortageSystem (SystemInterface):
new_iuse = set(p.get_iuse_flags(installed = False)) # IUSE in the ebuild
old_iuse = set(p.get_iuse_flags(installed = True)) # IUSE in the vardb
+
+ # add forced flags, as they might trigger a rebuild
+ new_iuse_f = set(p.get_iuse_flags(installed = False, removeForced = False))
+ old_iuse_f = set(p.get_iuse_flags(installed = True, removeForced = False))
- if new_iuse.symmetric_difference(old_iuse): # difference between new_iuse and old_iuse
+ if new_iuse.symmetric_difference(old_iuse): # difference between IUSE (w/o forced)
tempDeep = True
if not appended:
updating.append((p,p))
appended = True
- else:
- if new_iuse.intersection(p.get_actual_use_flags()).symmetric_difference(p.get_installed_use_flags()):
+ else: # check for difference between the _set_ useflags (w/ forced)
+ if new_iuse_f.intersection(p.get_actual_use_flags()).symmetric_difference(old_iuse_f.intersection(p.get_installed_use_flags())):
tempDeep = True
if not appended:
updating.append((p,p))
@@ -429,7 +433,7 @@ class PortageSystem (SystemInterface):
if deep or tempDeep:
if (appended or prev_appended) and len(states) < 2:
- real_states = states + [("DEPEND", False)]
+ real_states = states + [("PDEPEND", True), ("DEPEND", False)]
else:
real_states = states
for state in real_states:
@@ -442,7 +446,7 @@ class PortageSystem (SystemInterface):
else:
for pkg in bm:
if not pkg: continue
- check(pkg, state[1], appended)
+ check(pkg, state[1], appended) # XXX: should be 'or'ed with prev_appended?
for p in self.get_new_packages(packages):
if not p: continue # if a masked package is installed we have "None" here