for atom in selected_atoms[pkg]:
try:
-
- atom = portage.dep.Atom(atom)
-
mypriority = dep_priority.copy()
if not atom.blocker and vardb.match(atom):
mypriority.satisfied = True
atom_arg_map = self._dynamic_config._atom_arg_map
root_config = self._frozen_config.roots[pkg.root]
for atom in self._dynamic_config._set_atoms.iterAtomsForPackage(pkg):
- atom_cp = portage.dep_getkey(atom)
- if atom_cp != pkg.cp and \
- self._have_new_virt(pkg.root, atom_cp):
+ if atom.cp != pkg.cp and \
+ self._have_new_virt(pkg.root, atom.cp):
continue
visible_pkgs = \
self._dynamic_config._visible_pkgs[pkg.root].match_pkgs(atom)
visible_pkgs.reverse() # descending order
higher_slot = None
for visible_pkg in visible_pkgs:
- if visible_pkg.cp != atom_cp:
+ if visible_pkg.cp != atom.cp:
continue
if pkg >= visible_pkg:
# This is descending order, and we're not
self._spinner_update()
dep = Dependency(atom=atom, onlydeps=onlydeps,
root=myroot, parent=arg)
- atom_cp = portage.dep_getkey(atom)
try:
- pprovided = pprovideddict.get(portage.dep_getkey(atom))
+ pprovided = pprovideddict.get(atom.cp)
if pprovided and portage.match_from_list(atom, pprovided):
# A provided package has been specified on the command line.
self._dynamic_config._pprovided_args.append((arg, atom))
return 0, myfavorites
self._dynamic_config._missing_args.append((arg, atom))
continue
- if atom_cp != pkg.cp:
+ if atom.cp != pkg.cp:
# For old-style virtuals, we need to repeat the
# package.provided check against the selected package.
- expanded_atom = atom.replace(atom_cp, pkg.cp)
+ expanded_atom = atom.replace(atom.cp, pkg.cp)
pprovided = pprovideddict.get(pkg.cp)
if pprovided and \
portage.match_from_list(expanded_atom, pprovided):
# Filter out any old-style virtual matches if they are
# mixed with new-style virtual matches.
- cp = portage.dep_getkey(atom)
+ cp = atom.cp
if len(matched_packages) > 1 and \
"virtual" == portage.catsplit(cp)[0]:
for pkg in matched_packages:
for provider_entry in virtuals[blocker.cp]:
provider_cp = \
portage.dep_getkey(provider_entry)
- atoms.append(blocker.atom.replace(
- blocker.cp, provider_cp))
+ atoms.append(Atom(blocker.atom.replace(
+ blocker.cp, provider_cp)))
else:
atoms = [blocker.atom]
# any matching slots in the graph db.
slots = set()
slots.add(pkg.metadata["SLOT"])
- atom_cp = portage.dep_getkey(atom)
if pkg.cp.startswith("virtual/"):
# For new-style virtual lookahead that occurs inside
# dep_check(), examine all slots. This is needed
ret.append(pkg.cpv)
slots.remove(pkg.metadata["SLOT"])
while slots:
- slot_atom = "%s:%s" % (atom_cp, slots.pop())
+ slot_atom = Atom("%s:%s" % (atom.cp, slots.pop()))
pkg, existing = self._depgraph._select_package(
self._root, slot_atom)
if not pkg:
# an incremental!
myincrementals.remove("USE")
-
mydbs = self.configlist[:-1]
mydbs.append(self.backupenv)
if self.local_config and not self.treeVirtuals:
temp_vartree = vartree(myroot, None,
categories=self.categories, settings=self)
- # Reduce the provides into a list by CP.
- self.treeVirtuals = map_dictlist_vals(getCPFromCPV,temp_vartree.get_all_provides())
+ self._populate_treeVirtuals(temp_vartree)
self.virtuals = self.__getvirtuals_compile()
return self.virtuals
+ def _populate_treeVirtuals(self, vartree):
+ """Reduce the provides into a list by CP."""
+ for provide, cpv_list in vartree.get_all_provides().iteritems():
+ try:
+ provide = dep.Atom(provide)
+ except exception.InvalidAtom:
+ continue
+ self.treeVirtuals[provide.cp] = \
+ [dep.Atom(cpv_getkey(cpv)) for cpv in cpv_list]
+
def __getvirtuals_compile(self):
"""Stack installed and profile virtuals. Preference for virtuals
decreases from left to right.
# so do not check them again.
checkme = []
-
if not emerge_skip_distfiles and \
need_distfiles and not fetch(
fetchme, mysettings, listonly=listonly, fetchonly=fetchonly):
vartree.dbapi.linkmap._clear_cache()
mylink.unlockdb()
-def getCPFromCPV(mycpv):
- """Calls pkgsplit on a cpv and returns only the cp."""
- return pkgsplit(mycpv)[0]
-
def dep_virtual(mysplit, mysettings):
"Does virtual dependency conversion"
newsplit=[]
evaluated_atom += str(x.use.evaluate_conditionals(myuse))
x = portage.dep.Atom(evaluated_atom)
- mykey = dep_getkey(x)
+ mykey = x.cp
if not mykey.startswith("virtual/"):
newsplit.append(x)
if atom_graph is not None:
atom_graph.add(x, graph_parent)
continue
mychoices = myvirtuals.get(mykey, [])
- isblocker = x.startswith("!")
- if isblocker:
+ if x.blocker:
# Virtual blockers are no longer expanded here since
# the un-expanded virtual atom is more useful for
# maintaining a cache of blocker atoms.
# TODO: Add PROVIDE check for repoman.
a = []
for y in mychoices:
- a.append(portage.dep.Atom(x.replace(mykey, str(y.cp), 1)))
+ a.append(dep.Atom(x.replace(x.cp, y.cp, 1)))
if not a:
newsplit.append(x)
elif len(a) == 1:
# Plain old-style virtuals. New-style virtuals are preferred.
if not pkgs:
for y in mychoices:
- new_atom = portage.dep.Atom(
- x.replace(mykey, dep_getkey(y), 1))
+ new_atom = dep.Atom(x.replace(x.cp, y.cp, 1))
matches = portdb.match(new_atom)
# portdb is an instance of depgraph._dep_check_composite_db, so
# USE conditionals are already evaluated.
if not a and mychoices:
# Check for a virtual package.provided match.
for y in mychoices:
- new_atom = portage.dep.Atom(x.replace(mykey, dep_getkey(y), 1))
+ new_atom = dep.Atom(x.replace(x.cp, y.cp, 1))
if match_from_list(new_atom,
pprovideddict.get(new_atom.cp, [])):
a.append(new_atom)
if unreduced[0] != "||":
unresolved = []
- for dep, satisfied in izip(unreduced, reduced):
- if isinstance(dep, list):
- unresolved += dep_zapdeps(dep, satisfied, myroot,
+ for x, satisfied in izip(unreduced, reduced):
+ if isinstance(x, list):
+ unresolved += dep_zapdeps(x, satisfied, myroot,
use_binaries=use_binaries, trees=trees)
elif not satisfied:
- unresolved.append(dep)
+ unresolved.append(x)
return unresolved
# We're at a ( || atom ... ) type level and need to make a choice
# Sort the deps into installed, not installed but already
# in the graph and other, not installed and not in the graph
# and other, with values of [[required_atom], availablility]
- for dep, satisfied in izip(deps, satisfieds):
- if isinstance(dep, list):
- atoms = dep_zapdeps(dep, satisfied, myroot,
+ for x, satisfied in izip(deps, satisfieds):
+ if isinstance(x, list):
+ atoms = dep_zapdeps(x, satisfied, myroot,
use_binaries=use_binaries, trees=trees)
else:
- atoms = [dep]
+ atoms = [x]
if not vardb:
# called by repoman
other.append((atoms, None, False))
all_use_satisfied = True
versions = {}
for atom in atoms:
- if atom[:1] == "!":
+ if atom.blocker:
continue
# Ignore USE dependencies here since we don't want USE
# settings to adversely affect || preference evaluation.
avail_pkg = mydbapi.match(atom.without_use)
if avail_pkg:
avail_pkg = avail_pkg[-1] # highest (ascending order)
- avail_slot = "%s:%s" % (dep_getkey(atom),
- mydbapi.aux_get(avail_pkg, ["SLOT"])[0])
+ avail_slot = dep.Atom("%s:%s" % (atom.cp,
+ mydbapi.aux_get(avail_pkg, ["SLOT"])[0]))
if not avail_pkg:
all_available = False
all_use_satisfied = False
avail_pkg_use = avail_pkg_use[-1]
if avail_pkg_use != avail_pkg:
avail_pkg = avail_pkg_use
- avail_slot = "%s:%s" % (dep_getkey(atom),
- mydbapi.aux_get(avail_pkg, ["SLOT"])[0])
+ avail_slot = dep.Atom("%s:%s" % (atom.cp,
+ mydbapi.aux_get(avail_pkg, ["SLOT"])[0]))
versions[avail_slot] = avail_pkg
# If any version of a package is already in the graph then we
# assume that it is preferred over other possible packages choices.
all_installed = True
- for atom in set([dep_getkey(atom) for atom in atoms \
- if atom[:1] != "!"]):
+ for atom in set(dep.Atom(atom.cp) for atom in atoms \
+ if not atom.blocker):
# New-style virtuals have zero cost to install.
if not vardb.match(atom) and not atom.startswith("virtual/"):
all_installed = False
# installed package.
cpv_slot_list = [parent]
for atom in atoms:
- if "!" == atom[:1]:
+ if atom.blocker:
continue
if vardb.match(atom):
# If the atom is satisfied by an installed
# version then it's not a circular dep.
continue
- if dep_getkey(atom) != parent.cp:
+ if atom.cp != parent.cp:
continue
if match_from_list(atom, cpv_slot_list):
circular_atom = atom
assert(False) # This point should not be reachable
-
def dep_expand(mydep, mydb=None, use_cache=1, settings=None):
+ '''
+ @rtype: Atom
+ '''
if not len(mydep):
return mydep
if mydep[0]=="*":
mydep=mydep[1:]
orig_dep = mydep
- mydep = dep_getcpv(orig_dep)
+ if isinstance(orig_dep, dep.Atom):
+ mydep = orig_dep.cpv
+ else:
+ mydep = dep_getcpv(orig_dep)
myindex = orig_dep.index(mydep)
prefix = orig_dep[:myindex]
postfix = orig_dep[myindex+len(mydep):]
elif token[:1] == "!":
deplist[mypos] = False
else:
- mykey = dep_getkey(deplist[mypos])
+ mykey = deplist[mypos].cp
if mysettings and mykey in mysettings.pprovideddict and \
match_from_list(deplist[mypos], mysettings.pprovideddict[mykey]):
deplist[mypos]=True
return None
return deplist
+_cpv_key_re = re.compile('^' + dep._cpv + '$', re.VERBOSE)
def cpv_getkey(mycpv):
- return dep.dep_getkey('=' + mycpv)
+ """Calls pkgsplit on a cpv and returns only the cp."""
+ m = _cpv_key_re.match(mycpv)
+ if m is not None:
+ return m.group(2)
+ myslash = mycpv.split("/", 1)
+ mysplit=pkgsplit(myslash[-1])
+ if mysplit is None:
+ return None
+ mylen=len(myslash)
+ if mylen==2:
+ return myslash[0]+"/"+mysplit[0]
+ else:
+ return mysplit[0]
+
+getCPFromCPV = cpv_getkey
def key_expand(mykey, mydb=None, use_cache=1, settings=None):
mysplit=mykey.split("/")
return rValue
-
auxdbkeys=[
'DEPEND', 'RDEPEND', 'SLOT', 'SRC_URI',
'RESTRICT', 'HOMEPAGE', 'LICENSE', 'DESCRIPTION',
root = settings["ROOT"]
output._init(config_root=settings['PORTAGE_CONFIGROOT'])
-
# ========================================================================
# COMPATIBILITY
# These attributes should not be used