2 # BEGIN BPS TAGGED BLOCK {{{
6 # This software is Copyright (c) 1996-2005 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);
59 'install', 'with-MYSQL',
60 'with-POSTGRESQL|with-pg|with-pgsql', 'with-SQLITE',
61 'with-ORACLE', 'with-FASTCGI',
62 'with-SPEEDYCGI', 'with-MODPERL1',
63 'with-MODPERL2', 'with-DEV',
74 $args{'with-MASON'} = 1;
75 $args{'with-CORE'} = 1;
78 $args{'with-MAILGATE'} =1;
81 my %always_show_sections = (
98 $any_missing = 1 unless $test;
99 if ($args{'v'} or not $test or $always_show_sections{$section}) {
101 print $test ? "found" : "MISSING";
105 print "\t\t$extra\n" if defined $extra;
110 print "\nSOMETHING WAS MISSING!\n";
112 print "\nEverything was found.\n";
121 By default, testdeps determine whether you have
122 installed all the perl modules RT needs to run.
124 --install Install missing modules
126 The following switches will tell the tool to check for specific dependencies
128 --with-mysql Database interface for MySQL
129 --with-postgresql Database interface for PostgreSQL
130 --with-sqlite Database interface and driver for SQLite (unsupported)
131 --with-oracle Database interface for oracle (unsupported)
133 --with-fastcgi Libraries needed to support the fastcgi handler
134 --with-speedycgi Libraries needed to support the speedycgi handler
135 --with-modperl1 Libraries needed to support the modperl 1 handler
136 --with-modperl2 Libraries needed to support the modperl 2 handler
138 --with-dev Tools needed for RT development
140 You can also specify -v or --verbose to list the status of all dependencies,
141 rather than just the missing ones.
147 map { /(\S+)\s*(\S*)/; $1 => ($2 ? $2 :'') } split ( /\n/, $_[0] );
150 $deps{'CORE'} = [ _( << '.') ];
155 Class::ReturnValue 0.40
156 DBIx::SearchBuilder 1.35
163 Locale::Maketext 1.06
164 Locale::Maketext::Lexicon 0.32
165 Locale::Maketext::Fuzzy
178 Module::Versions::Report
179 Cache::Simple::TimedExpiry
183 $deps{'MASON'} = [ _( << '.') ];
184 Params::Validate 0.02
186 Exception::Class 1.14
196 HTTP::Server::Simple 0.07
197 HTTP::Server::Simple::Mason 0.09
201 $deps{'MAILGATE'} = [ _( << '.') ];
208 $deps{'CLI'} = [ _( << '.') ];
212 $deps{'DEV'} = [ _( << '.') ];
223 $deps{'FASTCGI'} = [ _( << '.') ];
229 $deps{'SPEEDYCGI'} = [ _( << '.') ];
235 $deps{'MODPERL1'} = [ _( << '.') ];
241 $deps{'MODPERL2'} = [ _( << '.') ];
247 $deps{'MYSQL'} = [ _( << '.') ];
250 $deps{'ORACLE'} = [ _( << '.') ];
253 $deps{'POSTGRESQL'} = [ _( << '.') ];
257 $deps{'SQLITE'} = [ _( << '.') ];
261 if ($args{'download'}) {
267 check_perl_version();
272 foreach my $type (keys %args) {
273 next unless ($type =~ /^with-(.*?)$/);
275 section("$type dependencies");
276 my @deps = (@{$deps{$type}});
278 my $module = shift @deps;
279 my $version = shift @deps;
280 my $ret = test_dep($module, $version);
282 if ($args{'install'} && !$ret) {
283 resolve_dep($module);
294 eval "use $module $version ()";
297 $error =~ s/\n(.*)$//s;
298 undef $error unless $error =~ /this is only/;
299 found("$module $version", 0, $error);
303 found("$module $version", 1);
310 system( qq[@PERL@ -MCPAN -e'install("$module")'] );
317 foreach my $key (keys %deps) {
318 my @deps = (@{$deps{$key}});
320 my $mod = shift @deps;
321 my $ver = shift @deps;
322 next if ($mod =~ /^(DBD-|Apache-Request)/);
323 $modules{$mod} = $ver;
326 my @mods = keys %modules;
328 my $moddir = $args{'download'};
329 foreach my $mod (@mods) {
330 $CPAN::Config->{'build_dir'} = $moddir;
334 opendir(DIR, $moddir);
335 while ( my $dir = readdir(DIR)) {
336 print "Dir is $dir\n";
337 next if ( $dir =~ /^\.\.?$/);
339 # Skip things we've previously tagged
340 my $out = `svn ls $args{'repository'}/tags/$dir`;
343 if ($dir =~ /^(.*)-(.*?)$/) {
344 `svn_load_dirs -no_user_input -t tags/$dir -v $args{'repository'} dists/$1 $moddir/$dir`;
345 `rm -rf $moddir/$dir`;
354 sub check_perl_version {
356 eval {require 5.008003};
358 found("5.8.3", 0, "RT is known to be non-functional on versions of perl older than 5.8.3. Please upgrade to 5.8.3 or newer.");
367 found("rt group (@RTGROUP@)", defined getgrnam("@RTGROUP@"));
368 found("bin owner (@BIN_OWNER@)", defined getpwnam("@BIN_OWNER@"));
369 found("libs owner (@LIBS_OWNER@)", defined getpwnam("@LIBS_OWNER@"));
370 found("libs group (@LIBS_GROUP@)", defined getgrnam("@LIBS_GROUP@"));
371 found("web owner (@WEB_USER@)", defined getpwnam("@WEB_USER@"));
372 found("web group (@WEB_GROUP@)", defined getgrnam("@WEB_GROUP@"));