summaryrefslogtreecommitdiffstats
path: root/pym
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 /pym
parent9ffef1292f6bd2842e543c1e6162b2dd57cb3535 (diff)
downloadportage-29036c4bfc548426b85bae0ab7f373e986aca9fe.tar.gz
portage-29036c4bfc548426b85bae0ab7f373e986aca9fe.tar.bz2
portage-29036c4bfc548426b85bae0ab7f373e986aca9fe.zip
Add a new --list-sets action, as requested by jmbsvicetto.v2.2_rc9
svn path=/main/trunk/; revision=11531
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/__init__.py15
-rw-r--r--pym/_emerge/help.py8
2 files changed, 16 insertions, 7 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 6cfe7eb66..b0d675594 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 e0b93480c..5c7b0d6e6 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"