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