2.1.6 branch.
svn path=/main/branches/2.1.7/; revision=14549
.TP
.BR set
A \fIset\fR is a convenient shorthand for a large group of
-packages. Two sets are currently always available: \fBsystem\fR
+packages. Two sets are currently available: \fBsystem\fR
and \fBworld\fR. \fBsystem\fR refers to a set of packages
deemed necessary for your system to run properly. \fBworld\fR
contains all the packages listed in \fB/var/lib/portage/world\fR. [See
-\fBFILES\fR below for more information.] Other sets can exist depending
-on the current configuration. The default set configuration is located
-in \fB/usr/share/portage/config/sets.conf\fR. Note that a \fIset\fR
-is generally used in conjunction with \fB\-\-update\fR. When used as
-arguments to \fBemerge\fR sets have to be prefixed with \fB@\fR to be
-recognized. Use the \fB\-\-list\-sets\fR action to display a list of
-available package sets.
+\fBFILES\fR below for more information.] The world set
+also includes members of the system set. Note that a \fIset\fR
+is generally used in conjunction with \fB\-\-update\fR.
.TP
.BR atom
An \fIatom\fR describes bounds on a package that you wish to install.
.BR \-\-depclean
Cleans the system by removing packages that are not associated
with explicitly merged packages. Depclean works by creating the
-full dependency tree from the @system and @world sets,
+full dependency tree from the system and world sets,
then comparing it to installed packages. Packages installed, but
not part of the dependency tree, will be uninstalled by depclean.
See \fB\-\-with\-bdeps\fR for behavior with respect to build time dependencies
\-\-noreplace <atom>\fR. As a safety measure, depclean will not remove any
packages unless *all* required dependencies have been resolved. As a
consequence, it is often necessary to run \fIemerge \-\-update \-\-newuse
-\-\-deep @system @world\fR prior to depclean.
+\-\-deep world\fR prior to depclean.
\fBWARNING:\fR
Inexperienced users are advised to use \fB\-\-pretend\fR with this
information when submitting a bug report.\fR Expanded output can be obtained
with the \fI\-\-verbose\fR option.
.TP
-.BR \-\-list\-sets
-Displays a list of available package sets.
-.TP
.BR \-\-metadata
Transfers metadata cache from ${PORTDIR}/metadata/cache/ to
/var/cache/edb/dep/ as is normally done on the
Here is a common list of files you will probably be interested in. For a
complete listing, please refer to the \fBportage\fR(5) man page.
.TP
-.B /usr/share/portage/config/sets.conf
-Contains the default set configuration.
-.TP
.B /var/lib/portage/world
Contains a list of all user\-specified packages. You can safely edit
this file, adding packages that you want to be considered in \fBworld\fR
self.set = set
self.name = self.arg[len(SETPREFIX):]
+ def __str__(self):
+ return self.name
msg.append("unless *all* required dependencies have been resolved. As a\n")
msg.append("consequence, it is often necessary to run %s\n" % \
good("`emerge --update"))
- msg.append(good("--newuse --deep @system @world`") + \
+ msg.append(good("--newuse --deep world`") + \
" prior to depclean.\n")
if action == "depclean" and "--quiet" not in myopts and not myfiles:
msg.append(" %s" % (parent,))
msg.append("")
msg.append("Have you forgotten to run " + \
- good("`emerge --update --newuse --deep @system @world`") + " prior")
+ good("`emerge --update --newuse --deep world`") + " prior")
msg.append(("to %s? It may be necessary to manually " + \
"uninstall packages that no longer") % action)
msg.append("exist in the portage tree since " + \
if not parent_atoms:
atom = self._dynamic_config._blocked_world_pkgs.get(pkg)
if atom is not None:
- parent_atoms = set([("@world", atom)])
+ parent_atoms = set([("world", atom)])
if parent_atoms:
conflict_pkgs[pkg] = parent_atoms
def shorthelp():
print(bold("emerge:")+" the other white meat (command-line interface to the Portage system)")
print(bold("Usage:"))
- print(" "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] [ "+turquoise("ebuild")+" | "+turquoise("tbz2")+" | "+turquoise("file")+" | "+turquoise("@set")+" | "+turquoise("atom")+" ] [ ... ]")
+ print(" "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] [ "+turquoise("ebuild")+" | "+turquoise("tbz2")+" | "+turquoise("file")+" | "+turquoise("set")+" | "+turquoise("atom")+" ] [ ... ]")
print(" "+turquoise("emerge")+" [ "+green("options")+" ] [ "+green("action")+" ] < "+turquoise("system")+" | "+turquoise("world")+" >")
#print(" "+turquoise("emerge")+" < "+turquoise("--sync")+" | "+turquoise("--metadata")+" | "+turquoise("--info")+" >")
print(" "+turquoise("emerge")+" "+turquoise("--resume")+" [ "+green("--pretend")+" | "+green("--ask")+" | "+green("--skipfirst")+" ]")
print(" [ "+green("--newuse")+" ] [ "+green("--noconfmem")+" ] [ "+green("--nospinner")+" ]")
print(" [ "+green("--oneshot")+" ] [ "+green("--onlydeps")+" ]")
print(" [ "+green("--reinstall ")+turquoise("changed-use")+" ] [ " + green("--with-bdeps")+" < " + turquoise("y") + " | "+ turquoise("n")+" > ]")
- print(bold("Actions:")+" [ "+green("--depclean")+" | "+green("--list-sets")+" | "+green("--search")+" | "+green("--sync")+" | "+green("--version")+" ]")
+ print(bold("Actions:")+" [ "+green("--depclean")+" | "+" | "+green("--search")+" | "+green("--sync")+" | "+green("--version")+" ]")
def help(myopts, havecolor=1):
# TODO: Implement a wrap() that accounts for console color escape codes.
paragraph = "Cleans the system by removing packages that are " + \
"not associated with explicitly merged packages. Depclean works " + \
- "by creating the full dependency tree from the @system and " + \
- "@world sets, then comparing it to installed packages. Packages " + \
+ "by creating the full dependency tree from the system and " + \
+ "world sets, then comparing it to installed packages. Packages " + \
"installed, but not part of the dependency tree, will be " + \
"uninstalled by depclean. See --with-bdeps for behavior with " + \
"respect to build time dependencies that are not strictly " + \
"emerge --noreplace <atom>. As a safety measure, depclean " + \
"will not remove any packages unless *all* required dependencies " + \
"have been resolved. As a consequence, it is often necessary to " + \
- "run emerge --update --newuse --deep @system @world " + \
+ "run emerge --update --newuse --deep world " + \
"prior to depclean."
for line in wrap(paragraph, desc_width):
print(" make.{conf,globals,defaults} and the environment show up if")
print(" run with the '--verbose' flag.")
print()
- print(" " + green("--list-sets"))
- paragraph = "Displays a list of available package sets."
-
- for line in wrap(paragraph, desc_width):
- print(desc_indent + line)
- print()
print(" "+green("--metadata"))
print(" Transfers metadata cache from ${PORTDIR}/metadata/cache/ to")
print(" /var/cache/edb/dep/ as is normally done on the tail end of an")
actions = frozenset([
"clean", "config", "depclean", "help",
- "info", "list-sets", "metadata",
+ "info", "metadata",
"prune", "regen", "search",
"sync", "unmerge", "version",
])
out.eerror("See the make.conf(5) man page for PORTAGE_IONICE_COMMAND usage instructions.")
def expand_set_arguments(myfiles, myaction, root_config):
- retval = os.EX_OK
- setconfig = root_config.setconfig
-
- sets = setconfig.getSets()
-
- # In order to know exactly which atoms/sets should be added to the
- # world file, the depgraph performs set expansion later. It will get
- # confused about where the atoms came from if it's not allowed to
- # expand them itself.
- do_not_expand = (None, )
- newargs = []
- for a in myfiles:
- if a in ("system", "world"):
- newargs.append(SETPREFIX+a)
- else:
- newargs.append(a)
- myfiles = newargs
- del newargs
- newargs = []
-
- # separators for set arguments
- ARG_START = "{"
- ARG_END = "}"
-
- for i in range(0, len(myfiles)):
- if myfiles[i].startswith(SETPREFIX):
- start = 0
- end = 0
- x = myfiles[i][len(SETPREFIX):]
- newset = ""
- while x:
- start = x.find(ARG_START)
- end = x.find(ARG_END)
- if start > 0 and start < end:
- namepart = x[:start]
- argpart = x[start+1:end]
-
- # TODO: implement proper quoting
- args = argpart.split(",")
- options = {}
- for a in args:
- if "=" in a:
- k, v = a.split("=", 1)
- options[k] = v
- else:
- options[a] = "True"
- setconfig.update(namepart, options)
- newset += (x[:start-len(namepart)]+namepart)
- x = x[end+len(ARG_END):]
- else:
- newset += x
- x = ""
- myfiles[i] = SETPREFIX+newset
-
- sets = setconfig.getSets()
-
- # display errors that occured while loading the SetConfig instance
- for e in setconfig.errors:
- print(colorize("BAD", "Error during set creation: %s" % e))
-
- # emerge relies on the existance of sets with names "world" and "system"
- required_sets = ("world", "system")
- missing_sets = []
-
- for s in required_sets:
- if s not in sets:
- missing_sets.append(s)
- if missing_sets:
- if len(missing_sets) > 2:
- missing_sets_str = ", ".join('"%s"' % s for s in missing_sets[:-1])
- missing_sets_str += ', and "%s"' % missing_sets[-1]
- elif len(missing_sets) == 2:
- missing_sets_str = '"%s" and "%s"' % tuple(missing_sets)
- else:
- missing_sets_str = '"%s"' % missing_sets[-1]
- msg = ["emerge: incomplete set configuration, " + \
- "missing set(s): %s" % missing_sets_str]
- if sets:
- msg.append(" sets defined: %s" % ", ".join(sets))
- msg.append(" This usually means that '%s'" % \
- (os.path.join(portage.const.GLOBAL_CONFIG_PATH, "sets.conf"),))
- msg.append(" is missing or corrupt.")
- for line in msg:
- writemsg_level(line + "\n", level=logging.ERROR, noiselevel=-1)
- return (None, 1)
- unmerge_actions = ("unmerge", "prune", "clean", "depclean")
-
- for a in myfiles:
- if a.startswith(SETPREFIX):
- s = a[len(SETPREFIX):]
- if s not in sets:
- display_missing_pkg_set(root_config, s)
- return (None, 1)
- setconfig.active.append(s)
- try:
- set_atoms = setconfig.getSetAtoms(s)
- except portage.exception.PackageSetNotFound as e:
- writemsg_level(("emerge: the given set '%s' " + \
- "contains a non-existent set named '%s'.\n") % \
- (s, e), level=logging.ERROR, noiselevel=-1)
- return (None, 1)
- if myaction in unmerge_actions and \
- not sets[s].supportsOperation("unmerge"):
- sys.stderr.write("emerge: the given set '%s' does " % s + \
- "not support unmerge operations\n")
- retval = 1
- elif not set_atoms:
- print("emerge: '%s' is an empty set" % s)
- elif myaction not in do_not_expand:
- newargs.extend(set_atoms)
- else:
- newargs.append(SETPREFIX+s)
- for e in sets[s].errors:
- print(e)
- else:
- newargs.append(a)
- return (newargs, retval)
+
+ if myaction != "search":
+
+ world = False
+ system = False
+
+ for x in myfiles:
+ if x[:1] == SETPREFIX:
+ msg = []
+ msg.append("'%s' is not a valid package atom." % (x,))
+ msg.append("Please check ebuild(5) for full details.")
+ writemsg_level("".join("!!! %s\n" % line for line in msg),
+ level=logging.ERROR, noiselevel=-1)
+ return (myfiles, 1)
+ elif x == "system":
+ system = True
+ elif x == "world":
+ world = True
+
+ if myaction is not None:
+ if system:
+ multiple_actions("system", myaction)
+ return (myfiles, 1)
+ elif world:
+ multiple_actions("world", myaction)
+ return (myfiles, 1)
+
+ return (myfiles, os.EX_OK)
def repo_name_check(trees):
missing_repo_names = set()
break
root_config = trees[settings["ROOT"]]["root_config"]
- if myaction == "list-sets":
- writemsg_stdout("".join("%s\n" % s for s in sorted(root_config.sets)))
- return os.EX_OK
# only expand sets for actions taking package arguments
oldargs = myfiles[:]
self.packagematches = []
if self.searchdesc:
self.searchdesc=1
- self.matches = {"pkg":[], "desc":[], "set":[]}
+ self.matches = {"pkg":[], "desc":[],}
else:
self.searchdesc=0
- self.matches = {"pkg":[], "set":[]}
+ self.matches = {"pkg":[],}
print("Searching... ", end=' ')
regexsearch = False
if self.searchre.search(full_desc):
self.matches["desc"].append([full_package,masked])
- self.sdict = self.setconfig.getSets()
- for setname in self.sdict:
- self._spinner_update()
- if match_category:
- match_string = setname
- else:
- match_string = setname.split("/")[-1]
-
- if self.searchre.search(match_string):
- self.matches["set"].append([setname, False])
- elif self.searchdesc:
- if self.searchre.search(
- self.sdict[setname].getMetadata("DESCRIPTION")):
- self.matches["set"].append([setname, False])
-
self.mlen=0
for mtype in self.matches:
self.matches[mtype].sort()
elif mtype == "desc":
full_package = match
match = portage.cpv_getkey(match)
- elif mtype == "set":
- msg = []
- msg.append(green("*") + " " + bold(match) + "\n")
- if self.verbose:
- msg.append(" " + darkgreen("Description:") + \
- " " + \
- self.sdict[match].getMetadata("DESCRIPTION") \
- + "\n\n")
- writemsg_stdout(''.join(msg), noiselevel=-1)
+
if full_package:
try:
desc, homepage, license = self.portdb.aux_get(
if vdb_lock:
vartree.dbapi.flush_cache()
portage.locks.unlockdir(vdb_lock)
-
- from portage._sets.base import EditablePackageSet
-
- # generate a list of package sets that are directly or indirectly listed in "world",
- # as there is no persistent list of "installed" sets
- installed_sets = ["world"]
- stop = False
- pos = 0
- while not stop:
- stop = True
- pos = len(installed_sets)
- for s in installed_sets[pos - 1:]:
- if s not in sets:
- continue
- candidates = [x[len(SETPREFIX):] for x in sets[s].getNonAtoms() if x.startswith(SETPREFIX)]
- if candidates:
- stop = False
- installed_sets += candidates
- installed_sets = [x for x in installed_sets if x not in root_config.setconfig.active]
- del stop, pos
- # we don't want to unmerge packages that are still listed in user-editable package sets
- # listed in "world" as they would be remerged on the next update of "world" or the
- # relevant package sets.
- unknown_sets = set()
for cp in range(len(pkgmap)):
for cpv in pkgmap[cp]["selected"].copy():
try:
pkgmap[cp]["protected"].add(cpv)
continue
- parents = []
- for s in installed_sets:
- # skip sets that the user requested to unmerge, and skip world
- # unless we're unmerging a package set (as the package would be
- # removed from "world" later on)
- if s in root_config.setconfig.active or (s == "world" and not root_config.setconfig.active):
- continue
-
- if s not in sets:
- if s in unknown_sets:
- continue
- unknown_sets.add(s)
- out = portage.output.EOutput()
- out.eerror(("Unknown set '@%s' in %s%s") % \
- (s, root_config.root, portage.const.WORLD_SETS_FILE))
- continue
-
- # only check instances of EditablePackageSet as other classes are generally used for
- # special purposes and can be ignored here (and are usually generated dynamically, so the
- # user can't do much about them anyway)
- if isinstance(sets[s], EditablePackageSet):
-
- # This is derived from a snippet of code in the
- # depgraph._iter_atoms_for_pkg() method.
- for atom in sets[s].iterAtomsForPackage(pkg):
- inst_matches = vartree.dbapi.match(atom)
- inst_matches.reverse() # descending order
- higher_slot = None
- for inst_cpv in inst_matches:
- try:
- inst_pkg = _pkg(inst_cpv)
- except KeyError:
- # It could have been uninstalled
- # by a concurrent process.
- continue
-
- if inst_pkg.cp != atom.cp:
- continue
- if pkg >= inst_pkg:
- # This is descending order, and we're not
- # interested in any versions <= pkg given.
- break
- if pkg.slot_atom != inst_pkg.slot_atom:
- higher_slot = inst_pkg
- break
- if higher_slot is None:
- parents.append(s)
- break
- if parents:
- #print colorize("WARN", "Package %s is going to be unmerged," % cpv)
- #print colorize("WARN", "but still listed in the following package sets:")
- #print " %s\n" % ", ".join(parents)
- print(colorize("WARN", "Not unmerging package %s as it is" % cpv))
- print(colorize("WARN", "still referenced by the following package sets:"))
- print(" %s\n" % ", ".join(parents))
- # adjust pkgmap so the display output is correct
- pkgmap[cp]["selected"].remove(cpv)
- all_selected.remove(cpv)
- pkgmap[cp]["protected"].add(cpv)
-
- del installed_sets
-
numselected = len(all_selected)
if not numselected:
writemsg_level(