1 |
commit: 1b33e0ae109e11b1ee696ea6c6919bb86ecbc66f |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jan 27 23:32:57 2016 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jan 27 23:32:57 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=1b33e0ae |
7 |
|
8 |
ekeyword: fix "all" keyword handling w/-keywords |
9 |
|
10 |
When an ebuild has a keyword like '-sparc', we don't want the magic |
11 |
"all" or "~all" keywords to change it to 'sparc' or '~sparc'. |
12 |
|
13 |
src/ekeyword/ekeyword.py | 8 ++++++++ |
14 |
src/ekeyword/ekeyword_unittest.py | 8 ++++++++ |
15 |
2 files changed, 16 insertions(+) |
16 |
|
17 |
diff --git a/src/ekeyword/ekeyword.py b/src/ekeyword/ekeyword.py |
18 |
index 64f4eb0..e4a8197 100755 |
19 |
--- a/src/ekeyword/ekeyword.py |
20 |
+++ b/src/ekeyword/ekeyword.py |
21 |
@@ -180,9 +180,17 @@ def process_keywords(keywords, ops, arch_status=None): |
22 |
# master list. If it lacks some keywords, then we might miss |
23 |
# somethings here, but not much we can do. |
24 |
arches = old_arches |
25 |
+ |
26 |
# We ignore the glob arch as we never want to tweak it. |
27 |
if '*' in arches: |
28 |
arches.remove('*') |
29 |
+ |
30 |
+ # For keywords that are explicitly disabled, do not update. When |
31 |
+ # people use `ekeyword ~all ...` or `ekeyword all ...`, they rarely |
32 |
+ # (if ever) want to change a '-sparc' to 'sparc' or '-sparc' to |
33 |
+ # '~sparc'. We force people to explicitly do `ekeyword sparc ...` |
34 |
+ # in these cases. |
35 |
+ arches = [x for x in arches if '-' + x not in new_keywords] |
36 |
else: |
37 |
arches = (oarch,) |
38 |
|
39 |
|
40 |
diff --git a/src/ekeyword/ekeyword_unittest.py b/src/ekeyword/ekeyword_unittest.py |
41 |
index 134dd80..473113b 100755 |
42 |
--- a/src/ekeyword/ekeyword_unittest.py |
43 |
+++ b/src/ekeyword/ekeyword_unittest.py |
44 |
@@ -196,6 +196,14 @@ class TestProcessKeywords(unittest.TestCase): |
45 |
self._test('-* ~* * alpha arm arm64 m68k', ops, |
46 |
'-* ~* * ~alpha arm ~arm64 ~m68k', arch_status) |
47 |
|
48 |
+ def testAllDisabled(self): |
49 |
+ """Make sure ~all does not change -arch to ~arch""" |
50 |
+ ops = ( |
51 |
+ ekeyword.Op('~', 'all', None), |
52 |
+ ) |
53 |
+ self._test('alpha -sparc ~x86', ops, |
54 |
+ '~alpha -sparc ~x86', {}) |
55 |
+ |
56 |
|
57 |
class TestProcessContent(unittest.TestCase): |
58 |
"""Tests for process_content""" |