From 6f614cd3f33dbdea3a67ac2fb414b1130674ee04 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Fri, 17 Feb 2017 12:06:03 -0600 Subject: Move deptree2dot to the support folder Since deptree2dot and the perl requirement are completely optional, we can move this tool to the support folder. This gives the user the option of using it if they have perl installed, and means we do not have an optional runtime dependency on perl. Documentation for this tool has also been added to the support folder. X-Gentoo-Bug: 600742 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=600742 --- NEWS.md | 6 ++++++ README.md | 1 - src/Makefile | 4 ---- src/tools/Makefile | 5 ----- src/tools/deptree2dot | 44 ----------------------------------------- support/deptree2dot/README.md | 11 +++++++++++ support/deptree2dot/deptree2dot | 44 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 61 insertions(+), 54 deletions(-) delete mode 100644 src/tools/Makefile delete mode 100644 src/tools/deptree2dot create mode 100644 support/deptree2dot/README.md create mode 100644 support/deptree2dot/deptree2dot diff --git a/NEWS.md b/NEWS.md index 6027aa08..6e36b2b2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,12 @@ This file will contain a list of notable changes for each release. Note the information in this file is in reverse order. +## OpenRC-0.24 + +Since the deptree2dot tool and the perl requirement are completely +optional, the deptree2dot tool has been moved to the support directory. +As a result, the MKTOOLS=yes/no switch has been removed from the makefiles. + ## OpenRC-0.23 The tmpfiles.d processing code, which was part of previous versions of diff --git a/README.md b/README.md index edf64267..9e61d193 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,6 @@ MKSELINUX=yes MKSTATICLIBS=no MKTERMCAP=ncurses MKTERMCAP=termcap -MKTOOLS=yes PKG_PREFIX=/usr/pkg LOCAL_PREFIX=/usr/local PREFIX=/usr/local diff --git a/src/Makefile b/src/Makefile index ffbf8d6e..e3750347 100644 --- a/src/Makefile +++ b/src/Makefile @@ -3,9 +3,5 @@ SUBDIR= test libeinfo librc rc -ifeq (${MKTOOLS},yes) -SUBDIR+= tools -endif - MK= ../mk include ${MK}/subdir.mk diff --git a/src/tools/Makefile b/src/tools/Makefile deleted file mode 100644 index 92ff5063..00000000 --- a/src/tools/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -DIR= ${UPREFIX}/bin -BIN= deptree2dot - -MK= ../../mk -include ${MK}/scripts.mk diff --git a/src/tools/deptree2dot b/src/tools/deptree2dot deleted file mode 100644 index 07ba17af..00000000 --- a/src/tools/deptree2dot +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/perl -w -# -*- cperl -*- -# Copyright © 2012 Diego Elio Pettenò -# Released under the 2-clause BSD license. -# -#Example usage: -#deptree2dot > deptree.dot -#deptree2dot | dot -Tpng -o deptree.png - -my $deptree = defined($ARGV[0]) ? $ARGV[0] : "/run/openrc/deptree"; - -open DEPTREE, $deptree or exit 1; - -print "digraph deptree {\n"; - -my @deptree; - -while(my $line = readline(DEPTREE)) { - $line =~ /^depinfo_([0-9]+)_([a-z]+)(?:_[0-9]+)?='(.*)'\n$/; - my $index = $1; - my $prop = $2; - my $value = $3; $value =~ s/[-\.:~]/_/g; - - if ( $prop eq "service" ) { - $deptree[$index] = $value; - printf "%s [shape=box];\n", $value; - } else { - my $service = $deptree[$index]; - - if ( $prop eq "ineed" ) { - printf "%s -> %s;\n", $service, $value; - } elsif ( $prop eq "iuse" ) { - printf "%s -> %s [color=blue];\n", $service, $value; - } elsif ( $prop eq "ibefore" ) { - printf "%s -> %s [style=dotted];\n", $service, $value; - } elsif ( $prop eq "iafter" ) { - printf "%s -> %s [style=dotted color=purple];\n", $value, $service; - } elsif ( $prop eq "iprovide" ) { - printf "%s -> %s [color=red];\n", $value, $service; - } - } -} - -print "}\n"; diff --git a/support/deptree2dot/README.md b/support/deptree2dot/README.md new file mode 100644 index 00000000..3df9a520 --- /dev/null +++ b/support/deptree2dot/README.md @@ -0,0 +1,11 @@ +# deptree2dot - Graph the OpenRC Dependency Tree + +This utility can be used to graph the OpenRC dependency tree. It +requires perl5.x and converts the tree to a .dot file which can be +processed by graphviz. + +Example usage: + +$ chmod +x deptree2dot +$deptree2dot > deptree.dot +$deptree2dot | dot -Tpng -o deptree.png diff --git a/support/deptree2dot/deptree2dot b/support/deptree2dot/deptree2dot new file mode 100644 index 00000000..07ba17af --- /dev/null +++ b/support/deptree2dot/deptree2dot @@ -0,0 +1,44 @@ +#!/usr/bin/perl -w +# -*- cperl -*- +# Copyright © 2012 Diego Elio Pettenò +# Released under the 2-clause BSD license. +# +#Example usage: +#deptree2dot > deptree.dot +#deptree2dot | dot -Tpng -o deptree.png + +my $deptree = defined($ARGV[0]) ? $ARGV[0] : "/run/openrc/deptree"; + +open DEPTREE, $deptree or exit 1; + +print "digraph deptree {\n"; + +my @deptree; + +while(my $line = readline(DEPTREE)) { + $line =~ /^depinfo_([0-9]+)_([a-z]+)(?:_[0-9]+)?='(.*)'\n$/; + my $index = $1; + my $prop = $2; + my $value = $3; $value =~ s/[-\.:~]/_/g; + + if ( $prop eq "service" ) { + $deptree[$index] = $value; + printf "%s [shape=box];\n", $value; + } else { + my $service = $deptree[$index]; + + if ( $prop eq "ineed" ) { + printf "%s -> %s;\n", $service, $value; + } elsif ( $prop eq "iuse" ) { + printf "%s -> %s [color=blue];\n", $service, $value; + } elsif ( $prop eq "ibefore" ) { + printf "%s -> %s [style=dotted];\n", $service, $value; + } elsif ( $prop eq "iafter" ) { + printf "%s -> %s [style=dotted color=purple];\n", $value, $service; + } elsif ( $prop eq "iprovide" ) { + printf "%s -> %s [color=red];\n", $value, $service; + } + } +} + +print "}\n"; -- cgit v1.2.3