# valid db entries to candidate_catpkgs
if global_unmerge:
if not unmerge_files or "world" in unmerge_files:
- candidate_catpkgs.extend(vartree.dbapi.cpv_all())
+ candidate_catpkgs.extend(vartree.dbapi.cp_all())
elif "system" in unmerge_files:
candidate_catpkgs.extend(getlist(settings, "system"))
else:
print warn_prefix + "be kept. They can be manually added to this set with"
print warn_prefix + good("`emerge --noreplace <atom>`") + ". Packages that are listed in"
print warn_prefix + "package.provided (see portage(5)) will be removed by"
- print warn_prefix + "depclean, even if they are part of the world set. New-style"
- print warn_prefix + "virtuals (virtual/* packages installed by older versions of"
- print warn_prefix + "portage) will also be removed."
+ print warn_prefix + "depclean, even if they are part of the world set."
print warn_prefix
print warn_prefix + "As a safety measure, depclean will not remove any packages"
print warn_prefix + "unless *all* required dependencies have been resolved. As a"
os.umask(022)
settings, trees, mtimedb = load_emerge_config()
portdb = trees[settings["ROOT"]]["porttree"].dbapi
+
+ try:
+ os.nice(int(settings.get("PORTAGE_NICENESS", "0")))
+ except (OSError, ValueError), e:
+ portage.writemsg("!!! Failed to change nice value to '%s'\n" % \
+ settings["PORTAGE_NICENESS"])
+ portage.writemsg("!!! %s\n" % str(e))
+ del e
+
if portage.global_updates(settings, trees, mtimedb["updates"]):
mtimedb.commit()
# Reload the whole config from scratch.
portage.deprecated_profile_check()
- try:
- os.nice(int(settings.get("PORTAGE_NICENESS", "0")))
- except (OSError, ValueError), e:
- portage.writemsg("!!! Failed to change nice value to '%s'\n" % \
- settings["PORTAGE_NICENESS"])
- portage.writemsg("!!! %s\n" % str(e))
- del e
-
#Freeze the portdbapi for enhanced performance:
for myroot in trees:
trees[myroot]["porttree"].dbapi.freeze()
virts = flatten(portage_dep.use_reduce(portage_dep.paren_reduce(provides), uselist=myuse.split()))
cp = dep_getkey(mycpv)
- if cp.startswith("virtual/"):
- # Bridge new-style virtual into old-style.
- virts.append(cp)
for virt in virts:
virt = dep_getkey(virt)
if not self.treeVirtuals.has_key(virt):
virtuals = stack_dictlist([ptVirtuals, self.treeVirtuals,
self.dirVirtuals])
- # Bridge new-style virtuals into old-style.
- for k, v in virtuals.iteritems():
- if k not in v:
- v.append(k)
return virtuals
def __delitem__(self,mykey):
def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
trees=None, **kwargs):
"""Recursively expand new-style virtuals so as to collapse one or more
- levels of indirection. The new-style virtuals should never be installed
- themselves. They are only used to expand virtual dependencies. Virtual
+ levels of indirection. In dep_zapdeps, new-style virtuals will be assigned
+ zero cost regardless of whether or not they are currently installed. Virtual
blockers are supported but only when the virtual expands to a single
atom because it wouldn't necessarily make sense to block all the components
of a compound virtual. When more than one new-style virtual is matched,
def compare_pkgs(a, b):
return pkgcmp(b[1], a[1])
portdb = trees[myroot]["porttree"].dbapi
+ myvirtuals = mysettings.getvirtuals()
for x in mysplit:
if x == "||":
newsplit.append(x)
newsplit.append(_expand_new_virtuals(x, edebug, mydbapi,
mysettings, myroot=myroot, trees=trees, **kwargs))
continue
- elif not dep_getkey(x).startswith("virtual/"):
+ mykey = dep_getkey(x)
+ if not mykey.startswith("virtual/"):
newsplit.append(x)
continue
+ mychoices = myvirtuals.get(mykey, [])
isblocker = x.startswith("!")
match_atom = x
if isblocker:
# only use new-style matches
if cpv.startswith("virtual/"):
pkgs.append((cpv, pkgsplit(cpv)))
- if not pkgs:
+ if not (pkgs or mychoices):
+ # This one couldn't be expanded as a new-style virtual. Old-style
+ # virtuals have already been expanded by dep_virtual, so this one
+ # is unavailable and dep_zapdeps will identify it as such. The
+ # atom is not eliminated here since it may still represent a
+ # dependency that needs to be satisfied.
newsplit.append(x)
continue
+ if not pkgs and len(mychoices) == 1:
+ newsplit.append(x.replace(mykey, mychoices[0]))
+ continue
pkgs.sort(compare_pkgs) # Prefer higher versions.
if isblocker:
a = []
# compound virtual, so only a single atom block is allowed.
a.append("!" + virtual_atoms[0])
else:
+ mycheck[1].append("="+y[0]) # pull in the new-style virtual
a.append(mycheck[1])
+ # Plain old-style virtuals. New-style virtuals are preferred.
+ for y in mychoices:
+ a.append(x.replace(mykey, y))
if isblocker and not a:
# Probably a compound virtual. Pass the atom through unprocessed.
newsplit.append(x)
preference selection is handled later via slot and version comparison."""
all_installed = True
for atom in set([dep_getkey(atom) for atom in atoms]):
- if not vardb.match(atom):
+ # New-style virtuals have zero cost to install.
+ if not vardb.match(atom) and not atom.startswith("virtual/"):
all_installed = False
break
# over other atoms.
if all_installed and all_available:
for atom in atoms:
- inst_pkgs = vardb.match(dep_getkey(atom))
+ mykey = dep_getkey(atom)
+ if mykey.startswith("virtual/"):
+ # New-style virtuals have zero cost to install.
+ continue
+ inst_pkgs = vardb.match(mykey)
avail_pkg = best(mydbapi.match(atom))
avail_slot = mydbapi.aux_get(avail_pkg, ["SLOT"])[0]
avail_split = catpkgsplit(avail_pkg)[1:]
# Do the || conversions
mysplit=portage_dep.dep_opconvert(mysplit)
- #convert virtual dependencies to normal packages.
- mysplit=dep_virtual(mysplit, mysettings)
- #if mysplit is None, then we have a parse error (paren mismatch or misplaced ||)
- #up until here, we haven't needed to look at the database tree
-
- if mysplit is None:
- return [0,"Parse Error (parentheses mismatch?)"]
- elif mysplit==[]:
+ if mysplit == []:
#dependencies were reduced to nothing
return [1,[]]
if not mys:
mys = string.split(myprovide, "/")
myprovides += [mys[0] + "/" + mys[1]]
- if mycpv.startswith("virtual/"):
- # Bridge new-style virtual into old-style.
- myprovides.append(dep_getkey(mycpv))
return myprovides
except SystemExit, e:
raise