parent, atom = parent_atom
atom_set = InternalPackageSet(
initial_atoms=(atom,))
- if atom_set.findAtomForPackage(pkg):
+ if atom_set.findAtomForPackage(pkg, modified_use=self._pkg_use_enabled(pkg)):
parent_atoms.add(parent_atom)
else:
self._dynamic_config._slot_conflict_parent_atoms.add(parent_atom)
# Use package set for matching since it will match via
# PROVIDE when necessary, while match_from_list does not.
atom_set = InternalPackageSet(initial_atoms=[dep.atom])
- if not atom_set.findAtomForPackage(existing_node):
+ if not atom_set.findAtomForPackage(existing_node, \
+ modified_use=self._pkg_use_enabled(existing_node)):
existing_node_matches = False
if existing_node_matches:
# The existing node can be reused.
for pkg2 in pkgs:
if pkg2 is pkg1:
continue
- if atom_set.findAtomForPackage(pkg2):
+ if atom_set.findAtomForPackage(pkg2, modified_use=self._pkg_use_enabled(pkg2)):
atom_pkg_graph.add(pkg2, atom)
for pkg in pkgs:
# filter packages that conflict with highest_pkg
greedy_pkgs = [pkg for pkg in greedy_pkgs if not \
- (blockers[highest_pkg].findAtomForPackage(pkg) or \
- blockers[pkg].findAtomForPackage(highest_pkg))]
+ (blockers[highest_pkg].findAtomForPackage(pkg, modified_use=self._pkg_use_enabled(pkg)) or \
+ blockers[pkg].findAtomForPackage(highest_pkg, modified_use=self._pkg_use_enabled(highest_pkg)))]
if not greedy_pkgs:
return []
pkg2 = greedy_pkgs[j]
if pkg2 in discard_pkgs:
continue
- if blockers[pkg1].findAtomForPackage(pkg2) or \
- blockers[pkg2].findAtomForPackage(pkg1):
+ if blockers[pkg1].findAtomForPackage(pkg2, modified_use=self._pkg_use_enabled(pkg2)) or \
+ blockers[pkg2].findAtomForPackage(pkg1, modified_use=self._pkg_use_enabled(pkg1)):
# pkg1 > pkg2
discard_pkgs.add(pkg2)
# old-style virtual match even in cases when the
# package does not actually PROVIDE the virtual.
# Filter out any such false matches here.
- if not atom_set.findAtomForPackage(pkg):
+ if not atom_set.findAtomForPackage(pkg, modified_use=self._pkg_use_enabled(pkg)):
continue
if pkg in self._dynamic_config._runtime_pkg_mask:
backtrack_reasons = \
mreasons.append('backtracking: %s' % \
', '.join(sorted(backtrack_reasons)))
backtrack_mask = True
- if not mreasons and self._frozen_config.excluded_pkgs.findAtomForPackage(pkg):
+ if not mreasons and self._frozen_config.excluded_pkgs.findAtomForPackage(pkg, \
+ modified_use=self._pkg_use_enabled(pkg)):
mreasons = ["exclude option"]
if mreasons:
masked_pkg_instances.add(pkg)
# package does not actually PROVIDE the virtual.
# Filter out any such false matches here.
if not InternalPackageSet(initial_atoms=(atom,)
- ).findAtomForPackage(pkg):
+ ).findAtomForPackage(pkg, modified_use=self._pkg_use_enabled(pkg)):
continue
yield pkg
continue
if not pkg.installed and \
- self._frozen_config.excluded_pkgs.findAtomForPackage(pkg):
+ self._frozen_config.excluded_pkgs.findAtomForPackage(pkg, \
+ modified_use=self._pkg_use_enabled(pkg)):
continue
if dont_miss_updates:
break
# Use PackageSet.findAtomForPackage()
# for PROVIDE support.
- if atom_set.findAtomForPackage(e_pkg):
+ if atom_set.findAtomForPackage(e_pkg, modified_use=self._pkg_use_enabled(e_pkg)):
if highest_version and \
e_pkg.cp == atom_cp and \
e_pkg < highest_version and \
blocked_initial = set()
for atom in atoms:
for pkg in initial_db.match_pkgs(atom):
- if atom_set.findAtomForPackage(pkg):
+ if atom_set.findAtomForPackage(pkg, modified_use=self._pkg_use_enabled(pkg)):
blocked_initial.add(pkg)
blocked_final = set()
for atom in atoms:
for pkg in final_db.match_pkgs(atom):
- if atom_set.findAtomForPackage(pkg):
+ if atom_set.findAtomForPackage(pkg, modified_use=self._pkg_use_enabled(pkg)):
blocked_final.add(pkg)
if not blocked_initial and not blocked_final:
pkg_system = False
pkg_world = False
try:
- pkg_system = system_set.findAtomForPackage(pkg)
- pkg_world = world_set.findAtomForPackage(pkg)
+ pkg_system = system_set.findAtomForPackage(pkg, modified_use=self._pkg_use_enabled(pkg))
+ pkg_world = world_set.findAtomForPackage(pkg, modified_use=self._pkg_use_enabled(pkg))
if not (oneshot or pkg_world) and \
myroot == self._frozen_config.target_root and \
- favorites_set.findAtomForPackage(pkg):
+ favorites_set.findAtomForPackage(pkg, modified_use=self._pkg_use_enabled(pkg)):
# Maybe it will be added to world now.
if create_world_atom(pkg, favorites_set, root_config):
pkg_world = True
raise
if "merge" == pkg.operation and \
- self._frozen_config.excluded_pkgs.findAtomForPackage(pkg):
+ self._frozen_config.excluded_pkgs.findAtomForPackage(pkg, \
+ modified_use=self._pkg_use_enabled(pkg)):
continue
if "merge" == pkg.operation and not self._pkg_visibility_check(pkg):
if other_pkg == pkg:
continue
- if not atom_without_use_set.findAtomForPackage(other_pkg):
+ if not atom_without_use_set.findAtomForPackage(other_pkg, \
+ modified_use=_pkg_use_enabled(other_pkg)):
#The version range does not match.
sub_type = None
if atom.operator in (">=", ">"):
atoms.add((ppkg, atom, other_pkg))
num_all_specific_atoms += 1
collision_reasons[("version", sub_type)] = atoms
- elif not atom_set.findAtomForPackage(other_pkg):
+ elif not atom_set.findAtomForPackage(other_pkg, \
+ modified_use=_pkg_use_enabled(other_pkg)):
#Use conditionals not met.
violated_atom = atom.violated_conditionals(_pkg_use_enabled(other_pkg), \
other_pkg.iuse.is_valid_flag, _pkg_use_enabled(ppkg))
continue
i = InternalPackageSet(initial_atoms=(atom,))
- if i.findAtomForPackage(pkg):
+ if i.findAtomForPackage(pkg, modified_use=_pkg_use_enabled(pkg)):
continue
i = InternalPackageSet(initial_atoms=(atom.without_use,))
- if not i.findAtomForPackage(pkg):
+ if not i.findAtomForPackage(pkg, modified_use=_pkg_use_enabled(pkg)):
#Version range does not match.
if self.debug:
writemsg(str(pkg) + " does not satify all version requirements." + \
#Check if all atoms are satisfied after the changes are applied.
for id, pkg in enumerate(config):
+ new_use = _pkg_use_enabled(pkg)
if pkg in required_changes:
- old_use = set(_pkg_use_enabled(pkg))
- new_use = set(_pkg_use_enabled(pkg))
- use_has_changed = False
+ old_use = pkg.use.enabled
+ new_use = set(new_use)
for flag, state in required_changes[pkg].items():
- if state == "enabled" and flag not in new_use:
+ if state == "enabled":
new_use.add(flag)
- use_has_changed = True
- elif state == "disabled" and flag in new_use:
- use_has_changed = True
- new_use.remove(flag)
- if use_has_changed:
- new_pkg = pkg.copy()
- new_pkg.metadata["USE"] = " ".join(new_use)
- else:
- new_pkg = pkg
- else:
- new_pkg = pkg
+ elif state == "disabled":
+ new_use.discard(flag)
+ if not new_use.symmetric_difference(old_use):
+ #avoid copying the package in findAtomForPackage if possible
+ new_use = old_use
for ppkg, atom in all_conflict_atoms_by_slotatom[id]:
if not hasattr(ppkg, "use"):
#It's a SetArg or something like that.
continue
- new_use = set(_pkg_use_enabled(ppkg))
+ ppkg_new_use = set(_pkg_use_enabled(ppkg))
if ppkg in required_changes:
for flag, state in required_changes[ppkg].items():
- if state == "enabled" and flag not in new_use:
- new_use.add(flag)
- elif state == "disabled" and flag in new_use:
- new_use.remove(flag)
+ if state == "enabled":
+ ppkg_new_use.add(flag)
+ elif state == "disabled":
+ ppkg_new_use.discard(flag)
- new_atom = atom.unevaluated_atom.evaluate_conditionals(new_use)
+ new_atom = atom.unevaluated_atom.evaluate_conditionals(ppkg_new_use)
i = InternalPackageSet(initial_atoms=(new_atom,))
- if not i.findAtomForPackage(new_pkg):
+ if not i.findAtomForPackage(pkg, new_use):
#We managed to create a new problem with our changes.
is_valid_solution = False
if self.debug:
- writemsg("new conflict introduced: " + str(new_pkg) + \
+ writemsg("new conflict introduced: " + str(pkg) + \
" does not match " + new_atom + " from " + str(ppkg) + "\n", noiselevel=-1)
break