diff options
author | necoro <> | 2006-12-10 11:43:26 +0000 |
---|---|---|
committer | necoro <> | 2006-12-10 11:43:26 +0000 |
commit | 43af2d836a54146a556a5c4f06ec98e882f6aa9e (patch) | |
tree | c7fa23bf5521fd34ac61081d9976adfb21171abe /portato/backend | |
parent | e368eb59dd4f7388fe93387492ef2e12c3993129 (diff) | |
download | portato-43af2d836a54146a556a5c4f06ec98e882f6aa9e.tar.gz portato-43af2d836a54146a556a5c4f06ec98e882f6aa9e.tar.bz2 portato-43af2d836a54146a556a5c4f06ec98e882f6aa9e.zip |
used sets for flags; make newuse work completly
Diffstat (limited to '')
-rw-r--r-- | portato/backend/package.py | 17 | ||||
-rw-r--r-- | portato/backend/portage_helper.py | 27 |
2 files changed, 22 insertions, 22 deletions
diff --git a/portato/backend/package.py b/portato/backend/package.py index fc0bd02..225c06a 100644 --- a/portato/backend/package.py +++ b/portato/backend/package.py @@ -38,6 +38,10 @@ class Package: self._settings = settings self._settingslock = settingslock + + self.forced_flags = set() + self.forced_flags.update(self._settings.usemask) + self.forced_flags.update(self._settings.useforce) try: self._status = portage.getmaskingstatus(self.get_cpv(), settings = self._settings) @@ -151,7 +155,7 @@ class Package: else: tree = porttree - return unique_array(self.get_env_var("IUSE", tree = tree).split()) + return list(set(self.get_env_var("IUSE", tree = tree).split()).difference(self.forced_flags)) 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. @@ -160,13 +164,10 @@ class Package: @rtype: string[]""" if self.is_installed(): - uses = self.get_use_flags().split() # all set at installation time - iuses = self.get_all_use_flags() # all you can set for the package - set = [] - for u in iuses: - if u in uses: - set.append(u) - return set + 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 + + return list(uses.intersection(iuses)) else: return [] diff --git a/portato/backend/portage_helper.py b/portato/backend/portage_helper.py index 9c171b4..10ab9fa 100644 --- a/portato/backend/portage_helper.py +++ b/portato/backend/portage_helper.py @@ -378,27 +378,26 @@ def update_world (newuse = False, deep = False): if newuse: - new = set(p.get_all_use_flags(False)) # IUSE in the ebuild - old = set(p.get_all_use_flags(True)) # IUSE in the vardb - if old != new: - debug(p.get_cpv(),"old:",old) - debug(p.get_cpv(),"new:",new) + 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 + + if new_iuse.symmetric_difference(old_iuse): # difference between new_iuse and old_iuse + debug(p.get_cpv(),"old:",old_iuse) + debug(p.get_cpv(),"new:",new_iuse) tempDeep = True if not appended: updating.append((p,p)) appended = True else: - old = p.get_installed_use_flags() - new = p.get_settings("USE").split() + old = set(p.get_installed_use_flags()) + new = set(p.get_settings("USE").split()) - for u in p.get_all_use_flags(): - if (u in new) != (u in old): - tempDeep = True - if not appended: - updating.append((p,p)) - appended = True - break + if new_iuse.intersection(new) != old_iuse.intersection(old): + tempDeep = True + if not appended: + updating.append((p,p)) + appended = True if deep or tempDeep: for i in p.get_matched_dep_packages(): |