diff options
author | Mike Frysinger <vapier@gentoo.org> | 2016-01-27 18:32:57 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2016-01-27 18:32:57 -0500 |
commit | 1b33e0ae109e11b1ee696ea6c6919bb86ecbc66f (patch) | |
tree | 64e37bc4958eef38d83cbbb486a0ba4ff395abbb | |
parent | ekeyword: allow passing arch_status={} to disable profile logic (diff) | |
download | gentoolkit-1b33e0ae.tar.gz gentoolkit-1b33e0ae.tar.bz2 gentoolkit-1b33e0ae.zip |
ekeyword: fix "all" keyword handling w/-keywords
When an ebuild has a keyword like '-sparc', we don't want the magic
"all" or "~all" keywords to change it to 'sparc' or '~sparc'.
-rwxr-xr-x | src/ekeyword/ekeyword.py | 8 | ||||
-rwxr-xr-x | src/ekeyword/ekeyword_unittest.py | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/ekeyword/ekeyword.py b/src/ekeyword/ekeyword.py index 64f4eb0..e4a8197 100755 --- a/src/ekeyword/ekeyword.py +++ b/src/ekeyword/ekeyword.py @@ -180,9 +180,17 @@ def process_keywords(keywords, ops, arch_status=None): # master list. If it lacks some keywords, then we might miss # somethings here, but not much we can do. arches = old_arches + # We ignore the glob arch as we never want to tweak it. if '*' in arches: arches.remove('*') + + # For keywords that are explicitly disabled, do not update. When + # people use `ekeyword ~all ...` or `ekeyword all ...`, they rarely + # (if ever) want to change a '-sparc' to 'sparc' or '-sparc' to + # '~sparc'. We force people to explicitly do `ekeyword sparc ...` + # in these cases. + arches = [x for x in arches if '-' + x not in new_keywords] else: arches = (oarch,) diff --git a/src/ekeyword/ekeyword_unittest.py b/src/ekeyword/ekeyword_unittest.py index 134dd80..473113b 100755 --- a/src/ekeyword/ekeyword_unittest.py +++ b/src/ekeyword/ekeyword_unittest.py @@ -196,6 +196,14 @@ class TestProcessKeywords(unittest.TestCase): self._test('-* ~* * alpha arm arm64 m68k', ops, '-* ~* * ~alpha arm ~arm64 ~m68k', arch_status) + def testAllDisabled(self): + """Make sure ~all does not change -arch to ~arch""" + ops = ( + ekeyword.Op('~', 'all', None), + ) + self._test('alpha -sparc ~x86', ops, + '~alpha -sparc ~x86', {}) + class TestProcessContent(unittest.TestCase): """Tests for process_content""" |