summaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
authorYann E. MORIN <yann.morin.1998@free.fr>2016-10-23 19:19:44 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-10-25 22:59:05 +0200
commit2a2eb55ca73cbe8536a9d9bdd29feaf70a462961 (patch)
tree364f168c2129557559551ead2b230b15a558251b /support
parentf33fcdf2254beb07677a86416ff46ee6d7aed866 (diff)
downloadbuildroot-2a2eb55ca73cbe8536a9d9bdd29feaf70a462961.tar.gz
buildroot-2a2eb55ca73cbe8536a9d9bdd29feaf70a462961.zip
core/graph-depends: add option to graph reverse dependencies
Now that we can dump the reverse dependencies of a package, add the ability to graph those. It does not make sense to do a full reverse graph, as it would be semantically equivalent to the direct graph. So we only provide a per-package reverse graph. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Arnout Vandecappelle <arnout@mind.be> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support')
-rwxr-xr-xsupport/scripts/graph-depends18
1 files changed, 16 insertions, 2 deletions
diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
index cb00383c0f..c3c97cb389 100755
--- a/support/scripts/graph-depends
+++ b/support/scripts/graph-depends
@@ -63,6 +63,10 @@ parser.add_argument("--transitive", dest="transitive", action='store_true',
default=False)
parser.add_argument("--no-transitive", dest="transitive", action='store_false',
help="Draw (do not draw) transitive dependencies")
+parser.add_argument("--direct", dest="direct", action='store_true', default=True,
+ help="Draw direct dependencies (the default)")
+parser.add_argument("--reverse", dest="direct", action='store_false',
+ help="Draw reverse dependencies")
args = parser.parse_args()
check_only = args.check_only
@@ -95,6 +99,16 @@ else:
transitive = args.transitive
+if args.direct:
+ rule = "show-depends"
+ arrow_dir = "forward"
+else:
+ if mode == MODE_FULL:
+ sys.stderr.write("--reverse needs a package\n")
+ sys.exit(1)
+ rule = "show-rdepends"
+ arrow_dir = "back"
+
# Get the colours: we need exactly three colours,
# so no need not split more than 4
# We'll let 'dot' validate the colours...
@@ -151,7 +165,7 @@ def get_depends(pkgs):
sys.stderr.write("Getting dependencies for %s\n" % pkgs)
cmd = ["make", "-s", "--no-print-directory" ]
for pkg in pkgs:
- cmd.append("%s-show-depends" % pkg)
+ cmd.append("%s-%s" % (pkg, rule))
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True)
output = p.communicate()[0]
if p.returncode != 0:
@@ -418,7 +432,7 @@ def print_pkg_deps(depth, pkg):
add = False
break
if add:
- outfile.write("%s -> %s\n" % (pkg_node_name(pkg), pkg_node_name(d)))
+ outfile.write("%s -> %s [dir=%s]\n" % (pkg_node_name(pkg), pkg_node_name(d), arrow_dir))
print_pkg_deps(depth+1, d)
# Start printing the graph data
OpenPOWER on IntegriCloud