Revert the rest of the package sets related code and docs, to behave like the
authorZac Medico <zmedico@gentoo.org>
Sat, 10 Oct 2009 03:08:40 +0000 (03:08 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 10 Oct 2009 03:08:40 +0000 (03:08 -0000)
2.1.6 branch.

svn path=/main/branches/2.1.7/; revision=14549

man/emerge.1
pym/_emerge/SetArg.py
pym/_emerge/actions.py
pym/_emerge/depgraph.py
pym/_emerge/help.py
pym/_emerge/main.py
pym/_emerge/search.py
pym/_emerge/unmerge.py

index 90d7674f16dd68dd7395d5808e4ae7a5c009bb35..e9fcfe3f7e54c758f70f38e3e736b90382fbf836 100644 (file)
@@ -58,17 +58,13 @@ would like to query the owners of one or more files or directories.
 .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.  
@@ -105,7 +101,7 @@ setups that the user may wish to run.
 .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
@@ -114,7 +110,7 @@ always be kept. They can be manually added to this set with \fIemerge
 \-\-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
@@ -153,9 +149,6 @@ developers when fixing the reported problem.  \fBPlease include 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
@@ -760,9 +753,6 @@ Zac Medico <zmedico@gentoo.org>
 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
index 949bd6f7bee94ee60301bf47d69544afbaee360a..9428aab2603f3b808addfafdf78a3053413fd152 100644 (file)
@@ -10,3 +10,5 @@ class SetArg(DependencyArg):
                self.set = set
                self.name = self.arg[len(SETPREFIX):]
 
+       def __str__(self):
+               return self.name
index cb29dd1c97883a08abc5056934d401d3eee263e5..bae996be7b790f57a398a76170a7869969092256 100644 (file)
@@ -569,7 +569,7 @@ def action_depclean(settings, trees, ldpath_mtimes,
        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:
@@ -790,7 +790,7 @@ def calc_depclean(settings, trees, ldpath_mtimes,
                                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 " + \
index 9938a72c6108318a1ead854a4a3f33f536ad42fa..175cf4f193d70ab5e223c951a2d15c4d5dcd63eb 100644 (file)
@@ -3772,7 +3772,7 @@ class depgraph(object):
                                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
 
index 7b4c66dd9baf4725605bcde6c0150547f5fd0e2f..2f269bf7763dacaa38890c6a7f8e20ac075b8929 100644 (file)
@@ -9,7 +9,7 @@ from portage.output import bold, turquoise, green
 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")+" ]")
@@ -21,7 +21,7 @@ def shorthelp():
        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.
@@ -70,8 +70,8 @@ def help(myopts, havecolor=1):
 
                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 " + \
@@ -80,7 +80,7 @@ def help(myopts, havecolor=1):
                "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):
@@ -128,12 +128,6 @@ def help(myopts, havecolor=1):
                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")
index c3322c5e2769d84237922a01d2ba54c05101c03c..4215d80b9841ca73d3e52586b82963e18fe0e69b 100644 (file)
@@ -416,7 +416,7 @@ def parse_opts(tmpcmdline, silent=False):
 
        actions = frozenset([
                "clean", "config", "depclean", "help",
-               "info", "list-sets", "metadata",
+               "info", "metadata",
                "prune", "regen",  "search",
                "sync",  "unmerge", "version",
        ])
@@ -766,123 +766,34 @@ def ionice(settings):
                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()
@@ -1071,9 +982,6 @@ def emerge_main():
                        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[:]
index f0611f28a946143c3a9b83df56cbb9624bf838fe..ac39efc20d1ea6634a10aa4ee3c9b505e32c7f48 100644 (file)
@@ -182,10 +182,10 @@ class search(object):
                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
@@ -231,21 +231,6 @@ class search(object):
                                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()
@@ -281,15 +266,7 @@ class search(object):
                                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(
index 53699737e879d27bf5ac6d52aa9ad2afc50e0096..caf6e8e6895349bd338d4967054ff38ee61fc600 100644 (file)
@@ -280,31 +280,7 @@ def unmerge(root_config, myopts, unmerge_action,
                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:
@@ -328,68 +304,6 @@ def unmerge(root_config, myopts, unmerge_action,
                                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(