diff options
Diffstat (limited to 'portato/backend')
-rw-r--r-- | portato/backend/flags.py | 3 | ||||
-rw-r--r-- | portato/backend/package.py | 49 | ||||
-rw-r--r-- | portato/backend/portage/package.py | 24 | ||||
-rw-r--r-- | portato/backend/portage/system.py | 35 |
4 files changed, 39 insertions, 72 deletions
diff --git a/portato/backend/flags.py b/portato/backend/flags.py index dd1e462..99ff56f 100644 --- a/portato/backend/flags.py +++ b/portato/backend/flags.py @@ -382,6 +382,7 @@ def write_use_flags (): # reset useFlags = {} newUseFlags = {} + system.reload_settings() ### MASKING PART ### new_masked = {} @@ -586,6 +587,7 @@ def write_masked (): # reset new_masked = {} new_unmasked = {} + system.reload_settings() ### TESTING PART ### newTesting = {} @@ -704,3 +706,4 @@ def write_testing (): f.close() # reset newTesting = {} + system.reload_settings() diff --git a/portato/backend/package.py b/portato/backend/package.py index ef0be11..343dc51 100644 --- a/portato/backend/package.py +++ b/portato/backend/package.py @@ -74,7 +74,7 @@ class Package (object): if self.is_installed(): uses = set(self.get_use_flags().split()) # all set at installation time - iuses = set(self.get_all_use_flags(installed=True)) # all you can set for the package + iuses = set(self.get_iuse_flags(installed=True)) # all you can set for the package return list(uses.intersection(iuses)) else: @@ -89,23 +89,22 @@ class Package (object): return flags.get_new_use_flags(self) def get_actual_use_flags (self): - """This returns the result of installed_use_flags + new_use_flags. If the package is not installed, it returns only the new flags. + """This returns all currently set use-flags including the new ones. @return: list of flags @rtype: string[]""" - if self.is_installed(): - i_flags = self.get_installed_use_flags() - for f in self.get_new_use_flags(): - + i_flags = self.get_global_settings("USE").split() + for f in self.get_new_use_flags(): + + if f[0] == '-': if flags.invert_use_flag(f) in i_flags: i_flags.remove(flags.invert_use_flag(f)) - - elif f not in i_flags: - i_flags.append(f) - return i_flags - else: - return self.get_new_use_flags() + + elif f not in i_flags: + i_flags.append(f) + + return i_flags def set_use_flag (self, flag): """Set a use-flag. @@ -120,28 +119,6 @@ class Package (object): flags.remove_new_use_flags(self) - def is_use_flag_enabled (self, flag): - """Looks whether a given useflag is enabled for the package, taking all options - (ie. even the new flags) into account. - - @param flag: the flag to check - @type flag: string - @returns: True or False - @rtype: bool""" - - if self.is_installed() and flag in self.get_actual_use_flags(): # flags set during install - return True - - elif (not self.is_installed()) and flag in self.get_global_settings("USE").split() \ - and not flags.invert_use_flag(flag) in self.get_new_use_flags(): # flags that would be set - return True - - elif flag in self.get_new_use_flags(): - return True - - else: - return False - def use_expanded (self, flag, suggest = None): """Tests whether a useflag is an expanded one. If it is, this method returns the USE_EXPAND-value. @@ -156,7 +133,7 @@ class Package (object): if flag.startswith(suggest.lower()): return suggest - for exp in self.get_global_settings("USE_EXPAND").split(" "): + for exp in self.get_global_settings("USE_EXPAND").split(): lexp = exp.lower() if flag.startswith(lexp): return exp @@ -290,7 +267,7 @@ class Package (object): @returns: the reason for masking the package @rtype: string""" - def get_all_use_flags (self, installed = False): + def get_iuse_flags (self, installed = False): """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 diff --git a/portato/backend/portage/package.py b/portato/backend/portage/package.py index 7ab1713..65522ec 100644 --- a/portato/backend/portage/package.py +++ b/portato/backend/portage/package.py @@ -124,7 +124,7 @@ class PortagePackage (Package): else: return reason - def get_all_use_flags (self, installed = False): + def get_iuse_flags (self, installed = False): if installed or not self.is_in_system(): tree = self._settings.vartree else: @@ -134,22 +134,13 @@ class PortagePackage (Package): def get_matched_dep_packages (self, depvar): # change the useflags, because we have internally changed some, but not made them visible for portage - newUseFlags = self.get_new_use_flags() - actual = self.get_global_settings("USE").split() - if newUseFlags: - for u in newUseFlags: - if u[0] == "-" and flags.invert_use_flag(u) in actual: - actual.remove(flags.invert_use_flag(u)) - elif u not in actual: - actual.append(u) + actual = self.get_actual_use_flags() depstring = "" for d in depvar: - depstring += self.get_package_settings(d)+" " + depstring += self.get_package_settings(d, tree = self._settings.porttree)+" " - portage_dep._dep_check_strict = False deps = portage.dep_check(depstring, None, self._settings.settings, myuse = actual, trees = self._trees) - portage_dep._dep_check_strict = True if not deps: # FIXME: what is the difference to [1, []] ? return [] @@ -171,14 +162,7 @@ class PortagePackage (Package): dep_pkgs = [] # the package list # change the useflags, because we have internally changed some, but not made them visible for portage - newUseFlags = self.get_new_use_flags() - actual = self.get_global_settings("USE").split() - if newUseFlags: - for u in newUseFlags: - if u[0] == "-" and flags.invert_use_flag(u) in actual: - actual.remove(flags.invert_use_flag(u)) - elif u not in actual: - actual.append(u) + actual = self.get_actual_use_flags() depstring = "" for d in depvar: diff --git a/portato/backend/portage/system.py b/portato/backend/portage/system.py index c40473e..f6b2a3b 100644 --- a/portato/backend/portage/system.py +++ b/portato/backend/portage/system.py @@ -323,11 +323,19 @@ class PortageSystem (SystemInterface): checked = [] updating = [] - raw_checked = [] + raw_checked = {} def check (p, add_not_installed = True): """Checks whether a package is updated or not.""" - if p.get_cp() in checked: return - else: checked.append(p.get_cp()) + + if p.get_slot_cp() in checked: + return + else: + if (not p.is_installed()) and (not add_not_installed): + # don't add these packages to checked as we may see them again + # - and then we might have add_not_installed being True + return + else: + checked.append(p.get_slot_cp()) appended = False tempDeep = False @@ -339,11 +347,9 @@ class PortageSystem (SystemInterface): else: oldList = self.sort_package_list(self.find_installed_packages(p.get_cp())) if not oldList: - if add_not_installed: - info(_("Found a not installed dependency: %s.") % p.get_cpv()) - oldList = [p] - else: - return + info(_("Found a not installed dependency: %s.") % p.get_cpv()) + oldList = [p] + old = oldList[-1] updating.append((p, old)) @@ -352,8 +358,8 @@ class PortageSystem (SystemInterface): if newuse and p.is_installed() and p.is_in_system(): # there is no use to check newuse for a package which is not existing in portage anymore :) - new_iuse = set(p.get_all_use_flags(installed = False)) # IUSE in the ebuild - old_iuse = set(p.get_all_use_flags(installed = True)) # IUSE in the vardb + 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 if new_iuse.symmetric_difference(old_iuse): # difference between new_iuse and old_iuse tempDeep = True @@ -362,10 +368,7 @@ class PortageSystem (SystemInterface): appended = True else: - old = set(p.get_installed_use_flags()) - new = set(p.get_global_settings("USE").split()) - - if new_iuse.intersection(new) != old_iuse.intersection(old): + if new_iuse.intersection(p.get_actual_use_flags()).symmetric_difference(p.get_installed_use_flags()): tempDeep = True if not appended: updating.append((p,p)) @@ -376,8 +379,8 @@ class PortageSystem (SystemInterface): for state in states: for i in p.get_matched_dep_packages(state[0]): - if i not in raw_checked: - raw_checked.append(i) + if i not in raw_checked or raw_checked[i] == False: + raw_checked.update({i : state[1]}) bm = self.get_new_packages([i]) if not bm: warning(_("Bug? No best match could be found for '%(package)s'. Needed by: '%(cpv)s'."), {"package" : i, "cpv": p.get_cpv()}) |