summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-05-20 07:46:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:16:56 -0500
commitdf1bac4442a9ff2a2ff73aa12d143b2a867a6461 (patch)
treee6fe174b809ca54ff14d8fd14f57779ecf610378 /source4
parent283991e1fff8b74af693aeb634143b10b5e939c8 (diff)
downloadsamba-df1bac4442a9ff2a2ff73aa12d143b2a867a6461.tar.gz
samba-df1bac4442a9ff2a2ff73aa12d143b2a867a6461.tar.bz2
samba-df1bac4442a9ff2a2ff73aa12d143b2a867a6461.zip
r6919: Jelmer, here is my script for filtering individual binaries/subsystems/etc
out of the samba4-deps.dot file. Use like: script/depfilter.py regpatch < samba4-deps.dot | dotty - and then scratch your head and wonder why regpatch has to link with 3/4 of what it does. (This used to be commit 90b07c6860ceeb65aaeedd69b12895466dfd64a3)
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/script/depfilter.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/source4/script/depfilter.py b/source4/script/depfilter.py
new file mode 100755
index 0000000000..74d1d179c7
--- /dev/null
+++ b/source4/script/depfilter.py
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+#
+# Filter out arcs in a dotty graph that are at or below a certain
+# node. This is useful for visualising parts of the dependency graph.
+#
+
+# Command line stuff
+
+import sys, sre
+
+if len(sys.argv) != 2:
+ print 'Usage: depfilter.py NODE'
+ sys.exit(1)
+
+top = sys.argv[1]
+
+# Read in dot file
+
+lines = sys.stdin.readlines()
+
+graph = {}
+
+for arc in lines[1:-1]:
+ match = sre.search('"(.*)" -> "(.*)"', arc)
+ n1, n2 = match.group(1), match.group(2)
+ if not graph.has_key(n1):
+ graph[n1] = []
+ graph[n1].append(n2)
+
+# Create subset of 'graph' rooted at 'top'
+
+subgraph = {}
+
+def add_deps(node):
+ if graph.has_key(node) and not subgraph.has_key(node):
+ subgraph[node] = graph[node]
+ for n in graph[node]:
+ add_deps(n)
+
+add_deps(top)
+
+# Generate output
+
+print lines[0],
+
+for key, value in subgraph.items():
+ for n in value:
+ print '\t"%s" -> "%s"' % (key, n)
+
+print lines[-1],