Add --depth option to equery depgraph to limit the depth of the dependency graph...
authorfuzzyray <fuzzyray@gentoo.org>
Sat, 10 Mar 2007 22:55:32 +0000 (22:55 -0000)
committerfuzzyray <fuzzyray@gentoo.org>
Sat, 10 Mar 2007 22:55:32 +0000 (22:55 -0000)
svn path=/; revision=355

trunk/ChangeLog
trunk/src/equery/equery
trunk/src/equery/equery.1

index 1dce6d1bffb4be0e034e379147f1844b6439d828..d774919511adcd9666a63c239bd3ded883c3c18c 100644 (file)
@@ -1,3 +1,7 @@
+2007-03-10 Paul Varner <fuzzyray@gentoo.org>
+       * equery: Add --depth option to equery depgraph to limit the depth of
+       the dependency graph. (Bug #115807)
+
 2007-03-09 Paul Varner <fuzzyray@gentoo.org>
        * revdep-rebuild: Add support to detect "no version information
        available" message from ldd (Bug #169973)
index 0473de259552a920f95892e5f979a800510fed65..bf2c0199803e1ed7474f9b0b7033ed9bc151a0da 100755 (executable)
@@ -636,7 +636,8 @@ class CmdDisplayDepGraph(Command):
        def __init__(self):
                self.default_opts = {
                        "displayUSEFlags": 1,
-                       "fancyFormatting": 1
+                       "fancyFormatting": 1,
+                       "depth": 0
                        }
 
        def parseArgs(self, args):
@@ -660,6 +661,8 @@ class CmdDisplayDepGraph(Command):
                                opts["displayUSEFlags"] = 0
                        elif x in ["-l","--linear"]:
                                opts["fancyFormatting"] = 0
+                       elif x[:8] == "--depth=":
+                               opts["depth"] = int(x[8:])
                        else:
                                query = x
 
@@ -716,7 +719,8 @@ class CmdDisplayDepGraph(Command):
                                suffix += " (" + pp.cpv(cpv) + ")"
                        if len(x[1]) and opts["displayUSEFlags"]:
                                suffix += " [ " + pp.useflagon(string.join(x[1])) + " ]"
-                       pkgtbl = self._graph(pkg, opts, stats, level+1, pkgtbl, suffix)
+                       if (level < opts["depth"] or opts["depth"] <= 0):
+                               pkgtbl = self._graph(pkg, opts, stats, level+1, pkgtbl, suffix)
                return pkgtbl
 
        def shortHelp(self):
@@ -729,7 +733,9 @@ class CmdDisplayDepGraph(Command):
                           "\n" + \
                           pp.localoption("<local-opts>") + " is either of: \n" + \
                           "  " + pp.localoption("-U, --no-useflags") + " - do not show USE flags\n" + \
-                          "  " + pp.localoption("-l, --linear") + "      - do not use fancy formatting"
+                          "  " + pp.localoption("-l, --linear") + "      - do not use fancy formatting\n" + \
+                          "  " + pp.localoption("    --depth=n") + "     - limit dependency graph to specified depth"
+
 
 class CmdDisplaySize(Command):
        """Display disk size consumed by a package"""
@@ -1212,7 +1218,7 @@ class CmdListDepends(Command):
                                "  " + pp.localoption("-a, --all-packages") + " - search in all available packages (slow)\n" + \
                                "  " + pp.localoption("-d, --direct") + "       - search direct dependencies only (default)\n" + \
                                "  " + pp.localoption("-D, --indirect") + "     - search indirect dependencies (VERY slow)\n" + \
-                               "  " + pp.localoption("--depth=x") + "          - limit indirect dependency tree to specified depth"
+                               "  " + pp.localoption("--depth=n") + "          - limit indirect dependency tree to specified depth"
 
 
 class CmdListPackages(Command):
index 89001d2e86b72bbb309156d267c72b6615aea7ff..576519dc34e274570fd6f0220fff5df656dac9f8 100644 (file)
@@ -91,6 +91,9 @@ do not show USE flags.
 .br 
 .B \-l, \-\-linear    
 do not use fancy formatting 
+.br 
+.B \-\-depth=n
+Limit depth of dependency graph to n levels.
 .PP 
 .TP 
 .B files <local\-opts> pkgspec
@@ -220,7 +223,7 @@ equery list \-\-full\-regex '(mozilla\-firefox|mozilla\-thunderbird)' \- list al
 
 equery list \-\-duplicates \- list all installed slotted packages
 .PP 
-.TP
+.TP 
 .B size <local\-opts> pkgspec
 This command outputs the number of files in the specified package, as well as
 their total size in an appropriate unit.