Bug 1270536 - Provide helper script to run cpanm with sane default arguments

parent af3c716b
...@@ -48,6 +48,7 @@ init_console(); ...@@ -48,6 +48,7 @@ init_console();
my %switch; my %switch;
GetOptions(\%switch, 'help|h|?', GetOptions(\%switch, 'help|h|?',
'no-templates|t', 'verbose|v|no-silent', 'no-templates|t', 'verbose|v|no-silent',
'cpanm:s',
'make-admin=s', 'reset-password=s', 'version|V', 'make-admin=s', 'reset-password=s', 'version|V',
'no-permissions|p'); 'no-permissions|p');
...@@ -58,9 +59,35 @@ pod2usage({-verbose => 1, -exitval => 1}) if $switch{'help'}; ...@@ -58,9 +59,35 @@ pod2usage({-verbose => 1, -exitval => 1}) if $switch{'help'};
# non-interactive mode. # non-interactive mode.
my $answers_file = $ARGV[0]; my $answers_file = $ARGV[0];
my $silent = $answers_file && !$switch{'verbose'}; my $silent = $answers_file && !$switch{'verbose'};
print(install_string('header', get_version_and_os()) . "\n") unless $silent; print(install_string('header', get_version_and_os()) . "\n") unless $silent;
exit 0 if $switch{'version'}; exit 0 if $switch{'version'};
if (defined $switch{cpanm}) {
my $default = 'all notest -oracle -mysql -pg -mod_perl -old_charts -new_charts -graphical_reports -detect_charset';
my @features = split(/\s+/, $switch{cpanm} || $default);
my @cpanm_args = ('-l', 'local', '--installdeps');
while (my $feature = shift @features) {
if ($feature eq 'all') {
push @cpanm_args, '--with-all-features';
}
elsif ($feature eq 'default') {
unshift @features, split(/\s+/, $default);
}
elsif ($feature eq 'notest') {
push @cpanm_args, '--notest';
}
elsif ($feature =~ /^-(.+)$/) {
push @cpanm_args, "--without-feature=$1";
}
else {
push @cpanm_args, "--with-feature=$feature";
}
}
print "cpanm @cpanm_args \".\"\n" if !$silent;
my $rv = system('cpanm', @cpanm_args, '.');
exit 1 if $rv != 0;
}
my $meta = load_cpan_meta(); my $meta = load_cpan_meta();
my $requirements = check_cpan_requirements($meta, \@BUGZILLA_INC, !$silent); my $requirements = check_cpan_requirements($meta, \@BUGZILLA_INC, !$silent);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment