4 # Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
6 # (Except where explictly superceded by other copyright notices)
8 # This work is made available to you under the terms of Version 2 of
9 # the GNU General Public License. A copy of that license should have
10 # been provided with this software, but in any event can be snarfed
13 # This work is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # Unless otherwise specified, all modifications, corrections or
19 # extensions to this work which alter its source code become the
20 # property of Best Practical Solutions, LLC when submitted for
21 # inclusion in the work.
27 # This is just a basic script that checks to make sure that all
28 # the modules needed by RT before you can install it.
32 no warnings qw(numeric redefine);
37 GetOptions(\%args,'install', 'with-MYSQL', 'with-POSTGRESQL|with-pg|with-pgsql', 'with-SQLITE', 'with-ORACLE', 'with-FASTCGI', 'with-SPEEDYCGI', 'with-MODPERL1', 'with-MODPERL2' ,'with-DEV');
43 $args{'with-MASON'} = 1;
44 $args{'with-CORE'} = 1;
47 $args{'with-MAILGATE'} =1;
49 $args{'with-I18N-COMPAT'} = 1;
57 By default, testdeps determine whether you have
58 installed all the perl modules RT needs to run.
60 --install Install missing modules
62 The following switches will tell the tool to check for specific dependencies
64 --with-mysql Database interface for MySQL
65 --with-postgresql Database interface for PostgreSQL
66 --with-sqlite Database interface and driver for SQLite (unsupported)
67 --with-oracle Database interface for oracle (unsupported)
69 --with-fastcgi Libraries needed to support the fastcgi handler
70 --with-speedycgi Libraries needed to support the speedycgi handler
71 --with-modperl1 Libraries needed to support the modperl 1 handler
72 --with-modperl2 Libraries needed to support the modperl 2 handler
74 --with-dev Tools needed for RT development
80 map { /(\S+)\s*(\S*)/; $1 => ($2 ? $2 :'') } split ( /\n/, $_[0] );
83 $deps{'CORE'} = [ _( << '.') ];
87 Class::ReturnValue 0.40
88 DBIx::SearchBuilder 0.86
95 Locale::Maketext::Lexicon 0.25
96 Locale::Maketext::Fuzzy
108 $deps{'MASON'} = [ _( << '.') ];
109 Params::Validate 0.02
122 $deps{'MAILGATE'} = [ _( << '.') ];
129 $deps{'CLI'} = [ _( << '.') ];
133 $deps{'DEV'} = [ _( << '.') ];
140 $deps{'FASTCGI'} = [ _( << '.') ];
146 $deps{'SPEEDYCGI'} = [ _( << '.') ];
152 $deps{'MODPERL1'} = [ _( << '.') ];
158 $deps{'MODPERL2'} = [ _( << '.') ];
163 $deps{'I18N-COMPAT'} = [ _( << '.') ];
168 $deps{'MYSQL'} = [ _( << '.') ];
171 $deps{'ORACLE'} = [ _( << '.') ];
174 $deps{'POSTGRESQL'} = [ _( << '.') ];
179 foreach my $type (keys %args) {
180 next unless ($type =~ /^with-(.*?)$/);
182 print "$type dependencies:\n";
183 my @deps = (@{$deps{$type}});
185 my $module = shift @deps;
186 my $version = shift @deps;
188 $ret =test_dep($module, $version);
190 if ($args{'install'} && !$ret) {
191 resolve_dep($module);
199 print "\t$module $version";
200 eval "use $module $version" ;
203 $error =~ s/\n(.*)$//s;
204 print "...MISSING\n";
205 print "\t\t$error\n" if $error =~ /this is only/;
217 CPAN::Shell->install($module);
228 $0 is a tool for RT that will tell you if you've got all
229 the modules RT depends on properly installed.
231 Flags: (only one flag is valid for a given run)
233 -quiet will check to see if we've got everything we need
234 and will exit with a return code of (1) if we don't.
236 -warn will tell you what isn't properly installed
238 -fix will use CPANPLUS.pm or CPAN.pm to magically make everything better