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