1 |
The option prevents --autounmask from making changes to |
2 |
package.accept_keywords. This option does not imply |
3 |
--autounmask-keep-masks, so --autounmask is still allowed |
4 |
to create package.unmask changes unless the |
5 |
--autounmask-keep-masks is also specified. |
6 |
|
7 |
X-Gentoo-bug: 622480 |
8 |
X-Gentoo-bug-url: https://bugs.gentoo.org/622480 |
9 |
--- |
10 |
man/emerge.1 | 7 +++ |
11 |
pym/_emerge/depgraph.py | 12 ++-- |
12 |
pym/_emerge/main.py | 9 +++ |
13 |
.../resolver/test_autounmask_keep_keywords.py | 68 ++++++++++++++++++++++ |
14 |
4 files changed, 92 insertions(+), 4 deletions(-) |
15 |
create mode 100644 pym/portage/tests/resolver/test_autounmask_keep_keywords.py |
16 |
|
17 |
diff --git a/man/emerge.1 b/man/emerge.1 |
18 |
index ffb453efb..12a0db166 100644 |
19 |
--- a/man/emerge.1 |
20 |
+++ b/man/emerge.1 |
21 |
@@ -395,6 +395,13 @@ using the \'=\' operator will be written. With this |
22 |
option, \'>=\' operators will be used whenever possible. |
23 |
USE and license changes always use the latter behavior. |
24 |
.TP |
25 |
+.BR "\-\-autounmask\-keep\-keywords [ y | n ]" |
26 |
+If \-\-autounmask is enabled, no package.accept_keywords changes will |
27 |
+be created. This leads to unsatisfied dependencies if any keyword |
28 |
+changes are required. This option does not imply \-\-autounmask\-keep\-masks, |
29 |
+so \-\-autounmask is still allowed to create package.unmask changes unless |
30 |
+the \-\-autounmask\-keep\-masks is also specified. |
31 |
+.TP |
32 |
.BR "\-\-autounmask\-keep\-masks [ y | n ]" |
33 |
If \-\-autounmask is enabled, no package.unmask or ** keyword changes |
34 |
will be created. This leads to unsatisfied dependencies if |
35 |
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
36 |
index abe2cb1bd..b4fc5f297 100644 |
37 |
--- a/pym/_emerge/depgraph.py |
38 |
+++ b/pym/_emerge/depgraph.py |
39 |
@@ -5707,6 +5707,7 @@ class depgraph(object): |
40 |
if self._dynamic_config._autounmask is not True: |
41 |
return |
42 |
|
43 |
+ autounmask_keep_keywords = self._frozen_config.myopts.get("--autounmask-keep-keywords", "n") != "n" |
44 |
autounmask_keep_masks = self._frozen_config.myopts.get("--autounmask-keep-masks", "n") != "n" |
45 |
autounmask_level = self._AutounmaskLevel() |
46 |
|
47 |
@@ -5716,14 +5717,16 @@ class depgraph(object): |
48 |
autounmask_level.allow_license_changes = True |
49 |
yield autounmask_level |
50 |
|
51 |
- autounmask_level.allow_unstable_keywords = True |
52 |
- yield autounmask_level |
53 |
- |
54 |
- if not autounmask_keep_masks: |
55 |
+ if not autounmask_keep_keywords: |
56 |
+ autounmask_level.allow_unstable_keywords = True |
57 |
+ yield autounmask_level |
58 |
|
59 |
+ if not (autounmask_keep_keywords or autounmask_keep_masks): |
60 |
+ autounmask_level.allow_unstable_keywords = True |
61 |
autounmask_level.allow_missing_keywords = True |
62 |
yield autounmask_level |
63 |
|
64 |
+ if not autounmask_keep_masks: |
65 |
# 4. USE + license + masks |
66 |
# Try to respect keywords while discarding |
67 |
# package.mask (see bug #463394). |
68 |
@@ -5732,6 +5735,7 @@ class depgraph(object): |
69 |
autounmask_level.allow_unmasks = True |
70 |
yield autounmask_level |
71 |
|
72 |
+ if not (autounmask_keep_keywords or autounmask_keep_masks): |
73 |
autounmask_level.allow_unstable_keywords = True |
74 |
|
75 |
for missing_keyword, unmask in ((False, True), (True, True)): |
76 |
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py |
77 |
index 2132aa63c..d3a415b91 100644 |
78 |
--- a/pym/_emerge/main.py |
79 |
+++ b/pym/_emerge/main.py |
80 |
@@ -129,6 +129,7 @@ def insert_optional_args(args): |
81 |
'--autounmask' : y_or_n, |
82 |
'--autounmask-continue' : y_or_n, |
83 |
'--autounmask-only' : y_or_n, |
84 |
+ '--autounmask-keep-keywords' : y_or_n, |
85 |
'--autounmask-keep-masks': y_or_n, |
86 |
'--autounmask-unrestricted-atoms' : y_or_n, |
87 |
'--autounmask-write' : y_or_n, |
88 |
@@ -348,6 +349,11 @@ def parse_opts(tmpcmdline, silent=False): |
89 |
"choices" : true_y_or_n |
90 |
}, |
91 |
|
92 |
+ "--autounmask-keep-keywords": { |
93 |
+ "help" : "don't add package.accept_keywords entries", |
94 |
+ "choices" : true_y_or_n |
95 |
+ }, |
96 |
+ |
97 |
"--autounmask-keep-masks": { |
98 |
"help" : "don't add package.unmask entries", |
99 |
"choices" : true_y_or_n |
100 |
@@ -797,6 +803,9 @@ def parse_opts(tmpcmdline, silent=False): |
101 |
if myoptions.autounmask_unrestricted_atoms in true_y: |
102 |
myoptions.autounmask_unrestricted_atoms = True |
103 |
|
104 |
+ if myoptions.autounmask_keep_keywords in true_y: |
105 |
+ myoptions.autounmask_keep_keywords = True |
106 |
+ |
107 |
if myoptions.autounmask_keep_masks in true_y: |
108 |
myoptions.autounmask_keep_masks = True |
109 |
|
110 |
diff --git a/pym/portage/tests/resolver/test_autounmask_keep_keywords.py b/pym/portage/tests/resolver/test_autounmask_keep_keywords.py |
111 |
new file mode 100644 |
112 |
index 000000000..c551e958d |
113 |
--- /dev/null |
114 |
+++ b/pym/portage/tests/resolver/test_autounmask_keep_keywords.py |
115 |
@@ -0,0 +1,68 @@ |
116 |
+# Copyright 2017 Gentoo Foundation |
117 |
+# Distributed under the terms of the GNU General Public License v2 |
118 |
+ |
119 |
+from portage.tests import TestCase |
120 |
+from portage.tests.resolver.ResolverPlayground import ResolverPlayground, ResolverPlaygroundTestCase |
121 |
+ |
122 |
+class AutounmaskKeepKeywordsTestCase(TestCase): |
123 |
+ |
124 |
+ def testAutounmaskKeepKeywordsTestCase(self): |
125 |
+ ebuilds = { |
126 |
+ "app-misc/A-2": { |
127 |
+ "EAPI": "6", |
128 |
+ "RDEPEND": "app-misc/B", |
129 |
+ }, |
130 |
+ "app-misc/A-1": { |
131 |
+ "EAPI": "6", |
132 |
+ "RDEPEND": "app-misc/C[foo]", |
133 |
+ }, |
134 |
+ "app-misc/B-1": { |
135 |
+ "EAPI": "6", |
136 |
+ "KEYWORDS": "~x86", |
137 |
+ }, |
138 |
+ "app-misc/C-1": { |
139 |
+ "EAPI": "6", |
140 |
+ "IUSE": "foo", |
141 |
+ }, |
142 |
+ } |
143 |
+ installed = { |
144 |
+ } |
145 |
+ |
146 |
+ test_cases = ( |
147 |
+ ResolverPlaygroundTestCase( |
148 |
+ ['app-misc/A'], |
149 |
+ success = False, |
150 |
+ options = { |
151 |
+ '--autounmask-keep-keywords': 'n', |
152 |
+ }, |
153 |
+ mergelist = [ |
154 |
+ 'app-misc/B-1', |
155 |
+ 'app-misc/A-2', |
156 |
+ ], |
157 |
+ unstable_keywords={'app-misc/B-1'}, |
158 |
+ ), |
159 |
+ # --autounmask-keep-keywords prefers app-misc/A-1 because |
160 |
+ # it can be installed without accepting unstable |
161 |
+ # keywords |
162 |
+ ResolverPlaygroundTestCase( |
163 |
+ ['app-misc/A'], |
164 |
+ success = False, |
165 |
+ options = { |
166 |
+ "--autounmask-keep-keywords": 'y', |
167 |
+ }, |
168 |
+ mergelist = [ |
169 |
+ 'app-misc/C-1', |
170 |
+ 'app-misc/A-1', |
171 |
+ ], |
172 |
+ use_changes = {'app-misc/C-1': {'foo': True}}, |
173 |
+ ), |
174 |
+ ) |
175 |
+ |
176 |
+ playground = ResolverPlayground(ebuilds=ebuilds, debug=False) |
177 |
+ try: |
178 |
+ for test_case in test_cases: |
179 |
+ playground.run_TestCase(test_case) |
180 |
+ self.assertEqual(test_case.test_success, True, test_case.fail_msg) |
181 |
+ finally: |
182 |
+ playground.debug = False |
183 |
+ playground.cleanup() |
184 |
-- |
185 |
2.13.0 |