Skip to content

Commit

Permalink
support --no-static-install to disable the static_install feature glo…
Browse files Browse the repository at this point in the history
…bally
  • Loading branch information
miyagawa committed Apr 26, 2018
1 parent 58cf45c commit d9559e7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
23 changes: 16 additions & 7 deletions App-cpanminus/xt/static_install.t
Expand Up @@ -3,13 +3,22 @@ use Test::More;
use lib ".";
use xt::Run;

run_L '--no-uninst-shadows', 'Acme::Pi';
unlike last_build_log, qr/installed Module-Build-Tiny/;
like last_build_log, qr/Distribution opts in x_static_install/;
{
run_L '--no-uninst-shadows', 'Acme::Pi';
unlike last_build_log, qr/iRunning (Makefile|Build)\.PL/;
like last_build_log, qr/Distribution opts in x_static_install/;
}

run_L '--no-uninst-shadows', '--no-notest', 'CPAN::Test::Dummy::Perl5::StaticInstall';
like last_build_log, qr/Checking if you have TAP::Harness::Env/;
like last_build_log, qr/Distribution opts in x_static_install/;
{
run_L '--no-static-install', 'Acme::CPANAuthors::Canadian';
like last_build_log, qr/Running Makefile\.PL/;
unlike last_build_log, qr/Distribution opts in x_static_install/;
}

done_testing;
{
run_L '--no-uninst-shadows', '--no-notest', 'CPAN::Test::Dummy::Perl5::StaticInstall';
like last_build_log, qr/Checking if you have TAP::Harness::Env/;
like last_build_log, qr/Distribution opts in x_static_install/;
}

done_testing;
9 changes: 6 additions & 3 deletions Menlo-Legacy/lib/Menlo/CLI/Compat.pm
Expand Up @@ -82,6 +82,7 @@ sub new {
uninstall_shadows => ($] < 5.012),
skip_installed => 1,
skip_satisfied => 0,
static_install => 1,
auto_cleanup => 7, # days
pod2man => 1,
installed_dists => 0,
Expand Down Expand Up @@ -207,6 +208,7 @@ sub parse_options {
$self->{save_dists} = $self->maybe_abs($_[1]);
},
'skip-configure!' => \$self->{skip_configure},
'static-install!' => \$self->{static_install},
'dev!' => \$self->{dev_release},
'metacpan!' => \$self->{metacpan},
'report-perl-version!' => \$self->{report_perl_version},
Expand Down Expand Up @@ -2116,12 +2118,13 @@ DIAG
sub opts_in_static_install {
my($self, $meta) = @_;

return if !$self->{static_install};

# --sudo requires running a separate shell to prevent persistent configuration
# uninstall-shadows (default on < 5.12) is not supported in BuildPL spec, yet.
return if $self->{sudo} or $self->{uninstall_shadows};

return $meta->{x_static_install} &&
$meta->{x_static_install} == 1 &&
!($self->{sudo} or $self->{uninstall_shadows});
return $meta->{x_static_install} && $meta->{x_static_install} == 1;
}

sub skip_configure {
Expand Down

0 comments on commit d9559e7

Please sign in to comment.