summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-08-30 23:06:46 -0700
committerZac Medico <zmedico@gentoo.org>2010-08-30 23:06:46 -0700
commitb22dda3577107af572453ce0058dfc18c22471a5 (patch)
tree3d66f4fa2b96a36c0f312653e96300abd8edf81b
parent4adfd4490bc9c683a966afa386ac96a83b1d96aa (diff)
downloadportage-b22dda3577107af572453ce0058dfc18c22471a5.tar.gz
portage-b22dda3577107af572453ce0058dfc18c22471a5.tar.bz2
portage-b22dda3577107af572453ce0058dfc18c22471a5.zip
Fix bugs in features_set._prune_overrides() and add another test case.
-rw-r--r--pym/portage/package/ebuild/_config/features_set.py23
-rw-r--r--pym/portage/tests/ebuild/test_config.py8
2 files changed, 19 insertions, 12 deletions
diff --git a/pym/portage/package/ebuild/_config/features_set.py b/pym/portage/package/ebuild/_config/features_set.py
index a39fb89dc..62236fd89 100644
--- a/pym/portage/package/ebuild/_config/features_set.py
+++ b/pym/portage/package/ebuild/_config/features_set.py
@@ -115,15 +115,14 @@ class features_set(object):
to persist for future config.regenerate() calls.
"""
overrides_set = set(self._settings._features_overrides)
- if len(overrides_set) < len(self._settings._features_overrides):
- positive = set()
- negative = set()
- for x in self._settings._features_overrides:
- if x[:1] == '-':
- positive.discard(x[:1])
- negative.add(x[:1])
- else:
- positive.add(x)
- negative.discard(x)
- self._settings._features_overrides[:] = \
- list(positive) + list(negative)
+ positive = set()
+ negative = set()
+ for x in self._settings._features_overrides:
+ if x[:1] == '-':
+ positive.discard(x[1:])
+ negative.add(x[1:])
+ else:
+ positive.add(x)
+ negative.discard(x)
+ self._settings._features_overrides[:] = \
+ list(positive) + list('-' + x for x in negative)
diff --git a/pym/portage/tests/ebuild/test_config.py b/pym/portage/tests/ebuild/test_config.py
index b12605aac..fa711bee4 100644
--- a/pym/portage/tests/ebuild/test_config.py
+++ b/pym/portage/tests/ebuild/test_config.py
@@ -40,6 +40,14 @@ class ConfigTestCase(TestCase):
# after: ['noclean']
self.assertEqual(settings._features_overrides.count('noclean'), 1)
self.assertEqual(settings._features_overrides.count('-noclean'), 0)
+
+ settings.features.remove('noclean')
+
+ # before: ['noclean', '-noclean']
+ settings.features._prune_overrides()
+ # after: ['-noclean']
+ self.assertEqual(settings._features_overrides.count('noclean'), 0)
+ self.assertEqual(settings._features_overrides.count('-noclean'), 1)
finally:
playground.cleanup()