1 |
If emerge --depclean fails to resolve any dependencies, then it will |
2 |
now suggest emerge @unsatisfied-deps as the simplest possible |
3 |
solution, and will also suggest to unmerge @unavailable where |
4 |
appropriate at the end: |
5 |
|
6 |
$ emerge --depclean |
7 |
|
8 |
Calculating dependencies... done! |
9 |
* Dependencies could not be completely resolved due to |
10 |
* the following required packages not being installed: |
11 |
* |
12 |
* virtual/cdrtools pulled in by: |
13 |
* app-cdr/cdrdao-1.2.4 |
14 |
* |
15 |
* Have you forgotten to resolve unsatisfied dependencies prior to |
16 |
* depclean? The simplest possible command for this purpose is as |
17 |
* follows: |
18 |
* |
19 |
* emerge @unsatisfied-deps |
20 |
* |
21 |
* The most comprehensive possible update command is this: |
22 |
* |
23 |
* emerge --update --newuse --deep --with-bdeps=y @world |
24 |
* |
25 |
* Note that the --with-bdeps=y option is not required in many |
26 |
* situations. Refer to the emerge manual page (run `man emerge`) |
27 |
* for more information about --with-bdeps. |
28 |
* |
29 |
* Also, note that it may be necessary to manually uninstall |
30 |
* packages that no longer exist in the repository, since it may not |
31 |
* be possible to satisfy their dependencies. The simplest possible |
32 |
* command for this purpose is as follows, but be careful to examine |
33 |
* the resulting package list carefully: |
34 |
* |
35 |
* emerge --ask --unmerge @unavailable |
36 |
* |
37 |
|
38 |
Bug: https://bugs.gentoo.org/248026 |
39 |
Signed-off-by: Zac Medico <zmedico@g.o> |
40 |
--- |
41 |
[PATCH v2] Update --depclean message to suggest @unsatisfied-deps |
42 |
and unmerge @unavailable where appropriate. |
43 |
|
44 |
cnf/sets/portage.conf | 5 +++ |
45 |
doc/config/sets.docbook | 7 ++++ |
46 |
lib/_emerge/actions.py | 19 +++++++-- |
47 |
lib/portage/_sets/__init__.py | 4 ++ |
48 |
lib/portage/_sets/dbapi.py | 73 ++++++++++++++++++++++++++++++++++- |
49 |
5 files changed, 104 insertions(+), 4 deletions(-) |
50 |
|
51 |
diff --git a/cnf/sets/portage.conf b/cnf/sets/portage.conf |
52 |
index c4ad2efca..2bf38e414 100644 |
53 |
--- a/cnf/sets/portage.conf |
54 |
+++ b/cnf/sets/portage.conf |
55 |
@@ -115,3 +115,8 @@ class = portage.sets.dbapi.ChangedDepsSet |
56 |
class = portage.sets.dbapi.VariableSet |
57 |
variable = INHERITED |
58 |
includes = golang-base golang-build golang-vcs golang-vcs-snapshot go-module |
59 |
+ |
60 |
+# Package set which contains all installed packages having one or more |
61 |
+# unsatisfied runtime dependencies. |
62 |
+[unsatisfied-deps] |
63 |
+class = portage.sets.dbapi.UnsatisfiedDepsSet |
64 |
diff --git a/doc/config/sets.docbook b/doc/config/sets.docbook |
65 |
index eba98f468..015ec0c05 100644 |
66 |
--- a/doc/config/sets.docbook |
67 |
+++ b/doc/config/sets.docbook |
68 |
@@ -610,6 +610,13 @@ |
69 |
</itemizedlist> |
70 |
</sect3> |
71 |
</sect2> |
72 |
+ <sect2 id='config-set-classes-UnsatisfiedDepsSet'> |
73 |
+ <title>portage.sets.dbapi.UnsatisfiedDepsSet</title> |
74 |
+ <para> |
75 |
+ Package set which contains all installed packages |
76 |
+ having one or more unsatisfied runtime dependencies. |
77 |
+ </para> |
78 |
+ </sect2> |
79 |
</sect1> |
80 |
|
81 |
<sect1 id='config-set-defaults'> |
82 |
diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py |
83 |
index 1946f49df..ba2592bba 100644 |
84 |
--- a/lib/_emerge/actions.py |
85 |
+++ b/lib/_emerge/actions.py |
86 |
@@ -1000,11 +1000,18 @@ def _calc_depclean(settings, trees, ldpath_mtimes, |
87 |
msg.append(" %s" % (parent,)) |
88 |
msg.append("") |
89 |
msg.extend(textwrap.wrap( |
90 |
- "Have you forgotten to do a complete update prior " + \ |
91 |
- "to depclean? The most comprehensive command for this " + \ |
92 |
+ "Have you forgotten to resolve unsatisfied dependencies prior " |
93 |
+ "to depclean? The simplest possible command for this " |
94 |
"purpose is as follows:", 65 |
95 |
)) |
96 |
msg.append("") |
97 |
+ msg.append(" " + \ |
98 |
+ good("emerge @unsatisfied-deps")) |
99 |
+ msg.append("") |
100 |
+ msg.extend(textwrap.wrap( |
101 |
+ "The most comprehensive possible update command is this:", 65 |
102 |
+ )) |
103 |
+ msg.append("") |
104 |
msg.append(" " + \ |
105 |
good("emerge --update --newuse --deep --with-bdeps=y @world")) |
106 |
msg.append("") |
107 |
@@ -1018,8 +1025,14 @@ def _calc_depclean(settings, trees, ldpath_mtimes, |
108 |
msg.extend(textwrap.wrap( |
109 |
"Also, note that it may be necessary to manually uninstall " + \ |
110 |
"packages that no longer exist in the repository, since " + \ |
111 |
- "it may not be possible to satisfy their dependencies.", 65 |
112 |
+ "it may not be possible to satisfy their dependencies." |
113 |
+ " The simplest possible command for this purpose is as follows," |
114 |
+ " but be careful to examine the resulting package list carefully:", 65 |
115 |
)) |
116 |
+ msg.append("") |
117 |
+ msg.append(" " + \ |
118 |
+ good("emerge --ask --unmerge @unavailable")) |
119 |
+ msg.append("") |
120 |
if action == "prune": |
121 |
msg.append("") |
122 |
msg.append("If you would like to ignore " + \ |
123 |
diff --git a/lib/portage/_sets/__init__.py b/lib/portage/_sets/__init__.py |
124 |
index efa6314ba..ea48f6eb0 100644 |
125 |
--- a/lib/portage/_sets/__init__.py |
126 |
+++ b/lib/portage/_sets/__init__.py |
127 |
@@ -136,6 +136,10 @@ class SetConfig: |
128 |
parser.add_section("preserved-rebuild") |
129 |
parser.set("preserved-rebuild", "class", "portage.sets.libs.PreservedLibraryConsumerSet") |
130 |
|
131 |
+ parser.remove_section("unsatisfied-deps") |
132 |
+ parser.add_section("unsatisfied-deps") |
133 |
+ parser.set("unsatisfied-deps", "class", "portage.sets.dbapi.UnsatisfiedDepsSet") |
134 |
+ |
135 |
parser.remove_section("x11-module-rebuild") |
136 |
parser.add_section("x11-module-rebuild") |
137 |
parser.set("x11-module-rebuild", "class", "portage.sets.dbapi.OwnerSet") |
138 |
diff --git a/lib/portage/_sets/dbapi.py b/lib/portage/_sets/dbapi.py |
139 |
index 8e1f19979..c82c4a4cd 100644 |
140 |
--- a/lib/portage/_sets/dbapi.py |
141 |
+++ b/lib/portage/_sets/dbapi.py |
142 |
@@ -14,8 +14,16 @@ from portage._sets.base import PackageSet |
143 |
from portage._sets import SetConfigError, get_boolean |
144 |
import portage |
145 |
|
146 |
+from _emerge.Package import Package |
147 |
+from _emerge.RootConfig import RootConfig |
148 |
+ |
149 |
__all__ = ["CategorySet", "ChangedDepsSet", "DowngradeSet", |
150 |
- "EverythingSet", "OwnerSet", "SubslotChangedSet", "VariableSet"] |
151 |
+ "EverythingSet", |
152 |
+ "OwnerSet", |
153 |
+ "SubslotChangedSet", |
154 |
+ "UnsatisfiedDepsSet", |
155 |
+ "VariableSet", |
156 |
+] |
157 |
|
158 |
class EverythingSet(PackageSet): |
159 |
_operations = ["merge"] |
160 |
@@ -303,6 +311,69 @@ class UnavailableBinaries(EverythingSet): |
161 |
|
162 |
singleBuilder = classmethod(singleBuilder) |
163 |
|
164 |
+class UnsatisfiedDepsSet(PackageSet): |
165 |
+ |
166 |
+ _operations = ["merge", "unmerge"] |
167 |
+ |
168 |
+ description = ( |
169 |
+ "Package set which contains all installed packages " |
170 |
+ "having one or more unsatisfied runtime dependencies." |
171 |
+ ) |
172 |
+ |
173 |
+ def __init__(self, vardb=None): |
174 |
+ super().__init__() |
175 |
+ self._vardb = vardb |
176 |
+ |
177 |
+ def load(self): |
178 |
+ vardb = self._vardb |
179 |
+ trees = { |
180 |
+ vardb.settings["EROOT"]: { |
181 |
+ "porttree": vardb.vartree, |
182 |
+ "vartree": vardb.vartree, |
183 |
+ } |
184 |
+ } |
185 |
+ root_config = RootConfig(vardb.settings, trees[vardb.settings["EROOT"]], None) |
186 |
+ atoms = [] |
187 |
+ for pkg_str in vardb.cpv_all(): |
188 |
+ try: |
189 |
+ metadata = dict( |
190 |
+ zip( |
191 |
+ vardb._aux_cache_keys, |
192 |
+ vardb.aux_get(pkg_str, vardb._aux_cache_keys), |
193 |
+ ) |
194 |
+ ) |
195 |
+ except KeyError: |
196 |
+ continue |
197 |
+ pkg = Package( |
198 |
+ built=True, |
199 |
+ cpv=pkg_str, |
200 |
+ installed=True, |
201 |
+ metadata=metadata, |
202 |
+ root_config=root_config, |
203 |
+ type_name="installed", |
204 |
+ ) |
205 |
+ |
206 |
+ runtime_deps = " ".join(pkg._metadata[k] for k in Package._runtime_keys) |
207 |
+ |
208 |
+ success, unsatisfied_deps = portage.dep_check( |
209 |
+ runtime_deps, |
210 |
+ None, |
211 |
+ vardb.settings, |
212 |
+ myuse=pkg.use.enabled, |
213 |
+ myroot=vardb.settings["EROOT"], |
214 |
+ trees=trees, |
215 |
+ ) |
216 |
+ |
217 |
+ if not (success and not unsatisfied_deps): |
218 |
+ atoms.append(pkg.slot_atom) |
219 |
+ |
220 |
+ self._setAtoms(atoms) |
221 |
+ |
222 |
+ def singleBuilder(cls, options, settings, trees): |
223 |
+ return cls(vardb=trees["vartree"].dbapi) |
224 |
+ |
225 |
+ singleBuilder = classmethod(singleBuilder) |
226 |
+ |
227 |
class CategorySet(PackageSet): |
228 |
_operations = ["merge", "unmerge"] |
229 |
|
230 |
-- |
231 |
2.26.2 |