App-Sqitch
view release on metacpan or search on metacpan
inc/Menlo/Sqitch.pm view on Meta::CPAN
package Menlo::Sqitch;
use strict;
use warnings;
use base 'Menlo::CLI::Compat';
sub new {
my %deps;
while (<DATA>) {
last if /^Build-only dependencies/;
}
while (<DATA>) {
chomp;
last unless s/^\s+//;
$deps{$_} = 1;
}
shift->SUPER::new(
@_,
_remove => [],
_bld_deps => \%deps,
);
}
sub find_prereqs {
my ($self, $dist) = @_;
# Menlo defaults to config, test, runtime. We just want to bundle runtime.
$dist->{want_phases} = ['runtime'];
return $self->SUPER::find_prereqs($dist);
}
sub configure {
my $self = shift;
my $cmd = $_[0];
return $self->SUPER::configure(@_) if ref $cmd ne 'ARRAY';
# Always use vendor install dirs. Hack for
# https://github.com/miyagawa/cpanminus/issues/581.
if ($cmd->[1] eq 'Makefile.PL') {
push @{ $cmd } => 'INSTALLDIRS=vendor';
} elsif ($cmd->[1] eq 'Build.PL') {
push @{ $cmd } => '--installdirs', 'vendor';
}
return $self->SUPER::configure(@_);
}
sub save_meta {
my $self = shift;
my ($module, $dist) = @_;
# Record if we've installed a build-only dependency.
my $dname = $dist->{meta}{name};
push @{ $self->{_remove} } => $module if $self->{_bld_deps}{$dname};
$self->SUPER::save_meta(@_);
}
sub remove_build_dependencies {
# Uninstall modules for distributions not actually needed to run Sqitch.
my $self = shift;
local $self->{force} = 1;
my @fail;
for my $mod (reverse @{ $self->{_remove} }) {
$self->uninstall_module($mod) or push @fail, $mod;
}
return !@fail;
}
1;
# List of distributions that might be installed but are not actually needed to
# run Sqitch. Used to track unneeded installs so they can be removed by
# remove_build_dependencies().
#
# Data pasted from the report of build-only dependencies by
# dev/dependency_report.
__DATA__
Build-only dependencies
Alien-Build
Alien-cmake3
AppConfig
Archive-Tar
Archive-Zip
CPAN
CPAN-Checksums
CPAN-Common-Index
CPAN-DistnameInfo
CPAN-Meta
CPAN-Meta-Check
CPAN-Meta-Requirements
CPAN-Meta-YAML
CPAN-Perl-Releases
Capture-Tiny
Class-Tiny
Compress-Bzip2
Compress-Raw-Bzip2
Compress-Raw-Lzma
Compress-Raw-Zlib
Config-AutoConf
Data-Compare
Devel-CheckLib
Devel-Hide
Devel-Symdump
Digest
Digest-MD5
Dist-CheckConflicts
Dumpvalue
Expect
ExtUtils-CBuilder
ExtUtils-Config
ExtUtils-Constant
ExtUtils-Helpers
ExtUtils-Install
ExtUtils-InstallPaths
ExtUtils-MakeMaker
( run in 1.849 second using v1.01-cache-2.11-cpan-364913b4093 )