summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-09-21 16:53:31 +0000
committerZac Medico <zmedico@gentoo.org>2008-09-21 16:53:31 +0000
commit29036c4bfc548426b85bae0ab7f373e986aca9fe (patch)
treeec247e4bdaeea0fc70b1043bc7911b1842592be3
parentAlways call `cd "$WORKDIR"` to ensure that $CWD is sane whenever possible. (diff)
downloadportage-multirepo-2.2_rc9.tar.gz
portage-multirepo-2.2_rc9.tar.bz2
portage-multirepo-2.2_rc9.zip
Add a new --list-sets action, as requested by jmbsvicetto.v2.2_rc9
svn path=/main/trunk/; revision=11531
-rw-r--r--man/emerge.16
-rw-r--r--pym/_emerge/__init__.py15
-rw-r--r--pym/_emerge/help.py8
3 files changed, 21 insertions, 8 deletions
diff --git a/man/emerge.1 b/man/emerge.1
index e4e0533b..a14cc615 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -67,7 +67,8 @@ 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.
+recognized. Use the \fB\-\-list\-sets\fR action to display a list of
+available package sets.
.TP
.BR atom
An \fIatom\fR describes bounds on a package that you wish to install.
@@ -142,6 +143,9 @@ 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
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 6cfe7eb6..b0d67559 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -197,12 +197,12 @@ def userquery(prompt, responses=None, colours=None):
print "Interrupted."
sys.exit(1)
-actions=[
+actions = frozenset([
"clean", "config", "depclean",
-"info", "metadata",
+"info", "list-sets", "metadata",
"prune", "regen", "search",
"sync", "unmerge",
-]
+])
options=[
"--ask", "--alphabetical",
"--buildpkg", "--buildpkgonly",
@@ -13518,10 +13518,15 @@ def emerge_main():
print colorize("BAD", "\n*** emerging by path is broken and may not always work!!!\n")
break
+ root_config = trees[settings["ROOT"]]["root_config"]
+ if myaction == "list-sets":
+ sys.stdout.write("".join("%s\n" % s for s in sorted(root_config.sets)))
+ sys.stdout.flush()
+ return os.EX_OK
+
# only expand sets for actions taking package arguments
oldargs = myfiles[:]
if myaction in ("clean", "config", "depclean", "info", "prune", "unmerge", None):
- root_config = trees[settings["ROOT"]]["root_config"]
setconfig = root_config.setconfig
# display errors that occured while loading the SetConfig instance
for e in setconfig.errors:
@@ -13763,8 +13768,6 @@ def emerge_main():
"not support '--pretend'.\n") % myaction)
return 1
- root_config = trees[settings["ROOT"]]["root_config"]
-
if "sync" == myaction:
return action_sync(settings, trees, mtimedb, myopts, myaction)
elif "metadata" == myaction:
diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py
index e0b93480..5c7b0d6e 100644
--- a/pym/_emerge/help.py
+++ b/pym/_emerge/help.py
@@ -20,7 +20,7 @@ def shorthelp():
print " [ "+green("--jobs") + " " + turquoise("JOBS")+" ] [ "+green("--keep-going")+" ] [ " + green("--load-average")+" " + turquoise("LOAD") + " ]"
print " [ "+green("--newuse")+" ] [ "+green("--noconfmem")+" ] [ "+green("--nospinner")+" ] [ "+green("--oneshot")+" ]"
print " [ "+green("--reinstall ")+turquoise("changed-use")+" ] [ " + green("--with-bdeps")+" < " + turquoise("y") + " | "+ turquoise("n")+" > ]"
- print bold("Actions:")+" [ "+green("--clean")+" | "+green("--depclean")+" | "+green("--prune")+" | "+green("--regen")+" | "+green("--search")+" | "+green("--unmerge")+" ]"
+ print bold("Actions:")+" [ "+green("--depclean")+" | "+green("--list-sets")+" | "+green("--search")+" | "+green("--sync")+" | "+green("--version")+" ]"
def help(myaction,myopts,havecolor=1):
# TODO: Implement a wrap() that accounts for console color escape codes.
@@ -112,6 +112,12 @@ def help(myaction,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"