[Initscripts-ng-commits] r367 - /trunk/src/insserv/debian/check-initd-order
pere at users.alioth.debian.org
pere at users.alioth.debian.org
Mon Dec 31 12:10:53 UTC 2007
Author: pere
Date: Mon Dec 31 12:10:53 2007
New Revision: 367
URL: http://svn.debian.org/wsvn/initscripts-ng/?sc=1&rev=367
Log:
Reduce duplicated code in graph drawing part.
Modified:
trunk/src/insserv/debian/check-initd-order
Modified: trunk/src/insserv/debian/check-initd-order
URL: http://svn.debian.org/wsvn/initscripts-ng/trunk/src/insserv/debian/check-initd-order?rev=367&op=diff
==============================================================================
--- trunk/src/insserv/debian/check-initd-order (original)
+++ trunk/src/insserv/debian/check-initd-order Mon Dec 31 12:10:53 2007
@@ -114,29 +114,31 @@
print STDERR "warning: Unable to properly handle multiple provides: @provides\n";
}
- if (exists $lsbinfo{"required-$key"} && $lsbinfo{"required-$key"}) {
- my @depends = split(/\s+/, $lsbinfo{"required-$key"});
- for my $pkg (@depends) {
- print "\"$pkg\" -> \"$provides[0]\"[color=blue];\n";
- }
- }
- if (exists $lsbinfo{"should-$key"} && $lsbinfo{"should-$key"}) {
- my @depends = split(/\s+/, $lsbinfo{"should-$key"});
- for my $pkg (@depends) {
- print "\"$pkg\" -> \"$provides[0]\"[color=springgreen] ;\n";
- }
- }
-
+ my $revkey;
if ($opts{'k'}) {
- $key = 'stop-after';
+ $revkey = 'stop-after';
} else {
- $key = 'start-before';
- }
-
- if (exists $lsbinfo{$key} && $lsbinfo{$key}) {
- my @depends = split(/\s+/, $lsbinfo{$key});
- for my $pkg (@depends) {
- print "\"$provides[0]\" -> \"$pkg\"[color=yellow] ;\n";
+ $revkey = 'start-before';
+ }
+
+ my %deps =
+ (
+ "required-$key" => 'blue',
+ "should-$key" => 'springgreen',
+ "$revkey" => 'yellow'
+ );
+
+ for $key (keys %deps) {
+ if (exists $lsbinfo{$key} && $lsbinfo{$key}) {
+ my @depends = split(/\s+/, $lsbinfo{$key});
+ for my $pkg (@depends) {
+ my $color = $deps{$key};
+ if ($revkey eq $key) {
+ print "\"$provides[0]\" -> \"$pkg\"[color=$color] ;\n";
+ } else {
+ print "\"$pkg\" -> \"$provides[0]\"[color=$color] ;\n";
+ }
+ }
}
}
More information about the Initscripts-ng-commits
mailing list