[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xen-cvs
Subject:    [Xen-changelog] [xen master] tools/hotplug: add helper script to visualize systemd dependencies
From:       patchbot () xen ! org
Date:       2014-10-30 9:16:05
Message-ID: E1Xjlpt-0000hL-Mb () xenbits ! xen ! org
[Download RAW message or body]

commit 757df439ab19d3e32540adfa8f642ccca1876d84
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Fri Oct 24 16:17:10 2014 +0200
Commit:     Ian Campbell <ian.campbell@citrix.com>
CommitDate: Mon Oct 27 10:14:13 2014 +0000

    tools/hotplug: add helper script to visualize systemd dependencies
    
    A small helper to draw a graph with dot(1) and show it with display(1):
    bash tools/hotplug/Linux/systemd/show_service_dependencies.sh \
    	tools/hotplug/Linux/systemd/*.in
    
    A red line means Requires= aka "enable it"
    A blue line means After=
    A green line means Before=
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Acked-by: Wei Liu <wei.liu2@citrix.com>
---
 .../Linux/systemd/show_service_dependencies.sh     |   31 ++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/tools/hotplug/Linux/systemd/show_service_dependencies.sh \
b/tools/hotplug/Linux/systemd/show_service_dependencies.sh new file mode 100644
index 0000000..e3e4c68
--- /dev/null
+++ b/tools/hotplug/Linux/systemd/show_service_dependencies.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# dot(1) from graphviz, display(1) from ImageMagick
+# Usage: bash $0 tools/hotplug/Linux/systemd/*.in
+(
+echo " digraph systemd {"
+for file in "$@"
+do
+	if test -f "$file"
+	then
+		unit=${file##*/}
+		unit=${unit%.in}
+		requires="`grep ^Requires= $file | cut -f 2- -d =`"
+		before="`grep ^Before= $file | cut -f 2- -d =`"
+		after="`grep ^After= $file | cut -f 2- -d =`"
+		echo "\"$unit\" [fillcolor=lightgray color=black fontcolor=black style=filled];"
+		for i in $requires
+		do
+			echo "\"$i\" -> \"$unit\" [color=red];"
+		done
+		for i in $after
+		do
+			echo "\"$i\" -> \"$unit\" [color=blue];"
+		done
+		for i in $before
+		do
+			echo "\"$unit\" -> \"$i\" [color=green];"
+		done
+	fi
+done
+echo "}"
+) | dot -Tpng | display -
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xen.org
http://lists.xensource.com/xen-changelog


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic