1 |
Hi Zac, |
2 |
|
3 |
alternatively could --exclude be extended to support sets? |
4 |
So users could --exclude @world or @profile. |
5 |
|
6 |
Cheers, |
7 |
Manuel |
8 |
|
9 |
On 22.03.2018 00:03, Zac Medico wrote: |
10 |
> Ignore the @world package set and its dependencies. This may be useful |
11 |
> if there is a desire to perform an action even though it might break |
12 |
> the dependencies of some installed packages (it might also remove |
13 |
> installed packages in order to solve blockers). This also alters the |
14 |
> behavior of --complete-graph options so that only deep dependencies |
15 |
> of packages given as arguments are included in the dependency graph. |
16 |
> This option may be useful as an alternative to --nodeps in cases where |
17 |
> it is desirable to account for dependencies of packages given as |
18 |
> arguments. |
19 |
> |
20 |
> Bug: https://bugs.gentoo.org/608564 |
21 |
> --- |
22 |
> man/emerge.1 | 17 +++++++++++++++++ |
23 |
> pym/_emerge/create_depgraph_params.py | 4 ++++ |
24 |
> pym/_emerge/depgraph.py | 8 ++++++-- |
25 |
> pym/_emerge/main.py | 9 +++++++++ |
26 |
> pym/portage/tests/resolver/test_complete_graph.py | 18 ++++++++++++++++++ |
27 |
> 5 files changed, 54 insertions(+), 2 deletions(-) |
28 |
> |
29 |
> diff --git a/man/emerge.1 b/man/emerge.1 |
30 |
> index a17b65ed2..01ce62e51 100644 |
31 |
> --- a/man/emerge.1 |
32 |
> +++ b/man/emerge.1 |
33 |
> @@ -630,6 +630,23 @@ Therefore, \fB\-\-usepkgonly\fR (or \fB\-\-getbinpkgonly\fR) must be |
34 |
> used in order to enable soname depedency resolution when installing |
35 |
> packages. |
36 |
> .TP |
37 |
> +.BR "\-\-ignore\-world [ y | n ]" |
38 |
> +Ignore the @world package set and its dependencies. This may be useful |
39 |
> +if there is a desire to perform an action even though it might break |
40 |
> +the dependencies of some installed packages (it might also remove |
41 |
> +installed packages in order to solve blockers). This also alters the |
42 |
> +behavior of \fB\-\-complete\-graph\fR options so that only deep |
43 |
> +dependencies of packages given as arguments are included in the |
44 |
> +dependency graph. This option may be useful as an alternative to |
45 |
> +\fB\-\-nodeps\fR in cases where it is desirable to account for |
46 |
> +dependencies of packages given as arguments. |
47 |
> + |
48 |
> +\fBWARNING:\fR |
49 |
> +This option is intended to be used only with great caution, since it is |
50 |
> +possible for it to make nonsensical changes which may lead to system |
51 |
> +breakage. Therefore, it is advisable to use \fB\-\-ask\fR together with |
52 |
> +this option. |
53 |
> +.TP |
54 |
> .BR \-j\ [JOBS] ", " \-\-jobs[=JOBS] |
55 |
> Specifies the number of packages to build simultaneously. If this option is |
56 |
> given without an argument, emerge will not limit the number of jobs that can |
57 |
> diff --git a/pym/_emerge/create_depgraph_params.py b/pym/_emerge/create_depgraph_params.py |
58 |
> index fc7fa60d7..0405011fd 100644 |
59 |
> --- a/pym/_emerge/create_depgraph_params.py |
60 |
> +++ b/pym/_emerge/create_depgraph_params.py |
61 |
> @@ -26,6 +26,7 @@ def create_depgraph_params(myopts, myaction): |
62 |
> # ignore_soname_deps: ignore the soname dependencies of built |
63 |
> # packages, so that they do not trigger dependency resolution |
64 |
> # failures, or cause packages to be rebuilt or replaced. |
65 |
> + # ignore_world: ignore the @world package set and its dependencies |
66 |
> # with_test_deps: pull in test deps for packages matched by arguments |
67 |
> # changed_deps: rebuild installed packages with outdated deps |
68 |
> # changed_deps_report: report installed packages with outdated deps |
69 |
> @@ -56,6 +57,9 @@ def create_depgraph_params(myopts, myaction): |
70 |
> myparams["selective"] = True |
71 |
> return myparams |
72 |
> |
73 |
> + if myopts.get('--ignore-world') is True: |
74 |
> + myparams['ignore_world'] = True |
75 |
> + |
76 |
> rebuild_if_new_slot = myopts.get('--rebuild-if-new-slot') |
77 |
> if rebuild_if_new_slot is not None: |
78 |
> myparams['rebuild_if_new_slot'] = rebuild_if_new_slot |
79 |
> diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
80 |
> index 6c728684f..f7ea27c37 100644 |
81 |
> --- a/pym/_emerge/depgraph.py |
82 |
> +++ b/pym/_emerge/depgraph.py |
83 |
> @@ -163,7 +163,10 @@ class _frozen_depgraph_config(object): |
84 |
> self.trees[myroot]["bintree"] = DummyTree( |
85 |
> DbapiProvidesIndex(trees[myroot]["bintree"].dbapi)) |
86 |
> |
87 |
> - self._required_set_names = set(["world"]) |
88 |
> + if params.get("ignore_world", False): |
89 |
> + self._required_set_names = set() |
90 |
> + else: |
91 |
> + self._required_set_names = set(["world"]) |
92 |
> |
93 |
> atoms = ' '.join(myopts.get("--exclude", [])).split() |
94 |
> self.excluded_pkgs = _wildcard_set(atoms) |
95 |
> @@ -7554,6 +7557,7 @@ class depgraph(object): |
96 |
> ignored_uninstall_tasks = set() |
97 |
> have_uninstall_task = False |
98 |
> complete = "complete" in self._dynamic_config.myparams |
99 |
> + ignore_world = self._dynamic_config.myparams.get("ignore_world", False) |
100 |
> asap_nodes = [] |
101 |
> |
102 |
> def get_nodes(**kwargs): |
103 |
> @@ -7971,7 +7975,7 @@ class depgraph(object): |
104 |
> # detected as early as possible, which makes it possible |
105 |
> # to avoid calling self._complete_graph() when it is |
106 |
> # unnecessary due to blockers triggering an abortion. |
107 |
> - if not complete: |
108 |
> + if not (complete or ignore_world): |
109 |
> # For packages in the world set, go ahead an uninstall |
110 |
> # when necessary, as long as the atom will be satisfied |
111 |
> # in the final state. |
112 |
> diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py |
113 |
> index fbc2ce01c..5b48d32a4 100644 |
114 |
> --- a/pym/_emerge/main.py |
115 |
> +++ b/pym/_emerge/main.py |
116 |
> @@ -146,6 +146,7 @@ def insert_optional_args(args): |
117 |
> '--fuzzy-search' : y_or_n, |
118 |
> '--getbinpkg' : y_or_n, |
119 |
> '--getbinpkgonly' : y_or_n, |
120 |
> + '--ignore-world' : y_or_n, |
121 |
> '--jobs' : valid_integers, |
122 |
> '--keep-going' : y_or_n, |
123 |
> '--load-average' : valid_floats, |
124 |
> @@ -503,6 +504,11 @@ def parse_opts(tmpcmdline, silent=False): |
125 |
> "choices": y_or_n |
126 |
> }, |
127 |
> |
128 |
> + "--ignore-world": { |
129 |
> + "help" : "ignore the @world package set and its dependencies", |
130 |
> + "choices" : true_y_or_n |
131 |
> + }, |
132 |
> + |
133 |
> "--jobs": { |
134 |
> |
135 |
> "shortopt" : "-j", |
136 |
> @@ -919,6 +925,9 @@ def parse_opts(tmpcmdline, silent=False): |
137 |
> else: |
138 |
> myoptions.getbinpkgonly = None |
139 |
> |
140 |
> + if myoptions.ignore_world in true_y: |
141 |
> + myoptions.ignore_world = True |
142 |
> + |
143 |
> if myoptions.keep_going in true_y: |
144 |
> myoptions.keep_going = True |
145 |
> else: |
146 |
> diff --git a/pym/portage/tests/resolver/test_complete_graph.py b/pym/portage/tests/resolver/test_complete_graph.py |
147 |
> index 95b1f8809..d02e57582 100644 |
148 |
> --- a/pym/portage/tests/resolver/test_complete_graph.py |
149 |
> +++ b/pym/portage/tests/resolver/test_complete_graph.py |
150 |
> @@ -59,6 +59,12 @@ class CompleteGraphTestCase(TestCase): |
151 |
> success = True, |
152 |
> ), |
153 |
> |
154 |
> + ResolverPlaygroundTestCase( |
155 |
> + ["dev-libs/libxml2"], |
156 |
> + options = {"--ignore-world" : True}, |
157 |
> + mergelist = ["dev-libs/libxml2-2.8.0"], |
158 |
> + success = True, |
159 |
> + ), |
160 |
> ) |
161 |
> |
162 |
> playground = ResolverPlayground(ebuilds=ebuilds, |
163 |
> @@ -99,6 +105,12 @@ class CompleteGraphTestCase(TestCase): |
164 |
> ), |
165 |
> ResolverPlaygroundTestCase( |
166 |
> [">=sys-libs/x-2"], |
167 |
> + options = {"--ignore-world" : True}, |
168 |
> + mergelist = ["sys-libs/x-2"], |
169 |
> + success = True, |
170 |
> + ), |
171 |
> + ResolverPlaygroundTestCase( |
172 |
> + [">=sys-libs/x-2"], |
173 |
> options = {"--complete-graph-if-new-ver" : "y"}, |
174 |
> mergelist = ["sys-libs/x-2"], |
175 |
> slot_collision_solutions = [], |
176 |
> @@ -112,6 +124,12 @@ class CompleteGraphTestCase(TestCase): |
177 |
> ), |
178 |
> ResolverPlaygroundTestCase( |
179 |
> ["<sys-libs/x-1"], |
180 |
> + options = {"--ignore-world" : True}, |
181 |
> + mergelist = ["sys-libs/x-0.1"], |
182 |
> + success = True, |
183 |
> + ), |
184 |
> + ResolverPlaygroundTestCase( |
185 |
> + ["<sys-libs/x-1"], |
186 |
> options = {"--complete-graph-if-new-ver" : "y"}, |
187 |
> mergelist = ["sys-libs/x-0.1"], |
188 |
> slot_collision_solutions = [], |
189 |
> |