]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 560691: Make sure that install-module.pl never prompts the user while
authorMax Kanat-Alexander <mkanat@bugzilla.org>
Wed, 21 Apr 2010 00:00:42 +0000 (17:00 -0700)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Wed, 21 Apr 2010 00:00:42 +0000 (17:00 -0700)
installing modules
r=mkanat, a=mkanat (module owner)

Bugzilla/Install/CPAN.pm
Bugzilla/Install/Requirements.pm

index b98d856316cdf05d35cf18dfc006ab264b9b45c8..bda283ce28ba15a3abbe355fc40888e2f3e24a7f 100644 (file)
@@ -127,6 +127,12 @@ sub install_module {
     my ($name, $test) = @_;
     my $bzlib = BZ_LIB;
 
+    # Make Module::AutoInstall install all dependencies and never prompt.
+    local $ENV{PERL_AUTOINSTALL} = '--alldeps';
+    # This makes Net::SSLeay not prompt the user, if it gets installed.
+    # It also makes any other MakeMaker prompts accept their defaults.
+    local $ENV{PERL_MM_USE_DEFAULT} = 1;
+
     # Certain modules require special stuff in order to not prompt us.
     my $original_makepl = $CPAN::Config->{makepl_arg};
     # This one's a regex in case we're doing Template::Plugin::GD and it
@@ -137,12 +143,13 @@ sub install_module {
     elsif ($name eq 'XML::Twig') {
         $CPAN::Config->{makepl_arg} = "-n $original_makepl";
     }
-    elsif ($name eq 'Net::LDAP') {
-        $CPAN::Config->{makepl_arg} .= " --skipdeps";
-    }
     elsif ($name eq 'SOAP::Lite') {
         $CPAN::Config->{makepl_arg} .= " --noprompt";
     }
+    # MIME-tools has a Module::Install that's too old to understand alldeps.
+    elsif ($name =~ /^MIME::/) {
+        $ENV{PERL_AUTOINSTALL} = '--defaultdeps';
+    }
 
     my $module = CPAN::Shell->expand('Module', $name);
     print install_string('install_module', 
index 83c6c2c90359d5cd1a2e69d02499ca5fc90dbf77..7b7047cc462417f8138e3e1fcb189b4bf3797841 100644 (file)
@@ -533,8 +533,9 @@ sub have_vers {
 
     eval "require $module;";
 
-    # VERSION is provided by UNIVERSAL::
-    my $vnum = eval { $module->VERSION } || -1;
+    # VERSION is provided by UNIVERSAL::, and can be called even if
+    # the module isn't loaded.
+    my $vnum = $module->VERSION || -1;
 
     # CGI's versioning scheme went 2.75, 2.751, 2.752, 2.753, 2.76
     # That breaks the standard version tests, so we need to manually correct