summaryrefslogtreecommitdiff
path: root/modulemanager
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-09-07 03:27:54 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-09-07 03:27:54 +0000
commit5217069a0e1e10211f7fd1f34a2548dc3f2c44e1 (patch)
tree2260cc23866917bfba68e9e6b58200463bd53aa0 /modulemanager
parent3e72c8cb7eb2daf7419d00a9ff50eda3cbb40db3 (diff)
Implement masking and descriptions for module manager, thanks danieldg
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10429 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'modulemanager')
-rwxr-xr-xmodulemanager35
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 {