summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsupport/scripts/graph-depends33
1 files changed, 33 insertions, 0 deletions
diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
index 409c12301..c80a65a17 100755
--- a/support/scripts/graph-depends
+++ b/support/scripts/graph-depends
@@ -119,6 +119,37 @@ def get_all_depends(pkg):
def pkg_node_name(pkg):
return pkg.replace("-","")
+# Helper function for remove_redundant_deps(). This function tells
+# whether package "pkg" is the dependency of another package that is
+# not the special "all" package.
+def has_redundant_deps(deps, pkg):
+ for dep in deps:
+ if dep[0] != "all" and dep[1] == pkg:
+ return True
+ return False
+
+# This function removes redundant dependencies of the special "all"
+# package. This "all" package is created to reflect the origin of the
+# selection for all packages that are not themselves selected by any
+# other package. So for example if you enable libpng, zlib is enabled
+# as a dependency. But zlib being selected by libpng, it also appears
+# as a dependency of the "all" package. This needlessly complicates
+# the generated dependency graph. So when we have the dependency list
+# (all -> zlib, all -> libpn, libpng -> zlib), we get rid of the 'all
+# -> zlib' dependency, because zlib is already a dependency of a
+# regular package.
+def remove_redundant_deps(deps):
+ newdeps = []
+ for dep in deps:
+ if dep[0] != "all":
+ newdeps.append(dep)
+ continue
+ if not has_redundant_deps(deps, dep[1]):
+ newdeps.append(dep)
+ continue
+ sys.stderr.write("Removing redundant dep all -> %s\n" % dep[1])
+ return newdeps
+
# In full mode, start with the result of get_targets() to get the main
# targets and then use get_all_depends() for each individual target.
if mode == FULL_MODE:
@@ -144,6 +175,8 @@ if mode == FULL_MODE:
elif mode == PKG_MODE:
dependencies = get_all_depends(rootpkg)
+dependencies = remove_redundant_deps(dependencies)
+
# Start printing the graph data
print "digraph G {"