Combine the --rdeps-only and --root-deps options into a single --root-deps
authorZac Medico <zmedico@gentoo.org>
Wed, 1 Apr 2009 01:49:22 +0000 (01:49 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 1 Apr 2009 01:49:22 +0000 (01:49 -0000)
option which takes an optional 'rdeps' argument.

svn path=/main/trunk/; revision=13267

man/emerge.1
pym/_emerge/__init__.py
pym/_emerge/help.py

index 7a82a91bdcc38d9bcb7fc61261e2ed2a6e99adfd..44a746039a57b626041c643df9a28bb21d6dedbd 100644 (file)
@@ -414,13 +414,6 @@ b  blocked by another package (automatically resolved conflict)
 Results may vary, but the general outcome is a reduced or condensed
 output from portage's displays.
 .TP
-.BR "\-\-rdeps\-only"
-Discard all build\-time dependencies. This option is commonly used together
-with \fBROOT\fR and it should not be enabled under normal circumstances. For
-currently supported \fBEAPI\fR values, the dependencies specified in the
-\fBDEPEND\fR variable are discarded. However, behavior may change for new
-\fBEAPI\fRs when related extensions are added in the future.
-.TP
 .BR "\-\-reinstall changed\-use"
 Tells emerge to include installed packages where USE flags have
 changed since installation.  Unlike \fB\-\-newuse\fR, this option does
@@ -430,11 +423,14 @@ enabled are added or removed.
 .BR \-\-root=DIR
 Set the \fBROOT\fR environment variable.
 .TP
-.BR "\-\-root\-deps"
-Install build\-time dependencies to \fBROOT\fR instead of /. This option
-should not be enabled under normal circumstances. For currently supported
-\fBEAPI\fR values, the dependencies specified in the \fBDEPEND\fR variable
-are used. However, behavior may change for new
+.BR "\-\-root\-deps[=rdeps]"
+If no argument is given then build\-time dependencies are installed to
+\fBROOT\fR instead of /. If the \fBrdeps\fR argument is given then discard
+all build\-time dependencies of packages for \fBROOT\fR. This option is
+only meaningful when used together with \fBROOT\fR and it should not
+be enabled under normal circumstances. For currently supported
+\fBEAPI\fR values, the build-time dependencies are specified in the
+\fBDEPEND\fR variable. However, behavior may change for new
 \fBEAPI\fRs when related extensions are added in the future.
 .TP
 .BR "\-\-skipfirst"
index 103689c803ab804fc95f609c4290dbf15b93e34d..63fc92262b8f98343668cf0e17d99dd004120c96 100644 (file)
@@ -207,7 +207,6 @@ options=[
 "--nospinner",    "--oneshot",
 "--onlydeps",     "--pretend",
 "--quiet",        "--resume",
-"--rdeps-only",   "--root-deps",
 "--searchdesc",   "--selective",
 "--skipfirst",
 "--tree",
@@ -5277,9 +5276,11 @@ class depgraph(object):
 
                bdeps_root = "/"
                if self.target_root != "/":
-                       if "--root-deps" in self.myopts:
+                       root_deps = self.myopts.get("--root-deps")
+                       if root_deps is not None:
+                               if root_deps is True:
                                        bdeps_root = myroot
-                       if "--rdeps-only" in self.myopts:
+                               elif root_deps == "rdeps":
                                        bdeps_root = "/"
                                        edepend["DEPEND"] = ""
 
@@ -14769,11 +14770,22 @@ def insert_optional_args(args):
 
        new_args = []
        jobs_opts = ("-j", "--jobs")
+       root_deps_opt = '--root-deps'
+       root_deps_choices = ('True', 'rdeps')
        arg_stack = args[:]
        arg_stack.reverse()
        while arg_stack:
                arg = arg_stack.pop()
 
+               if arg == root_deps_opt:
+                       new_args.append(arg)
+                       if arg_stack and arg_stack[-1] in root_deps_choices:
+                               new_args.append(arg_stack.pop())
+                       else:
+                               # insert default argument
+                               new_args.append('True')
+                       continue
+
                short_job_opt = bool("j" in arg and arg[:1] == "-" and arg[:2] != "--")
                if not (short_job_opt or arg in jobs_opts):
                        new_args.append(arg)
@@ -14866,6 +14878,12 @@ def parse_opts(tmpcmdline, silent=False):
                 "help"   : "specify the target root filesystem for merging packages",
                 "action" : "store"
                },
+
+               "--root-deps": {
+                       "help"    : "modify interpretation of depedencies",
+                       "type"    : "choice",
+                       "choices" :("True", "rdeps")
+               },
        }
 
        from optparse import OptionParser
@@ -14894,6 +14912,9 @@ def parse_opts(tmpcmdline, silent=False):
 
        myoptions, myargs = parser.parse_args(args=tmpcmdline)
 
+       if myoptions.root_deps == "True":
+               myoptions.root_deps = True
+
        if myoptions.jobs:
                jobs = None
                if myoptions.jobs == "True":
index 15aa88a027fa4ed780d2071383234fe4edb3540d..033c93a55c78473b1e8df36232fa0fbf48db4e48 100644 (file)
@@ -410,15 +410,6 @@ def help(myaction,myopts,havecolor=1):
                print "              Effects vary, but the general outcome is a reduced or condensed"
                print "              output from portage's displays."
                print
-               print "       "+green("--rdeps-only")
-               desc = "Discard all build-time dependencies. This option is commonly used together " + \
-                       "with ROOT and it should not be enabled under normal circumstances. For " + \
-                       "currently supported EAPI values, the dependencies specified in the " + \
-                       "DEPEND variable are discarded. However, behavior may change for new " + \
-                       "EAPIs when related extensions are added in the future."
-               for line in wrap(desc, desc_width):
-                       print desc_indent + line
-               print
                print "       "+green("--reinstall ") + turquoise("changed-use")
                print "              Tells emerge to include installed packages where USE flags have"
                print "              changed since installation.  Unlike --newuse, this option does"
@@ -431,11 +422,14 @@ def help(myaction,myopts,havecolor=1):
                for line in wrap(desc, desc_width):
                        print desc_indent + line
                print
-               print "       "+green("--root-deps")
-               desc = "Install build-time dependencies to ROOT instead of /. This option " + \
-                       "should not be enabled under normal circumstances. For currently supported " + \
-                       "EAPI values, the dependencies specified in the DEPEND variable " + \
-                       "are used. However, behavior may change for new " + \
+               print "       "+green("--root-deps[=rdeps]")
+               desc = "If no argument is given then build-time dependencies are installed to " + \
+                       "ROOT instead of /. If the rdeps argument is given then discard " + \
+                       "all build-time dependencies of packages for ROOT. This option is " + \
+                       "only meaningful when used together with ROOT and it should not " + \
+                       "be enabled under normal circumstances. For currently supported " + \
+                       "EAPI values, the build-time dependencies are specified in the " + \
+                       "DEPEND variable. However, behavior may change for new " + \
                        "EAPIs when related extensions are added in the future."
                for line in wrap(desc, desc_width):
                        print desc_indent + line