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