broadband_nas export, #15284
[freeside.git] / rt / sbin / rt-test-dependencies.in
index 9819108..1ce118f 100644 (file)
@@ -1,41 +1,41 @@
 #!@PERL@
 # BEGIN BPS TAGGED BLOCK {{{
-# 
+#
 # COPYRIGHT:
-# 
-# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
-#                                          <jesse@bestpractical.com>
-# 
+#
+# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+#                                          <sales@bestpractical.com>
+#
 # (Except where explicitly superseded by other copyright notices)
-# 
-# 
+#
+#
 # LICENSE:
-# 
+#
 # This work is made available to you under the terms of Version 2 of
 # the GNU General Public License. A copy of that license should have
 # been provided with this software, but in any event can be snarfed
 # from www.gnu.org.
-# 
+#
 # This work is distributed in the hope that it will be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 # General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301 or visit their web page on the internet at
 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-# 
-# 
+#
+#
 # CONTRIBUTION SUBMISSION POLICY:
-# 
+#
 # (The following paragraph is not intended to limit the rights granted
 # to you to modify and distribute this software under the terms of
 # the GNU General Public License and is only of importance to you if
 # you choose to contribute your changes and enhancements to the
 # community by submitting them to Best Practical Solutions, LLC.)
-# 
+#
 # By intentionally submitting any modifications, corrections or
 # derivatives to this work, or any other work intended for use with
 # Request Tracker, to Best Practical Solutions, LLC, you confirm that
@@ -44,7 +44,7 @@
 # royalty-free, perpetual, license to use, copy, create derivative
 # works based on those contributions, and sublicense and distribute
 # those contributions and any derivatives thereof.
-# 
+#
 # END BPS TAGGED BLOCK }}}
 #
 # This is just a basic script that checks to make sure that all
@@ -60,7 +60,7 @@ GetOptions(
     \%args,                               'v|verbose',
     'install',                            'with-MYSQL',
     'with-POSTGRESQL|with-pg|with-pgsql', 'with-SQLITE',
-    'with-ORACLE',                        'with-FASTCGI',
+    'with-ORACLE',                        'with-FASTCGI', 'with-FASTCGI-SERVER',
     'with-SPEEDYCGI',                     'with-MODPERL1',
     'with-MODPERL2',                      'with-DEV',
     'with-STANDALONE',
@@ -147,7 +147,8 @@ sub conclude {
             for my $name ( keys %$missing ) {
                 my $module  = $missing->{$name};
                 my $version = $module->{version};
-                print_found( $name . ( $version ? " >= $version" : "" ),
+                my $error = $module->{error};
+                print_found( $name . ( $version && !$error ? " >= $version" : "" ),
                     0, $module->{error} );
             }
         }
@@ -172,11 +173,12 @@ The following switches will tell the tool to check for specific dependencies
     --with-oracle       Database interface for Oracle
     --with-sqlite       Database interface and driver for SQLite (unsupported)
 
-    --with-standalone   Libraries needed to support the standalone simple pure perl server
-    --with-fastcgi      Libraries needed to support the fastcgi handler
-    --with-speedycgi    Libraries needed to support the speedycgi handler
-    --with-modperl1     Libraries needed to support the modperl 1 handler
-    --with-modperl2     Libraries needed to support the modperl 2 handler
+    --with-standalone     Libraries needed to support the standalone simple pure perl server
+    --with-fastcgi-server Libraries needed to support the external fastcgi server
+    --with-fastcgi        Libraries needed to support the fastcgi handler
+    --with-speedycgi      Libraries needed to support the speedycgi handler
+    --with-modperl1       Libraries needed to support the modperl 1 handler
+    --with-modperl2       Libraries needed to support the modperl 2 handler
 
     --with-dev          Tools needed for RT development
 
@@ -206,6 +208,7 @@ sub text_to_hash {
 $deps{'CORE'} = [ text_to_hash( << '.') ];
 Digest::base
 Digest::MD5 2.27
+Digest::SHA
 DBI 1.37
 Class::ReturnValue 0.40
 DBIx::SearchBuilder 1.54
@@ -225,7 +228,7 @@ Email::Address
 Text::Wrapper 
 Time::ParseDate
 Time::HiRes 
-File::Temp 0.18
+File::Temp 0.19
 Text::Quoted 2.02
 Tree::Simple 1.04
 UNIVERSAL::require
@@ -255,7 +258,7 @@ Devel::StackTrace 1.19
 
 $deps{'STANDALONE'} = [ text_to_hash( << '.') ];
 HTTP::Server::Simple 0.34
-HTTP::Server::Simple::Mason 0.09
+HTTP::Server::Simple::Mason 0.14
 Net::Server
 .
 
@@ -295,6 +298,7 @@ Test::Builder 0.77 # needed to fix TODO test
 IPC::Run3
 Test::MockTime
 HTTP::Server::Simple::Mason 0.13
+Log::Dispatch::Perl
 .
 
 $deps{'FASTCGI'} = [ text_to_hash( << '.') ];
@@ -303,6 +307,16 @@ FCGI
 CGI::Fast 
 .
 
+$deps{'FASTCGI-SERVER'} = [ text_to_hash( << '.') ];
+CGI 3.38
+CGI::Fast
+FCGI::ProcManager
+File::Basename
+File::Spec
+Getopt::Long
+Pod::Usage
+.
+
 $deps{'SPEEDYCGI'} = [ text_to_hash( << '.') ];
 CGI 3.38
 CGI::SpeedyCGI
@@ -367,8 +381,11 @@ GD::Graph
 GD::Text
 .
 
-if ($args{'download'}) {
+my %AVOID = (
+    'DBD::Oracle' => [qw(1.23)],
+);
 
+if ($args{'download'}) {
     download_mods();
 }
 
@@ -392,7 +409,8 @@ foreach my $type (sort grep $args{$_}, keys %args) {
     if ( $args{'install'} ) {
         for my $module (keys %missing) {
             resolve_dep($module, $missing{$module}{version});
-            delete $missing{$module} if test_dep($module, $missing{$module}{version});
+            delete $missing{$module}
+                if test_dep($module, $missing{$module}{version}, $AVOID{$module});
         }
     }
 
@@ -408,8 +426,8 @@ sub test_deps {
     while(@deps) {
         my $module = shift @deps;
         my $version = shift @deps;
-        my($test, $error) = test_dep($module, $version);
-        my $msg = $module . ($version ? " >= $version" : '');
+        my($test, $error) = test_dep($module, $version, $AVOID{$module});
+        my $msg = $module . ($version && !$error ? " >= $version" : '');
         print_found($msg, $test, $error);
 
         $missing{$module} = { version => $version, error => $error } unless $test;
@@ -421,23 +439,32 @@ sub test_deps {
 sub test_dep {
     my $module = shift;
     my $version = shift;
+    my $avoid = shift;
 
     if ( $args{'list-deps'} ) {
         print $module, ': ', $version || 0, "\n"; 
     }
     else {
         eval "use $module $version ()";
-        if ($@) {
-            my $error = $@;
+        if ( my $error = $@ ) {
+            return 0 unless wantarray;
+
             $error =~ s/\n(.*)$//s;
             $error =~ s/at \(eval \d+\) line \d+\.$//;
-            undef $error unless $error =~ /this is only/;
+            undef $error if $error =~ /this is only/;
 
             return ( 0, $error );
         }
-        else {
-            return 1;
+        
+        if ( $avoid ) {
+            my $version = $module->VERSION;
+            if ( grep $version eq $_, @$avoid ) {
+                return 0 unless wantarray;
+                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.");
+            }
         }
+
+        return 1;
     }
 }