From c27e620cc7e5b472861242849864b591412daf77 Mon Sep 17 00:00:00 2001 From: w00t Date: Sun, 7 Sep 2008 03:49:21 +0000 Subject: 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 --- modulemanager | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'modulemanager') 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 -- cgit v1.2.3