Gentoo Archives: gentoo-portage-dev

From: Aaron Bauman <bman@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Aaron Bauman <bman@g.o>
Subject: [gentoo-portage-dev] [PATCH 06/68] lib/_emerge/resolver/slot_collision.py: fix whitespace
Date: Mon, 03 Aug 2020 22:44:00
Message-Id: 20200803224327.1593726-6-bman@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH 01/68] lib/portage/util/_dyn_libs/PreservedLibsRegistry.py: fix whitespace by Aaron Bauman
1 Signed-off-by: Aaron Bauman <bman@g.o>
2 ---
3 lib/_emerge/resolver/slot_collision.py | 60 +++++++++++++-------------
4 1 file changed, 29 insertions(+), 31 deletions(-)
5
6 diff --git a/lib/_emerge/resolver/slot_collision.py b/lib/_emerge/resolver/slot_collision.py
7 index 7accb89f4..7536ce7a2 100644
8 --- a/lib/_emerge/resolver/slot_collision.py
9 +++ b/lib/_emerge/resolver/slot_collision.py
10 @@ -90,26 +90,26 @@ class slot_conflict_handler:
11 self.all_conflicts = []
12 for conflict in depgraph._dynamic_config._package_tracker.slot_conflicts():
13 self.all_conflicts.append((conflict.root, conflict.atom, conflict.pkgs))
14 -
15 +
16 #A dict mapping packages to pairs of parent package
17 #and parent atom
18 self.all_parents = depgraph._dynamic_config._parent_atoms
19 -
20 +
21 #set containing all nodes that are part of a slot conflict
22 conflict_nodes = set()
23 -
24 +
25 #a list containing list of packages that form a slot conflict
26 conflict_pkgs = []
27 -
28 +
29 #a list containing sets of (parent, atom) pairs that have pulled packages
30 #into the same slot
31 all_conflict_atoms_by_slotatom = []
32 -
33 +
34 #fill conflict_pkgs, all_conflict_atoms_by_slotatom
35 for root, atom, pkgs in self.all_conflicts:
36 conflict_pkgs.append(list(pkgs))
37 all_conflict_atoms_by_slotatom.append(set())
38 -
39 +
40 for pkg in pkgs:
41 conflict_nodes.add(pkg)
42 for ppkg, atom in self.all_parents.get(pkg):
43 @@ -120,7 +120,7 @@ class slot_conflict_handler:
44 #If any conflict package was pulled in only by unspecific atoms, then
45 #the user forgot to enable --newuse and/or --update.
46 self.conflict_is_unspecific = False
47 -
48 +
49 #Indicate if the conflict is caused by incompatible version requirements
50 #cat/pkg-2 pulled in, but a parent requires <cat/pkg-2
51 self.is_a_version_conflict = False
52 @@ -536,11 +536,11 @@ class slot_conflict_handler:
53 ii = atom_str.find(slot_str)
54 colored_idx.update(range(ii, ii + len(slot_str)))
55 atom_str = atom_str.replace(slot_str, colorize("BAD", slot_str), 1)
56 -
57 +
58 if use and atom.use.tokens:
59 use_part_start = atom_str.find("[")
60 use_part_end = atom_str.find("]")
61 -
62 +
63 new_tokens = []
64 # Compute start index in non-colored atom.
65 ii = str(atom).find("[") + 1
66 @@ -555,7 +555,7 @@ class slot_conflict_handler:
67 atom_str = atom_str[:use_part_start] \
68 + "[%s]" % (",".join(new_tokens),) + \
69 atom_str[use_part_end+1:]
70 -
71 +
72 return atom_str, colored_idx
73
74 # Show unconditional use deps first, since those
75 @@ -623,7 +623,7 @@ class slot_conflict_handler:
76 msg.append(2*indent)
77 msg.append("(no parents that aren't satisfied by other packages in this slot)\n")
78 self.conflict_is_unspecific = True
79 -
80 +
81 omitted_parents = num_all_specific_atoms - len(selected_for_display)
82 if omitted_parents:
83 any_omitted_parents = True
84 @@ -800,7 +800,7 @@ class slot_conflict_handler:
85 #for this flag and those kill this configuration.
86 for flag in violated_atom.use.required:
87 state = involved_flags.get(flag, "")
88 -
89 +
90 if flag in violated_atom.use.enabled:
91 if state in ("", "cond", "enabled"):
92 state = "enabled"
93 @@ -873,8 +873,8 @@ class slot_conflict_handler:
94 if not solutions:
95 writemsg("No viable solutions. Rejecting configuration.\n", noiselevel=-1)
96 return solutions
97 -
98 -
99 +
100 +
101 def _force_flag_for_package(self, required_changes, pkg, flag, state):
102 """
103 Adds an USE change to required_changes. Sets the target state to
104 @@ -889,7 +889,7 @@ class slot_conflict_handler:
105 flag_change = "contradiction"
106 elif flag in _pkg_use_enabled(pkg):
107 flag_change = "disabled"
108 -
109 +
110 changes[flag] = flag_change
111 required_changes[pkg] = changes
112 elif state == "enabled":
113 @@ -899,10 +899,10 @@ class slot_conflict_handler:
114 flag_change = "contradiction"
115 else:
116 flag_change = "enabled"
117 -
118 +
119 changes[flag] = flag_change
120 required_changes[pkg] = changes
121 -
122 +
123 def _check_solution(self, config, all_involved_flags, all_conflict_atoms_by_slotatom):
124 """
125 Given a configuartion and all involved flags, all possible settings for the involved
126 @@ -954,7 +954,7 @@ class slot_conflict_handler:
127 continue
128 for flag in all_involved_flags[idx]:
129 state = all_involved_flags[idx][flag]
130 -
131 +
132 if flag not in use.required or not use.conditional:
133 continue
134 if flag in use.conditional.enabled:
135 @@ -1078,28 +1078,28 @@ class _configuration_generator:
136 if pkg.installed:
137 new_pkgs.append(pkg)
138 self.conflict_pkgs.append(new_pkgs)
139 -
140 +
141 self.solution_ids = []
142 for pkgs in self.conflict_pkgs:
143 self.solution_ids.append(0)
144 self._is_first_solution = True
145 -
146 +
147 def get_configuration(self):
148 if self._is_first_solution:
149 self._is_first_solution = False
150 else:
151 if not self._next():
152 return None
153 -
154 +
155 solution = []
156 for idx, pkgs in enumerate(self.conflict_pkgs):
157 solution.append(pkgs[self.solution_ids[idx]])
158 return solution
159 -
160 +
161 def _next(self, id=None): # pylint: disable=redefined-builtin
162 solution_ids = self.solution_ids
163 conflict_pkgs = self.conflict_pkgs
164 -
165 +
166 if id is None:
167 id = len(solution_ids)-1
168
169 @@ -1128,11 +1128,11 @@ class _solution_candidate_generator:
170 #A copy of all_involved_flags with all "cond" values
171 #replaced by a _value_helper object.
172 self.all_involved_flags = []
173 -
174 +
175 #A list tracking references to all used _value_helper
176 #objects.
177 self.conditional_values = []
178 -
179 +
180 for involved_flags in all_involved_flags:
181 new_involved_flags = {}
182 for flag, state in involved_flags.items():
183 @@ -1143,7 +1143,7 @@ class _solution_candidate_generator:
184 new_involved_flags[flag] = v
185 self.conditional_values.append(v)
186 self.all_involved_flags.append(new_involved_flags)
187 -
188 +
189 self._is_first_solution = True
190
191 def get_candidate(self):
192 @@ -1154,13 +1154,13 @@ class _solution_candidate_generator:
193 return None
194
195 return self.all_involved_flags
196 -
197 +
198 def _next(self, id=None): # pylint: disable=redefined-builtin
199 values = self.conditional_values
200 -
201 +
202 if not values:
203 return False
204 -
205 +
206 if id is None:
207 id = len(values)-1
208
209 @@ -1173,5 +1173,3 @@ class _solution_candidate_generator:
210 for other_id in range(id+1, len(values)):
211 values[other_id].value = "disabled"
212 return True
213 -
214 -
215 --
216 2.28.0