diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2011-04-24 17:11:03 -0700 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2011-04-24 17:11:03 -0700 |
commit | cabe538139ecdbc82ab2eb1e06fcf6f95f1dac5f (patch) | |
tree | a5ae2dff4ca9ae863cd156f036a6c89bdffa80a2 /Bugzilla/Install/CPAN.pm | |
parent | f0129cf8687a0f926be28b615d51230d641f8982 (diff) | |
download | bugs-cabe538139ecdbc82ab2eb1e06fcf6f95f1dac5f.tar bugs-cabe538139ecdbc82ab2eb1e06fcf6f95f1dac5f.tar.gz bugs-cabe538139ecdbc82ab2eb1e06fcf6f95f1dac5f.tar.bz2 bugs-cabe538139ecdbc82ab2eb1e06fcf6f95f1dac5f.tar.xz bugs-cabe538139ecdbc82ab2eb1e06fcf6f95f1dac5f.zip |
Bug 648178: Make install-module.pl check if a compiler is available
and fail with a clear error if not.
r=glob, a=mkanat
Diffstat (limited to 'Bugzilla/Install/CPAN.pm')
-rw-r--r-- | Bugzilla/Install/CPAN.pm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Bugzilla/Install/CPAN.pm b/Bugzilla/Install/CPAN.pm index 20cdb5bbd..48dcf6fc0 100644 --- a/Bugzilla/Install/CPAN.pm +++ b/Bugzilla/Install/CPAN.pm @@ -33,6 +33,7 @@ use Bugzilla::Constants; use Bugzilla::Install::Requirements qw(have_vers); use Bugzilla::Install::Util qw(bin_loc install_string); +use Config; use CPAN; use Cwd qw(abs_path); use File::Path qw(rmtree); @@ -102,6 +103,8 @@ use constant CPAN_DEFAULTS => { sub check_cpan_requirements { my ($original_dir, $original_args) = @_; + _require_compiler(); + my @install; foreach my $module (REQUIREMENTS) { my $installed = have_vers($module, 1); @@ -122,6 +125,26 @@ sub check_cpan_requirements { } } +sub _require_compiler { + my @errors; + + my $cc_name = $Config{cc}; + my $cc_exists = bin_loc($cc_name); + + if (!$cc_exists) { + push(@errors, install_string('install_no_compiler')); + } + + my $make_name = $CPAN::Config->{make}; + my $make_exists = bin_loc($make_name); + + if (!$make_exists) { + push(@errors, install_string('install_no_make')); + } + + die @errors if @errors; +} + sub install_module { my ($name, $test) = @_; my $bzlib = BZ_LIB; |