summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-07-09 07:35:22 +0000
committerZac Medico <zmedico@gentoo.org>2009-07-09 07:35:22 +0000
commitfb0caf19c365cf89523e2725599781b05698a59f (patch)
tree0030e494d623436d3af82d091b9159e4c0c8991e
parentc7188fc98450630f7b8a81f80b1ebc0d6cc7da78 (diff)
downloadportage-fb0caf19c365cf89523e2725599781b05698a59f.tar.gz
portage-fb0caf19c365cf89523e2725599781b05698a59f.tar.bz2
portage-fb0caf19c365cf89523e2725599781b05698a59f.zip
Allow --deep to take an optional integer parameter, to specify how deep it
should go. Also make --update so it no longer implies the equivalent of --deep=1. To get the old --update behavior, use --update --deep=1. svn path=/main/trunk/; revision=13812
-rw-r--r--man/emerge.16
-rw-r--r--pym/_emerge/create_depgraph_params.py2
-rw-r--r--pym/_emerge/depgraph.py20
-rw-r--r--pym/_emerge/help.py6
-rw-r--r--pym/_emerge/main.py36
5 files changed, 52 insertions, 18 deletions
diff --git a/man/emerge.1 b/man/emerge.1
index 4cb0c7ff2..07f511fa4 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -225,8 +225,8 @@ use \fB\-\-depclean\fR or \fB\-\-prune\fR.
.TP
.BR "\-\-update " (\fB\-u\fR)
Updates packages to the best version available, which may not always be the
-highest version number due to masking for testing and development. This will
-also update direct dependencies which may not be what you want. Package atoms
+highest version number due to masking for testing and development.
+Package atoms
specified on the command line are greedy, meaning that unspecific atoms may
match multiple installed versions of slotted packages.
.TP
@@ -301,7 +301,7 @@ mode the bash build environment will run with the \-x option, causing
it to output verbose debugging information to stdout. This also enables
a plethora of other output (mostly dependency resolution messages).
.TP
-.BR "\-\-deep " (\fB\-D\fR)
+.BR "\-\-deep [DEPTH] " (\fB\-D\fR)
This flag forces
\fBemerge\fR to consider the entire dependency tree of packages,
instead of checking only the immediate dependencies of the packages.
diff --git a/pym/_emerge/create_depgraph_params.py b/pym/_emerge/create_depgraph_params.py
index 77deb042d..9381fb955 100644
--- a/pym/_emerge/create_depgraph_params.py
+++ b/pym/_emerge/create_depgraph_params.py
@@ -31,7 +31,7 @@ def create_depgraph_params(myopts, myaction):
if "--nodeps" in myopts:
myparams.pop("recurse", None)
if "--deep" in myopts:
- myparams["deep"] = True
+ myparams["deep"] = myopts["--deep"]
if "--complete-graph" in myopts:
myparams["complete"] = True
return myparams
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index cb31b76c8..910f1fafe 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -611,8 +611,8 @@ class depgraph(object):
buildpkgonly = "--buildpkgonly" in self._frozen_config.myopts
nodeps = "--nodeps" in self._frozen_config.myopts
empty = "empty" in self._dynamic_config.myparams
- deep = "deep" in self._dynamic_config.myparams
- update = "--update" in self._frozen_config.myopts and dep.depth <= 1
+ deep = self._dynamic_config.myparams.get("deep", 0)
+ recurse = empty or deep is True or dep.depth <= deep
if dep.blocker:
if not buildpkgonly and \
not nodeps and \
@@ -648,7 +648,7 @@ class depgraph(object):
# available for optimization of merge order.
if dep.priority.satisfied and \
not dep_pkg.installed and \
- not (existing_node or empty or deep or update):
+ not (existing_node or recurse):
myarg = None
if dep.root == self._frozen_config.target_root:
try:
@@ -857,18 +857,20 @@ class depgraph(object):
emerge --deep <pkgspec>; we need to recursively check dependencies of pkgspec
If we are in --nodeps (no recursion) mode, we obviously only check 1 level of dependencies.
"""
+ if arg_atoms:
+ depth = 0
+ pkg.depth = depth
+ deep = self._dynamic_config.myparams.get("deep", 0)
+ empty = "empty" in self._dynamic_config.myparams
+ recurse = empty or deep is True or depth + 1 <= deep
dep_stack = self._dynamic_config._dep_stack
if "recurse" not in self._dynamic_config.myparams:
return 1
- elif pkg.installed and \
- "deep" not in self._dynamic_config.myparams:
+ elif pkg.installed and not recurse:
dep_stack = self._dynamic_config._ignored_deps
self._frozen_config.spinner.update()
- if arg_atoms:
- depth = 0
- pkg.depth = depth
if not previously_added:
dep_stack.append(pkg)
return 1
@@ -2296,7 +2298,7 @@ class depgraph(object):
# accounted for.
self._select_atoms = self._select_atoms_from_graph
self._select_package = self._select_pkg_from_graph
- already_deep = "deep" in self._dynamic_config.myparams
+ already_deep = self._dynamic_config.myparams.get("deep") is True
if not already_deep:
self._dynamic_config.myparams["deep"] = True
diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py
index 583b57aa7..393886698 100644
--- a/pym/_emerge/help.py
+++ b/pym/_emerge/help.py
@@ -220,8 +220,7 @@ def help(myopts, havecolor=1):
print " "+green("--update")+" ("+green("-u")+" short option)"
print " Updates packages to the best version available, which may not"
print " always be the highest version number due to masking for testing"
- print " and development. This will also update direct dependencies which"
- print " may not be what you want. Package atoms specified on the command"
+ print " and development. Package atoms specified on the command"
print " line are greedy, meaning that unspecific atoms may match multiple"
print " installed versions of slotted packages."
print
@@ -314,7 +313,8 @@ def help(myopts, havecolor=1):
print " --debug is great for finding bash syntax errors as providing"
print " very verbose information about the dependency and build process."
print
- print " "+green("--deep")+" ("+green("-D")+" short option)"
+ print " "+green("--deep") + " " + turquoise("[DEPTH]") + \
+ " (" + green("-D") + " short option)"
print " This flag forces emerge to consider the entire dependency tree of"
print " packages, instead of checking only the immediate dependencies of"
print " the packages. As an example, this catches updates in libraries"
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index abbaf2301..dae28fa66 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -49,7 +49,7 @@ options=[
"--buildpkg", "--buildpkgonly",
"--changelog", "--columns",
"--complete-graph",
-"--debug", "--deep",
+"--debug",
"--digest",
"--emptytree",
"--fetchonly", "--fetch-all-uri",
@@ -75,7 +75,7 @@ shortmapping={
"a":"--ask",
"b":"--buildpkg", "B":"--buildpkgonly",
"c":"--clean", "C":"--unmerge",
-"d":"--debug", "D":"--deep",
+"d":"--debug",
"e":"--emptytree",
"f":"--fetchonly", "F":"--fetch-all-uri",
"g":"--getbinpkg", "G":"--getbinpkgonly",
@@ -383,6 +383,7 @@ def insert_optional_args(args):
new_args = []
default_arg_opts = {
+ '--deep' : valid_integers,
'--deselect' : ('n',),
'--binpkg-respect-use' : ('n', 'y',),
'--jobs' : valid_integers,
@@ -390,6 +391,7 @@ def insert_optional_args(args):
}
short_arg_opts = {
+ 'D' : valid_integers,
'j' : valid_integers,
}
@@ -488,6 +490,18 @@ def parse_opts(tmpcmdline, silent=False):
"choices":("y", "n")
},
+ "--deep": {
+
+ "shortopt" : "-D",
+
+ "help" : "Specifies how deep to recurse into dependencies " + \
+ "of packages given as arguments. If no argument is given, " + \
+ "depth is unlimited. Default behavior is to skip " + \
+ "dependencies of installed packages.",
+
+ "action" : "store"
+ },
+
"--deselect": {
"help" : "remove atoms from the world file",
"type" : "choice",
@@ -584,6 +598,24 @@ def parse_opts(tmpcmdline, silent=False):
if myoptions.root_deps == "True":
myoptions.root_deps = True
+ if myoptions.deep is not None:
+ deep = None
+ if myoptions.deep == "True":
+ deep = True
+ else:
+ try:
+ deep = int(myoptions.deep)
+ except (OverflowError, ValueError):
+ deep = -1
+
+ if deep is not True and deep < 0:
+ deep = None
+ if not silent:
+ writemsg("!!! Invalid --deep parameter: '%s'\n" % \
+ (myoptions.deep,), noiselevel=-1)
+
+ myoptions.deep = deep
+
if myoptions.jobs:
jobs = None
if myoptions.jobs == "True":