summaryrefslogtreecommitdiff
path: root/modulemanager
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-09-07 03:49:21 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-09-07 03:49:21 +0000
commitc27e620cc7e5b472861242849864b591412daf77 (patch)
treedb60c018aef75518ba987fa9ca86094aced054a2 /modulemanager
parent5217069a0e1e10211f7fd1f34a2548dc3f2c44e1 (diff)
Upgrade the upgrade command to ..upgrade better. Thanks danieldg.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10430 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'modulemanager')
-rwxr-xr-xmodulemanager13
1 files changed, 11 insertions, 2 deletions
diff --git a/modulemanager b/modulemanager
index 18a169f9b..53783762b 100755
--- a/modulemanager
+++ b/modulemanager
@@ -137,6 +137,7 @@ sub find_mod_in_range {
}
sub resolve_deps {
+ my($trial) = @_;
my $tries = 100;
my $changes = 'INIT';
my $fail = undef;
@@ -170,6 +171,9 @@ sub resolve_deps {
}
}
}
+ if ($trial) {
+ return !($changes || $fail);
+ }
if ($changes) {
print "Infinite dependency loop:$changes\n";
exit 1;
@@ -198,15 +202,20 @@ if ($action eq 'install') {
$todo{$mod} = $ver;
}
} elsif ($action eq 'upgrade') {
- for my $mod (keys %installed) {
+ my @installed = sort keys %installed;
+ for my $mod (@installed) {
next unless $mod =~ /^m_/;
+ my %saved = %todo;
$todo{$mod} = find_mod_in_range($mod);
+ if (!resolve_deps(1)) {
+ %todo = %saved;
+ }
}
} else {
die "Unknown action $action"
}
-resolve_deps();
+resolve_deps(0);
$| = 1; # immediate print of lines without \n