2 # BEGIN BPS TAGGED BLOCK {{{
6 # This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
7 # <sales@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., 51 Franklin Street, Fifth Floor, Boston, MA
27 # 02110-1301 or visit their web page on the internet at
28 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
31 # CONTRIBUTION SUBMISSION POLICY:
33 # (The following paragraph is not intended to limit the rights granted
34 # to you to modify and distribute this software under the terms of
35 # the GNU General Public License and is only of importance to you if
36 # you choose to contribute your changes and enhancements to the
37 # community by submitting them to Best Practical Solutions, LLC.)
39 # By intentionally submitting any modifications, corrections or
40 # derivatives to this work, or any other work intended for use with
41 # Request Tracker, to Best Practical Solutions, LLC, you confirm that
42 # you are the copyright holder for those contributions and you grant
43 # Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
44 # royalty-free, perpetual, license to use, copy, create derivative
45 # works based on those contributions, and sublicense and distribute
46 # those contributions and any derivatives thereof.
48 # END BPS TAGGED BLOCK }}}
50 # This is just a basic script that checks to make sure that all
51 # the modules needed by RT before you can install it.
55 no warnings qw(numeric redefine);
61 'install', 'with-MYSQL',
62 'with-POSTGRESQL|with-pg|with-pgsql', 'with-SQLITE',
63 'with-ORACLE', 'with-FASTCGI',
64 'with-MODPERL1', 'with-MODPERL2',
86 Pod::Usage::pod2usage( { verbose => 2 } );
101 'with-GRAPHVIZ' => 0,
103 'with-DASHBOARDS' => 1,
104 'with-USERLOGO' => 1,
105 'with-SSL-MAILGATE' => 0,
107 $args{$_} = $default{$_} foreach grep !exists $args{$_}, keys %default;
111 my %always_show_sections = (
119 print "$s:\n" unless $args{'list-deps'};
127 unless ( $args{'list-deps'} ) {
128 if ( $args{'v'} or not $test or $always_show_sections{$section} ) {
130 print $test ? "found" : "MISSING";
134 print "\t\t$extra\n" if defined $extra;
140 my %missing_by_type = @_;
142 unless ( $args{'list-deps'} ) {
143 unless ( keys %missing_by_type ) {
144 print "\nAll dependencies have been found.\n";
148 print "\nSOME DEPENDENCIES WERE MISSING.\n";
150 for my $type ( keys %missing_by_type ) {
151 my $missing = $missing_by_type{$type};
153 print "$type missing dependencies:\n";
154 for my $name ( keys %$missing ) {
155 my $module = $missing->{$name};
156 my $version = $module->{version};
157 my $error = $module->{error};
158 print_found( $name . ( $version && !$error ? " >= $version" : "" ),
159 0, $module->{error} );
168 for my $line ( split /\n/, $_[0] ) {
169 my($key, $value) = $line =~ /(\S+)\s*(\S*)/;
171 $hash{$key} = $value;
177 $deps{'CORE'} = [ text_to_hash( << '.') ];
180 DateTime::Locale 0.40
185 Class::ReturnValue 0.40
186 DBIx::SearchBuilder 1.59
194 Locale::Maketext 1.06
195 Locale::Maketext::Lexicon 0.32
196 Locale::Maketext::Fuzzy
209 Module::Versions::Report 1.05
210 Cache::Simple::TimedExpiry
214 Devel::StackTrace 1.19
215 Text::Password::Pronounceable
216 Devel::GlobalDestruction
219 Regexp::Common::net::CIDR
223 $deps{'MASON'} = [ text_to_hash( << '.') ];
231 Text::WikiFormat 0.76
233 Devel::StackTrace 1.19
238 $deps{'PSGI'} = [ text_to_hash( << '.') ];
241 HTML::Mason::PSGIHandler 0.52
243 Plack::Handler::Starlet
247 $deps{'MAILGATE'} = [ text_to_hash( << '.') ];
255 $deps{'SSL-MAILGATE'} = [ text_to_hash( << '.') ];
263 $deps{'CLI'} = [ text_to_hash( << '.') ];
266 HTTP::Request::Common
272 $deps{'DEV'} = [ text_to_hash( << '.') ];
278 Test::WWW::Mechanize 1.30
283 Test::Deep 0 # needed for shredder tests
284 String::ShellQuote 0 # needed for gnupg-incoming.t
287 Test::Builder 0.90 # needed for is_passing
290 Test::WWW::Mechanize::PSGI
291 Plack::Middleware::Test::StashWarnings
295 $deps{'FASTCGI'} = [ text_to_hash( << '.') ];
300 $deps{'MODPERL1'} = [ text_to_hash( << '.') ];
305 $deps{'MODPERL2'} = [ text_to_hash( << '.') ];
310 $deps{'MYSQL'} = [ text_to_hash( << '.') ];
314 $deps{'ORACLE'} = [ text_to_hash( << '.') ];
318 $deps{'POSTGRESQL'} = [ text_to_hash( << '.') ];
322 $deps{'SQLITE'} = [ text_to_hash( << '.') ];
326 $deps{'GPG'} = [ text_to_hash( << '.') ];
331 $deps{'ICAL'} = [ text_to_hash( << '.') ];
335 $deps{'SMTP'} = [ text_to_hash( << '.') ];
339 $deps{'DASHBOARDS'} = [ text_to_hash( << '.') ];
340 HTML::RewriteAttributes 0.04
344 $deps{'GRAPHVIZ'} = [ text_to_hash( << '.') ];
349 $deps{'GD'} = [ text_to_hash( << '.') ];
355 $deps{'USERLOGO'} = [ text_to_hash( << '.') ];
360 'DBD::Oracle' => [qw(1.23)],
363 if ($args{'download'}) {
368 check_perl_version();
372 my %Missing_By_Type = ();
373 foreach my $type (sort grep $args{$_}, keys %args) {
374 next unless ($type =~ /^with-(.*?)$/) and $deps{$1};
377 section("$type dependencies");
380 my @deps = @{ $deps{$type} };
382 my %missing = test_deps(@deps);
384 if ( $args{'install'} ) {
385 for my $module (keys %missing) {
386 resolve_dep($module, $missing{$module}{version});
387 my $m = $module . '.pm';
389 if ( delete $INC{$m} ) {
390 my $symtab = $module . '::';
392 for my $symbol ( keys %{$symtab} ) {
393 next if substr( $symbol, -2, 2 ) eq '::';
394 delete $symtab->{$symbol};
397 delete $missing{$module}
398 if test_dep($module, $missing{$module}{version}, $AVOID{$module});
402 $Missing_By_Type{$type} = \%missing if keys %missing;
405 conclude(%Missing_By_Type);
412 my $module = shift @deps;
413 my $version = shift @deps;
414 my($test, $error) = test_dep($module, $version, $AVOID{$module});
415 my $msg = $module . ($version && !$error ? " >= $version" : '');
416 print_found($msg, $test, $error);
418 $missing{$module} = { version => $version, error => $error } unless $test;
429 if ( $args{'list-deps'} ) {
430 print $module, ': ', $version || 0, "\n";
433 eval "use $module $version ()";
434 if ( my $error = $@ ) {
435 return 0 unless wantarray;
437 $error =~ s/\n(.*)$//s;
438 $error =~ s/at \(eval \d+\) line \d+\.$//;
439 undef $error if $error =~ /this is only/;
441 return ( 0, $error );
445 my $version = $module->VERSION;
446 if ( grep $version eq $_, @$avoid ) {
447 return 0 unless wantarray;
448 return (0, "It's known that there are problems with RT and version '$version' of '$module' module. If it's the latest available version of the module then you have to downgrade manually.");
460 print "\nInstall module $module\n";
462 my $ext = $ENV{'RT_FIX_DEPS_CMD'} || $ENV{'PERL_PREFER_CPAN_CLIENT'};
467 if ( $ENV{'HOME'} ) {
468 unshift @INC, "$ENV{'HOME'}/.cpan";
470 $configured = eval { require CPAN::MyConfig } || eval { require CPAN::Config };
472 unless ( $configured ) {
474 You haven't configured the CPAN shell yet.
475 Please run `/usr/bin/perl -MCPAN -e shell` to configure it.
479 my $rv = eval { require CPAN; CPAN::Shell->install($module) };
480 return $rv unless $@;
483 Failed to load module CPAN.
485 -------- Error ---------
487 ------------------------
489 When we tried to start installing RT's perl dependencies,
490 we were unable to load the CPAN client. This module is usually distributed
491 with Perl. This usually indicates that your vendor has shipped an unconfigured
492 or incorrectly configured CPAN client.
493 The error above may (or may not) give you a hint about what went wrong
495 You have several choices about how to install dependencies in
498 1) use a different tool to install dependencies by running setting the following
499 shell environment variable and rerunning this tool:
500 RT_FIX_DEPS_CMD='/usr/bin/perl -MCPAN -e"install %s"'
501 2) Attempt to configure CPAN by running:
502 `/usr/bin/perl -MCPAN -e shell` program from shell.
503 If this fails, you may have to manually upgrade CPAN (see below)
504 3) Try to update the CPAN client. Download it from:
505 http://search.cpan.org/dist/CPAN and try again
506 4) Install each dependency manually by downloading them one by one from
507 http://search.cpan.org
514 $ext =~ s/\%s/$module/g; # sprintf( $ext, $module );
518 print "\t\tcommand: '$ext'\n";
519 return scalar `$ext 1>&2`;
526 foreach my $key (keys %deps) {
527 my @deps = (@{$deps{$key}});
529 my $mod = shift @deps;
530 my $ver = shift @deps;
531 next if ($mod =~ /^(DBD-|Apache-Request)/);
532 $modules{$mod} = $ver;
535 my @mods = keys %modules;
537 my $moddir = $args{'download'};
538 foreach my $mod (@mods) {
539 $CPAN::Config->{'build_dir'} = $moddir;
543 opendir(DIR, $moddir);
544 while ( my $dir = readdir(DIR)) {
545 print "Dir is $dir\n";
546 next if ( $dir =~ /^\.\.?$/);
548 # Skip things we've previously tagged
549 my $out = `svn ls $args{'repository'}/tags/$dir`;
552 if ($dir =~ /^(.*)-(.*?)$/) {
553 `svn_load_dirs -no_user_input -t tags/$dir -v $args{'repository'} dists/$1 $moddir/$dir`;
554 `rm -rf $moddir/$dir`;
563 sub check_perl_version {
565 eval {require 5.008003};
567 print_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.");
570 print_found( sprintf(">=5.8.3(%vd)", $^V), 1 );
576 print_found("rt group (freeside)", defined getgrnam("freeside"));
577 print_found("bin owner (root)", defined getpwnam("root"));
578 print_found("libs owner (root)", defined getpwnam("root"));
579 print_found("libs group (bin)", defined getgrnam("bin"));
580 print_found("web owner (freeside)", defined getpwnam("freeside"));
581 print_found("web group (freeside)", defined getgrnam("freeside"));
590 rt-test-dependencies - test rt's dependencies
595 rt-test-dependencies --install
596 rt-test-dependencies --with-mysql --with-fastcgi
600 by default, C<rt-test-dependencies> determines whether you have installed all
601 the perl modules RT needs to run.
603 the "RT_FIX_DEPS_CMD" environment variable, if set, will be used instead of
604 the standard CPAN shell by --install to install any required modules. it will
605 be called with the module name, or, if "RT_FIX_DEPS_CMD" contains a "%s", will
606 replace the "%s" with the module name before calling the program.
614 install missing modules
618 list the status of all dependencies, rather than just the missing ones.
620 -v is equal to --verbose
622 =item specify dependencies
628 database interface for mysql
630 =item --with-postgresql
632 database interface for postgresql
636 database interface for oracle
640 database interface and driver for sqlite (unsupported)
644 libraries needed to support the fastcgi handler
648 libraries needed to support the modperl 1 handler
652 libraries needed to support the modperl 2 handler
656 tools needed for RT development