summaryrefslogtreecommitdiffstats
path: root/checksetup.pl
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2016-05-05 18:18:48 +0200
committerDylan William Hardison <dylan@hardison.net>2016-05-10 16:06:42 +0200
commit31317bc348532126d299bd89370b0e51e5831f31 (patch)
tree2983e1080aa6e2444ec214e9dda4a1b7e630273b /checksetup.pl
parentaf3c716b7dbe9e44719766593f6c51cf30a054e7 (diff)
downloadbugzilla-31317bc348532126d299bd89370b0e51e5831f31.tar.gz
bugzilla-31317bc348532126d299bd89370b0e51e5831f31.tar.xz
Bug 1270536 - Provide helper script to run cpanm with sane default arguments
Diffstat (limited to 'checksetup.pl')
-rwxr-xr-xchecksetup.pl29
1 files changed, 28 insertions, 1 deletions
diff --git a/checksetup.pl b/checksetup.pl
index 02264f6c0..ead6aa2d3 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -48,6 +48,7 @@ init_console();
my %switch;
GetOptions(\%switch, 'help|h|?',
'no-templates|t', 'verbose|v|no-silent',
+ 'cpanm:s',
'make-admin=s', 'reset-password=s', 'version|V',
'no-permissions|p');
@@ -58,9 +59,35 @@ pod2usage({-verbose => 1, -exitval => 1}) if $switch{'help'};
# non-interactive mode.
my $answers_file = $ARGV[0];
my $silent = $answers_file && !$switch{'verbose'};
-
print(install_string('header', get_version_and_os()) . "\n") unless $silent;
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 $requirements = check_cpan_requirements($meta, \@BUGZILLA_INC, !$silent);