From: Joey Hess Date: Wed, 2 Nov 2011 21:02:10 +0000 (-0400) Subject: Support chaining to absolute paths. X-Git-Url: https://git.madduck.net/code/myrepos.git/commitdiff_plain/2467756e9e048a4579ee65c9980672316e12ee24?ds=inline;hp=64e5b9721264d0d08f6348b61d7ca98f5fbea5c6 Support chaining to absolute paths. --- diff --git a/debian/changelog b/debian/changelog index 5e4cb7b..83f629f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ mr (1.06) UNRELEASED; urgency=low * Fix propigation of failure from pre and post hooks and from fixups. + * Support chaining to absolute paths. -- Joey Hess Thu, 27 Oct 2011 12:18:43 -0400 diff --git a/mr b/mr index 74b1cfc..97720d4 100755 --- a/mr +++ b/mr @@ -1238,21 +1238,26 @@ sub loadconfig { $knownactions{$parameter}=1; } if ($parameter eq 'chain' && - length $dir && $section ne "DEFAULT" && - -e $dir.$section."/.mrconfig") { - my $ret=system($value); - if ($ret != 0) { - if (($? & 127) == 2) { - print STDERR "mr: chain test interrupted\n"; - exit 2; + length $dir && $section ne "DEFAULT") { + my $chaindir="$section"; + if ($chaindir !~ m!/!) { + $chaindir=$dir.$chaindir; + } + if (-e "$chaindir/.mrconfig") { + my $ret=system($value); + if ($ret != 0) { + if (($? & 127) == 2) { + print STDERR "mr: chain test interrupted\n"; + exit 2; + } + elsif ($? & 127) { + print STDERR "mr: chain test received signal ".($? & 127)."\n"; + } } - elsif ($? & 127) { - print STDERR "mr: chain test received signal ".($? & 127)."\n"; + else { + push @toload, ["$chaindir/.mrconfig", $chaindir]; } } - else { - push @toload, $dir.$section."/.mrconfig"; - } } } } @@ -1261,8 +1266,8 @@ sub loadconfig { } } - foreach (@toload) { - loadconfig($_); + foreach my $c (@toload) { + loadconfig(@$c); } }