mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 18:49:03 -04:00
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
This commit is contained in:
parent
5217069a0e
commit
c27e620cc7
@ -137,6 +137,7 @@ sub find_mod_in_range {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub resolve_deps {
|
sub resolve_deps {
|
||||||
|
my($trial) = @_;
|
||||||
my $tries = 100;
|
my $tries = 100;
|
||||||
my $changes = 'INIT';
|
my $changes = 'INIT';
|
||||||
my $fail = undef;
|
my $fail = undef;
|
||||||
@ -170,6 +171,9 @@ sub resolve_deps {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($trial) {
|
||||||
|
return !($changes || $fail);
|
||||||
|
}
|
||||||
if ($changes) {
|
if ($changes) {
|
||||||
print "Infinite dependency loop:$changes\n";
|
print "Infinite dependency loop:$changes\n";
|
||||||
exit 1;
|
exit 1;
|
||||||
@ -198,15 +202,20 @@ if ($action eq 'install') {
|
|||||||
$todo{$mod} = $ver;
|
$todo{$mod} = $ver;
|
||||||
}
|
}
|
||||||
} elsif ($action eq 'upgrade') {
|
} elsif ($action eq 'upgrade') {
|
||||||
for my $mod (keys %installed) {
|
my @installed = sort keys %installed;
|
||||||
|
for my $mod (@installed) {
|
||||||
next unless $mod =~ /^m_/;
|
next unless $mod =~ /^m_/;
|
||||||
|
my %saved = %todo;
|
||||||
$todo{$mod} = find_mod_in_range($mod);
|
$todo{$mod} = find_mod_in_range($mod);
|
||||||
|
if (!resolve_deps(1)) {
|
||||||
|
%todo = %saved;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
die "Unknown action $action"
|
die "Unknown action $action"
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve_deps();
|
resolve_deps(0);
|
||||||
|
|
||||||
$| = 1; # immediate print of lines without \n
|
$| = 1; # immediate print of lines without \n
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user