diff options
Diffstat (limited to 'modulemanager')
-rwxr-xr-x | modulemanager | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/modulemanager b/modulemanager index 2f3d0a505..18a169f9b 100755 --- a/modulemanager +++ b/modulemanager @@ -12,10 +12,12 @@ my %installed; my %modules; # $modules{$name}{$version} = { -# url => URL of this version (or INSECURE/DEPRECATED) +# url => URL of this version # depends => [ 'm_foo 1.2.0-1.3.0', ... ] # conflicts => [ ] # from => URL of source document +# mask => Reason for not installing (INSECURE/DEPRECATED) +# description => some string # } my %url_seen; @@ -51,6 +53,10 @@ sub parse_url { push @{$mod->{depends}}, $1; } elsif (/^conflicts (.*)/) { push @{$mod->{conflicts}}, $1; + } elsif (/^description (.*)/) { + $mod->{description} = $1; + } elsif (/^mask (.*)/) { + $mod->{mask} = $1; } elsif (m#^source (http://\S+)#) { parse_url $1; } else { @@ -68,9 +74,7 @@ close SRC; getmodules(); -open my $verfile, 'src/version.sh' or die "Cannot determine inspircd version: $!"; -$_ = join '', <$verfile>; -die "Cannot determine inspircd version" unless /InspIRCd-([0-9.]+)/; +`./src/version.sh` =~ /InspIRCd-([0-9.]+)/ or die "Cannot determine inspircd version"; $installed{core} = $1; $modules{core}{$1} = { url => 'NONE', @@ -78,12 +82,12 @@ $modules{core}{$1} = { conflicts => [], from => 'local file', }; -close $verfile; for my $modname (@modlist) { my $mod = "m_$modname"; my $modfile = "src/modules/$mod.cpp"; my $ver = getmodversion($modfile) || '0.0'; + $ver =~ s/\$Rev: (.*) \$/$1/; # for storing revision in SVN $installed{$mod} = $ver; next if $modules{$mod}{$ver}; $modules{$mod}{$ver} = { @@ -122,10 +126,11 @@ sub ver_in_range { } sub find_mod_in_range { - my($mod,$vers) = @_; + my($mod, $vers, $force) = @_; my @versions = keys %{$modules{$mod}}; - @versions = sort { ver_cmp() } @versions; - for my $ver (reverse @versions) { + @versions = sort { -ver_cmp() } @versions; + for my $ver (@versions) { + next if $modules{$mod}{$ver}{mask} && !$force; return $ver if ver_in_range($ver, $vers); } return undef; @@ -153,7 +158,7 @@ sub resolve_deps { $todo{$depmod} = $depver; $changes .= " $mod-$ver->$depmod-$depver"; } else { - $fail ||= "Could not find module $depmod $depver required by $mod $ver"; + $fail ||= "Could not find module $depmod $depvers required by $mod $ver"; } } for my $dep (@{$info->{conflicts}}) { @@ -185,7 +190,7 @@ if ($action eq 'install') { print "Cannot find module $mod\n"; exit 1; } - my $ver = find_mod_in_range($mod, $vers); + my $ver = find_mod_in_range($mod, $vers, $vers ? 1 : 0); unless ($ver) { print "Cannot find suitable version of $mod\n"; exit 1; @@ -213,15 +218,11 @@ for my $mod (keys %installed) { for my $mod (sort keys %todo) { my $ver = $todo{$mod}; my $oldver = $installed{$mod}; - my $url = $modules{$mod}{$ver}{url}; - if ($url eq 'INSECURE') { - print "WARNING: Version $ver of $mod is insecure!\n"; - next; - } elsif ($url eq 'DEPRECATED') { - print "Note: version $ver of $mod is deprecated\n"; - next; + if ($modules{$mod}{$ver}{mask}) { + print "Module $mod $ver is masked: $modules{$mod}{$ver}{mask}\n"; } next if $oldver && $oldver eq $ver; + my $url = $modules{$mod}{$ver}{url}; if ($oldver) { print "Upgrading $mod from $oldver to $ver using $url" } else { |