From: Zac Medico Date: Tue, 31 Aug 2010 06:06:46 +0000 (-0700) Subject: Fix bugs in features_set._prune_overrides() and add another test case. X-Git-Tag: v2.2_rc73~21 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b22dda3577107af572453ce0058dfc18c22471a5;p=portage.git Fix bugs in features_set._prune_overrides() and add another test case. --- 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()