2 # {{{ BEGIN BPS TAGGED BLOCK
6 # This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
7 # <jesse@bestpractical.com>
9 # (Except where explicitly superseded by other copyright notices)
14 # This work is made available to you under the terms of Version 2 of
15 # the GNU General Public License. A copy of that license should have
16 # been provided with this software, but in any event can be snarfed
19 # This work is distributed in the hope that it will be useful, but
20 # WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 # General Public License for more details.
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write to the Free Software
26 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 # CONTRIBUTION SUBMISSION POLICY:
31 # (The following paragraph is not intended to limit the rights granted
32 # to you to modify and distribute this software under the terms of
33 # the GNU General Public License and is only of importance to you if
34 # you choose to contribute your changes and enhancements to the
35 # community by submitting them to Best Practical Solutions, LLC.)
37 # By intentionally submitting any modifications, corrections or
38 # derivatives to this work, or any other work intended for use with
39 # Request Tracker, to Best Practical Solutions, LLC, you confirm that
40 # you are the copyright holder for those contributions and you grant
41 # Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
42 # royalty-free, perpetual, license to use, copy, create derivative
43 # works based on those contributions, and sublicense and distribute
44 # those contributions and any derivatives thereof.
46 # }}} END BPS TAGGED BLOCK
48 # This is just a basic script that checks to make sure that all
49 # the modules needed by RT before you can install it.
53 no warnings qw(numeric redefine);
58 GetOptions(\%args, 'v|verbose', 'install', 'with-MYSQL', 'with-POSTGRESQL|with-pg|with-pgsql', 'with-SQLITE', 'with-ORACLE', 'with-FASTCGI', 'with-SPEEDYCGI', 'with-MODPERL1', 'with-MODPERL2' ,'with-DEV', 'download=s');
64 if ($args{'with-MODPERL2'}) {
68 $args{'with-MASON'} = 1;
69 $args{'with-CORE'} = 1;
72 $args{'with-MAILGATE'} =1;
76 NOTE: mod_perl 2.0 isn't quite ready for prime_time just yet;
77 Best Practical Solutions strongly recommends that sites use
78 Apache 1.3 or FastCGI. If you MUST use mod_perl 2.0 (or 1.99),
79 please read the mailing list archives before asking for help.
89 By default, testdeps determine whether you have
90 installed all the perl modules RT needs to run.
92 --install Install missing modules
94 The following switches will tell the tool to check for specific dependencies
96 --with-mysql Database interface for MySQL
97 --with-postgresql Database interface for PostgreSQL
98 --with-sqlite Database interface and driver for SQLite (unsupported)
99 --with-oracle Database interface for oracle (unsupported)
101 --with-fastcgi Libraries needed to support the fastcgi handler
102 --with-speedycgi Libraries needed to support the speedycgi handler
103 --with-modperl1 Libraries needed to support the modperl 1 handler
104 --with-modperl2 Libraries needed to support the modperl 2 handler
106 --with-dev Tools needed for RT development
108 You can also specify -v or --verbose to list the status of all dependencies,
109 rather than just the missing ones.
115 map { /(\S+)\s*(\S*)/; $1 => ($2 ? $2 :'') } split ( /\n/, $_[0] );
118 $deps{'CORE'} = [ _( << '.') ];
123 Class::ReturnValue 0.40
124 DBIx::SearchBuilder 1.01
131 Locale::Maketext 1.06
132 Locale::Maketext::Lexicon 0.32
133 Locale::Maketext::Fuzzy
145 Module::Versions::Report
148 $deps{'MASON'} = [ _( << '.') ];
149 Params::Validate 0.02
151 Exception::Class 1.14
163 $deps{'MAILGATE'} = [ _( << '.') ];
170 $deps{'CLI'} = [ _( << '.') ];
174 $deps{'DEV'} = [ _( << '.') ];
184 $deps{'FASTCGI'} = [ _( << '.') ];
190 $deps{'SPEEDYCGI'} = [ _( << '.') ];
196 $deps{'MODPERL1'} = [ _( << '.') ];
202 $deps{'MODPERL2'} = [ _( << '.') ];
207 $deps{'MYSQL'} = [ _( << '.') ];
210 $deps{'ORACLE'} = [ _( << '.') ];
213 $deps{'POSTGRESQL'} = [ _( << '.') ];
217 $deps{'SQLITE'} = [ _( << '.') ];
221 if ($args{'download'}) {
225 foreach my $key (keys %deps) {
226 my @deps = (@{$deps{$key}});
228 my $mod = shift @deps;
229 my $ver = shift @deps;
230 next if ($mod =~ /^(DBD-|Apache-Request)/);
231 $modules{$mod} = $ver;
234 my @mods = keys %modules;
236 my $moddir = $args{'download'};
237 foreach my $mod (@mods) {
238 $CPAN::Config->{'build_dir'} = $moddir;
242 opendir(DIR, $moddir);
243 while ( my $dir = readdir(DIR)) {
244 print "Dir is $dir\n";
245 next if ( $dir =~ /^\.\.?$/);
247 if ($dir =~ /^(.*)-(.*?)$/) {
249 `svn_load_dirs.pl file:///Users/jesse/mod-repo $1 $moddir/$dir`;
250 `rm -rf $moddir/$dir`;
262 eval {require 5.008003};
264 print "...MISSING.\n";
265 eval {require 5.008000};
267 print "\nRT is known to be non-functional on versions of perl older than 5.8.3.\nPlease upgrade to 5.8.3 or newer\n\n";
271 eval {require 5.008003};
273 print "\nRT is known to be non-functional on versions of perl older than 5.8.3.\nPlease upgrade to 5.8.3 or newer\n\n";
276 print "...found\n" if $args{'v'};
280 print "\trt group (@RTGROUP@)...", (defined getgrnam("@RTGROUP@") ? "found" : "MISSING"), "\n";
281 print "\tbin owner (@BIN_OWNER@)...", (defined getpwnam("@BIN_OWNER@") ? "found" : "MISSING"), "\n";
282 print "\tlibs owner (@LIBS_OWNER@)...", (defined getpwnam("@LIBS_OWNER@") ? "found" : "MISSING"), "\n";
283 print "\tlibs group (@LIBS_GROUP@)...", (defined getgrnam("@LIBS_GROUP@") ? "found" : "MISSING"), "\n";
284 print "\tweb owner (@WEB_USER@)...", (defined getpwnam("@WEB_USER@") ? "found" : "MISSING"), "\n";
285 print "\tweb group (@WEB_GROUP@)...", (defined getgrnam("@WEB_GROUP@") ? "found" : "MISSING"), "\n";
287 foreach my $type (keys %args) {
288 next unless ($type =~ /^with-(.*?)$/);
290 print "$type dependencies:\n";
291 my @deps = (@{$deps{$type}});
293 my $module = shift @deps;
294 my $version = shift @deps;
295 my $ret = test_dep($module, $version);
297 if ($args{'install'} && !$ret) {
298 resolve_dep($module);
307 eval "use $module $version ()";
310 $error =~ s/\n(.*)$//s;
311 print "\t$module $version";
312 print "...MISSING\n";
313 print "\t\t$error\n" if $error =~ /this is only/;
317 print "\t$module $version...found\n" if $args{'v'};
325 CPAN::Shell->install($module);
335 $0 is a tool for RT that will tell you if you've got all
336 the modules RT depends on properly installed.
338 Flags: (only one flag is valid for a given run)
340 -quiet will check to see if we've got everything we need
341 and will exit with a return code of (1) if we don't.
343 -warn will tell you what isn't properly installed
345 -fix will use CPANPLUS.pm or CPAN.pm to magically make everything better