diff options
-rw-r--r-- | pym/portage/package/ebuild/_config/features_set.py | 23 | ||||
-rw-r--r-- | pym/portage/tests/ebuild/test_config.py | 8 |
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() |