| 1 | package CPANPLUS::YACSmoke; | ||||||||||||||||||||||||||||
| 2 | 11 | $CPANPLUS::YACSmoke::VERSION = '1.06'; | |||||||||||||||||||||||||||
| 3 | # Dist::Zilla: +PodWeaver | ||||||||||||||||||||||||||||
| 4 | #ABSTRACT: Yet Another CPANPLUS Smoke Tester | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 11 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 11 | ▶ | use CPANPLUS::Backend; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 11 | ▶ | use CPANPLUS::Configure; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 11 | ▶ | use CPANPLUS::Error; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 11 | ▶ | use CPANPLUS::Internals::Constants; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 11 | ▶ | use POSIX qw( O_CREAT O_RDWR O_RDONLY ); # for SDBM_File | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 11 | ▶ | use SDBM_File; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 11 | ▶ | use File::Fetch; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 11 | ▶ | use IO::File; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 11 | ▶ | use File::Spec::Unix; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 11 | ▶ | use File::Spec::Functions; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 11 | ▶ | use File::Path; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 11 | ▶ | use CPANPLUS::YACSmoke::ReAssemble; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 11 | ▶ | use CPANPLUS::YACSmoke::SortVers; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 11 | ▶ | use CPANPLUS::YACSmoke::IniFiles; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 11 | ▶ | use constant DATABASE_FILE => 'cpansmoke.dat'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | 11 | ▶ | use constant CONFIG_FILE => 'cpansmoke.ini'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | 11 | ▶ | use constant RECENT_FILE => 'RECENT'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 11 | require Exporter; | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 11 | our @ISA = qw( Exporter ); | |||||||||||||||||||||||||||
| 32 | 11 | our %EXPORT_TAGS = ( | |||||||||||||||||||||||||||
| 33 | 'all' => [ qw( mark test excluded purge flush reindex) ], | ||||||||||||||||||||||||||||
| 34 | 'default' => [ qw( mark test excluded ) ], | ||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 11 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |||||||||||||||||||||||||||
| 38 | 11 | our @EXPORT = ( @{ $EXPORT_TAGS{'default'} } ); | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | { | ||||||||||||||||||||||||||||
| 41 | 11 | my %Checked; | |||||||||||||||||||||||||||
| 42 | 11 | my $TiedObj; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | sub _connect_db { | ||||||||||||||||||||||||||||
| 46 | 19 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_connect_db: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 47 | 19 | ▶ | return if $TiedObj; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | 19 | my $filename = catfile( $self->{conf}->get_conf('base'), DATABASE_FILE ); | |||||||||||||||||||||||||||
| 49 | 19 | $TiedObj = tie %Checked, 'SDBM_File', $filename, O_CREAT|O_RDWR, 0644; | |||||||||||||||||||||||||||
| 50 | 19 | $self->{checked} = \%Checked; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | sub _disconnect_db { | ||||||||||||||||||||||||||||
| 54 | 19 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_disconnect_db: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 55 | 19 | ▶ | return unless $TiedObj; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | 19 | $TiedObj = undef; | |||||||||||||||||||||||||||
| 57 | 19 | $self->{checked} = undef; | |||||||||||||||||||||||||||
| 58 | 19 | untie %Checked; | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | sub new { | ||||||||||||||||||||||||||||
| 62 | 10 | ▶ | my $package = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=13 SCAR=26.1
Pod
documented
| |||||||||||||||||||||||||||||
| 63 | 10 | ▶ | my $nconf = shift if ref $_[0] and $_[0]->isa('CPANPLUS::Configure'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $_[0] and $_[0]->isa("CPANPLUS::Configure")
MC/DC50%1/2
ref $_[0] and $_[0]->isa("CPANPLUS::Configure")
ref $_[0]
$_[0]->isa("CPANPLUS::Configure")
Truth table66%2/3
A and B
A= ref $_[0]B= $_[0]->isa("CPANPLUS::Configure")
| |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 10 | $ENV{AUTOMATED_TESTING} = 1; | |||||||||||||||||||||||||||
| 66 | 10 | $ENV{NONINTERACTIVE_TESTING} = 1; # Lancaster Consensus | |||||||||||||||||||||||||||
| 67 | 10 | $ENV{PERL_MM_USE_DEFAULT} = 1; # despite verbose setting | |||||||||||||||||||||||||||
| 68 | 10 | $ENV{PERL_EXTUTILS_AUTOINSTALL} = '--defaultdeps'; | |||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 10 | ▶ | my $conf = $nconf || CPANPLUS::Configure->new(); | ||||||||||||||||||||||||||
|
Condition66%2/3
$nconf || 'CPANPLUS::Configure'->new
MC/DC0%0/2
$nconf || 'CPANPLUS::Configure'->new
$nconf
'CPANPLUS::Configure'->new
Truth table66%2/3
A || B
A= $nconfB= 'CPANPLUS::Configure'->new
| |||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | # Override configure settings | ||||||||||||||||||||||||||||
| 73 | 10 | $conf->set_conf( prereqs => 2 ); # force to ask callback | |||||||||||||||||||||||||||
| 74 | 10 | $conf->set_conf( skiptest => 0 ); | |||||||||||||||||||||||||||
| 75 | 10 | ▶ | $conf->set_conf( no_update => 1 ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 76 | if glob( catfile( $conf->get_conf('base'), $conf->_get_source('stored') .'*'. STORABLE_EXT, ) ); | ||||||||||||||||||||||||||||
| 77 | 10 | $conf->set_conf( dist_type => 'CPANPLUS::Dist::YACSmoke' ); # this is where the magic happens. | |||||||||||||||||||||||||||
| 78 | 10 | $conf->set_conf( cpantest => 'dont_cc' ); # Yes, we want to report test results. But not CC | |||||||||||||||||||||||||||
| 79 | 10 | $conf->set_conf( verbose => 1 ); # set verbosity to true. | |||||||||||||||||||||||||||
| 80 | 10 | $conf->set_conf( allow_unknown_prereqs => 0 ); # don't allow unknown prereqs | |||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 10 | ▶ | unless ( defined $ENV{MAILDOMAIN} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | 10 | ▶ | my $hostpart = ( split /\@/, ( $conf->get_conf( 'email' ) || 'smoker@cpantesters.org' ) )[1]; | ||||||||||||||||||||||||||
|
Condition50%1/2
$conf->get_conf('email') || 'smoker@cpantesters.org'
MC/DC0%0/1
$conf->get_conf('email') || 'smoker@cpantesters.org'
$conf->get_conf('email')
Truth table50%1/2
A
A= $conf->get_conf('email')
| |||||||||||||||||||||||||||||
| 84 | 10 | ▶ | $ENV{MAILDOMAIN} = $hostpart =~ /^(cpan\.org|gmail\.com)$/i ? 'cpantesters.org' : $hostpart; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 10 | ▶ | if ( $^V gt v5.9.5 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | 10 | $conf->set_conf( prefer_makefile => 0 ); # Prefer Build.PL if we have M::B | |||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | else { | ||||||||||||||||||||||||||||
| 91 | 0 | eval "require Module::Build"; | |||||||||||||||||||||||||||
| 92 | 0 | ▶ | $conf->set_conf( prefer_makefile => 0 ) unless $@; # | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 10 | my $cb = CPANPLUS::Backend->new($conf); | |||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 10 | my $exclude_dists; | |||||||||||||||||||||||||||
| 98 | my $exclude_auths; | ||||||||||||||||||||||||||||
| 99 | 10 | my $local_lib; | |||||||||||||||||||||||||||
| 100 | 10 | my $config_file = catfile( $conf->get_conf('base'), CONFIG_FILE ); | |||||||||||||||||||||||||||
| 101 | 10 | ▶ | if ( -r $config_file ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | 3 | my $cfg = CPANPLUS::YACSmoke::IniFiles->new(-file => $config_file); | |||||||||||||||||||||||||||
| 103 | { | ||||||||||||||||||||||||||||
| 104 | 3 | my @list = $cfg->val( 'CONFIG', 'exclude_dists' ); | |||||||||||||||||||||||||||
| 105 | 3 | ▶ | if ( @list ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 106 | 1 | $exclude_dists = CPANPLUS::YACSmoke::ReAssemble->new(); | |||||||||||||||||||||||||||
| 107 | 1 | $exclude_dists->add( @list ); | |||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||
| 110 | { | ||||||||||||||||||||||||||||
| 111 | 3 | my @list = $cfg->val( 'CONFIG', 'exclude_auths' ); | |||||||||||||||||||||||||||
| 112 | 3 | ▶ | if ( @list ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | 2 | $exclude_auths = CPANPLUS::YACSmoke::ReAssemble->new(); | |||||||||||||||||||||||||||
| 114 | 2 | $exclude_auths->add( @list ); | |||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | 3 | $local_lib = $cfg->val( 'CONFIG', 'local::lib' ); | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 10 | my $self = bless { @_ }, $package; | |||||||||||||||||||||||||||
| 121 | 10 | $self->{conf} = $conf; | |||||||||||||||||||||||||||
| 122 | 10 | $self->{cpanplus} = $cb; | |||||||||||||||||||||||||||
| 123 | 10 | $self->{exclude_dists} = $exclude_dists; | |||||||||||||||||||||||||||
| 124 | 10 | $self->{exclude_auths} = $exclude_auths; | |||||||||||||||||||||||||||
| 125 | 10 | $self->{allow_retries} = 'aborted|ungraded'; | |||||||||||||||||||||||||||
| 126 | 10 | $self->{local_lib} = $local_lib; | |||||||||||||||||||||||||||
| 127 | 10 | return $self; | |||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | sub test { | ||||||||||||||||||||||||||||
| 131 | 5 | ▶ | my $self; | ||||||||||||||||||||||||||
|
Subroutine
test: called CC=16 SCAR=34.9
Pod
documented
| |||||||||||||||||||||||||||||
| 132 | 5 | eval { | |||||||||||||||||||||||||||
| 133 | 5 | ▶ | if ( (ref $_[0]) && $_[0]->isa(__PACKAGE__) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $_[0] and $_[0]->isa(__PACKAGE__)
MC/DC0%0/2
ref $_[0] and $_[0]->isa(__PACKAGE__)
ref $_[0]
$_[0]->isa(__PACKAGE__)
Truth table33%1/3
A and B
A= ref $_[0]B= $_[0]->isa(__PACKAGE__)
| |||||||||||||||||||||||||||||
| 134 | 5 | $self = shift; | |||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | }; | ||||||||||||||||||||||||||||
| 137 | 5 | ▶ | $self ||= __PACKAGE__->new(); | ||||||||||||||||||||||||||
|
Condition33%1/3
$self ||= __PACKAGE__->new
MC/DC0%0/2
$self ||= __PACKAGE__->new
$self
__PACKAGE__->new
Truth table33%1/3
A ||= B
A= $selfB= __PACKAGE__->new
| |||||||||||||||||||||||||||||
| 138 | 5 | $self->_connect_db(); | |||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | 5 | my @dists = @_; | |||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 5 | ▶ | unless ( @dists ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | 0 | @dists = $self->_download_list(); | |||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | 5 | my @mods; | |||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 5 | foreach my $dist ( @dists ) { | |||||||||||||||||||||||||||
| 149 | 5 | my $mod = $self->{cpanplus}->parse_module( module => $dist ); | |||||||||||||||||||||||||||
| 150 | 5 | ▶ | next unless $mod; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 151 | 5 | my $package = $mod->package_name .'-'. $mod->package_version; | |||||||||||||||||||||||||||
| 152 | 5 | ▶ | my $grade = $self->{checked}->{$package} || 'ungraded'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'checked'}{$package} || 'ungraded'
MC/DC0%0/1
$self->{'checked'}{$package} || 'ungraded'
$self->{'checked'}{$package}
Truth table50%1/2
A
A= $self->{'checked'}{$package}
| |||||||||||||||||||||||||||||
| 153 | 5 | ▶ | next if $self->_is_excluded_dist($package); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 154 | 5 | ▶ | next if $mod->is_bundle; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 155 | 5 | ▶ | next unless $grade =~ /$self->{allow_retries}/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 156 | 5 | push @mods, $mod; | |||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | 5 | $self->_disconnect_db(); | |||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | 5 | my $target = 'create'; | |||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 5 | ▶ | if ( $self->{local_lib} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 164 | 0 | $self->_setup_local_lib(); | |||||||||||||||||||||||||||
| 165 | 0 | $self->{conf}->_perl5lib( $ENV{PERL5LIB} ); | |||||||||||||||||||||||||||
| 166 | 0 | $self->{conf}->set_conf( makeflags => '' ); | |||||||||||||||||||||||||||
| 167 | 0 | $self->{conf}->set_conf( buildflags => '' ); | |||||||||||||||||||||||||||
| 168 | 0 | $target = 'install'; | |||||||||||||||||||||||||||
| 169 | 0 | msg("Setup local::lib environment in '$ENV{PERL_LOCAL_LIB_ROOT}'"); | |||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 5 | foreach my $mod ( @mods ) { | |||||||||||||||||||||||||||
| 173 | 5 | eval { | |||||||||||||||||||||||||||
| 174 | 5 | CPANPLUS::Error->flush(); | |||||||||||||||||||||||||||
| 175 | my $stat = $self->{cpanplus}->install( | ||||||||||||||||||||||||||||
| 176 | 5 | modules => [ $mod ], | |||||||||||||||||||||||||||
| 177 | target => $target, | ||||||||||||||||||||||||||||
| 178 | allow_build_interactively => 0, | ||||||||||||||||||||||||||||
| 179 | # other settings now set via set_config() method | ||||||||||||||||||||||||||||
| 180 | ); | ||||||||||||||||||||||||||||
| 181 | }; | ||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 5 | ▶ | if ( $self->{local_lib} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 185 | 0 | my $build_dir = $self->_get_build_dir(); | |||||||||||||||||||||||||||
| 186 | 0 | msg("Flushing '$build_dir'"); | |||||||||||||||||||||||||||
| 187 | 0 | ▶ | rmtree($build_dir) if -e $build_dir; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 188 | 0 | msg("Flushed '$build_dir'"); | |||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | 5 | ▶ | $self->{cpanplus}->save_state() if !$self->{local_lib}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | 5 | return 1; | |||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | sub mark { | ||||||||||||||||||||||||||||
| 197 | 14 | ▶ | my $self; | ||||||||||||||||||||||||||
|
Subroutine
mark: called CC=16 SCAR=30.1
Pod
documented
| |||||||||||||||||||||||||||||
| 198 | 14 | eval { | |||||||||||||||||||||||||||
| 199 | 14 | ▶ | if ( (ref $_[0]) && $_[0]->isa(__PACKAGE__) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $_[0] and $_[0]->isa(__PACKAGE__)
MC/DC0%0/2
ref $_[0] and $_[0]->isa(__PACKAGE__)
ref $_[0]
$_[0]->isa(__PACKAGE__)
Truth table33%1/3
A and B
A= ref $_[0]B= $_[0]->isa(__PACKAGE__)
| |||||||||||||||||||||||||||||
| 200 | 14 | $self = shift; | |||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||
| 202 | }; | ||||||||||||||||||||||||||||
| 203 | 14 | ▶ | $self ||= __PACKAGE__->new(); | ||||||||||||||||||||||||||
|
Condition33%1/3
$self ||= __PACKAGE__->new
MC/DC0%0/2
$self ||= __PACKAGE__->new
$self
__PACKAGE__->new
Truth table33%1/3
A ||= B
A= $selfB= __PACKAGE__->new
| |||||||||||||||||||||||||||||
| 204 | 14 | $self->_connect_db(); | |||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 14 | ▶ | my $distver = shift || ''; | ||||||||||||||||||||||||||
|
Condition50%1/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 207 | 14 | ▶ | my $grade = lc shift || ''; | ||||||||||||||||||||||||||
|
Condition100%2/2
lc shift() || ''
MC/DC100%1/1
lc shift() || ''
lc shift()
Truth table100%2/2
A
A= lc shift()
| |||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | 14 | ▶ | if ($grade) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 210 | 4 | my $mod = $self->{cpanplus}->parse_module( module => $distver ); | |||||||||||||||||||||||||||
| 211 | 4 | ▶ | return error(qq{Invalid distribution "$distver"}) unless $mod; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 4 | ▶ | unless ($grade =~ /(pass|fail|unknown|na|none|ungraded|aborted|ignored)/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 214 | 0 | return error("Invalid grade: '$grade'"); | |||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||
| 216 | 4 | ▶ | if ($grade eq "none") { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 217 | 0 | $grade = undef; | |||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | 4 | $distver = $mod->package_name .'-'. $mod->package_version; | |||||||||||||||||||||||||||
| 221 | 4 | $self->{checked}->{$distver} = $grade; | |||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | else { | ||||||||||||||||||||||||||||
| 224 | 10 | ▶ | my @distros = ($distver ? ($distver) : $self->_download_list()); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 225 | 10 | foreach my $dist ( @distros ) { | |||||||||||||||||||||||||||
| 226 | 10 | my $mod = $self->{cpanplus}->parse_module( module => $dist ); | |||||||||||||||||||||||||||
| 227 | 10 | ▶ | next unless $mod; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 228 | 10 | my $dist_ver = $mod->package_name .'-'. $mod->package_version; | |||||||||||||||||||||||||||
| 229 | 10 | ▶ | next if $self->_is_excluded_dist( $dist_ver ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 230 | 10 | $grade = $self->{checked}->{$dist_ver}; | |||||||||||||||||||||||||||
| 231 | 10 | ▶ | if ( $grade ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 232 | 8 | msg(qq{result for "$dist_ver" is "$grade"}); | |||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||
| 234 | else { | ||||||||||||||||||||||||||||
| 235 | 2 | msg(qq{no result for "$dist_ver"}); | |||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||
| 239 | 14 | $self->_disconnect_db(); | |||||||||||||||||||||||||||
| 240 | 14 | ▶ | return $grade if $distver; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | sub excluded { | ||||||||||||||||||||||||||||
| 244 | 2 | ▶ | my $self; | ||||||||||||||||||||||||||
|
Subroutine
excluded: called CC=9 SCAR=23.9
Pod
documented
| |||||||||||||||||||||||||||||
| 245 | 2 | eval { | |||||||||||||||||||||||||||
| 246 | 2 | ▶ | if ( (ref $_[0]) && $_[0]->isa(__PACKAGE__) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $_[0] and $_[0]->isa(__PACKAGE__)
MC/DC0%0/2
ref $_[0] and $_[0]->isa(__PACKAGE__)
ref $_[0]
$_[0]->isa(__PACKAGE__)
Truth table33%1/3
A and B
A= ref $_[0]B= $_[0]->isa(__PACKAGE__)
| |||||||||||||||||||||||||||||
| 247 | 2 | $self = shift; | |||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||
| 249 | }; | ||||||||||||||||||||||||||||
| 250 | 2 | ▶ | $self ||= __PACKAGE__->new(); | ||||||||||||||||||||||||||
|
Condition33%1/3
$self ||= __PACKAGE__->new
MC/DC0%0/2
$self ||= __PACKAGE__->new
$self
__PACKAGE__->new
Truth table33%1/3
A ||= B
A= $selfB= __PACKAGE__->new
| |||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | 2 | my @dists = @_; | |||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | 2 | ▶ | unless ( @dists ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 255 | 0 | @dists = $self->_download_list(); | |||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | 2 | my @mods; | |||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | 2 | foreach my $dist ( @dists ) { | |||||||||||||||||||||||||||
| 261 | 2 | my $mod = $self->{cpanplus}->parse_module( module => $dist ); | |||||||||||||||||||||||||||
| 262 | 2 | ▶ | next unless $mod; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 263 | 2 | my $package = $mod->package_name .'-'. $mod->package_version; | |||||||||||||||||||||||||||
| 264 | 2 | my $auth = $mod->author->cpanid; | |||||||||||||||||||||||||||
| 265 | 2 | ▶ | next unless $self->_is_excluded_dist($package) || $self->_is_excluded_auth($auth); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->_is_excluded_dist($package) or $self->_is_excluded_auth($auth)
MC/DC0%0/2
$self->_is_excluded_dist($package) or $self->_is_excluded_auth($auth)
$self->_is_excluded_dist($package)
$self->_is_excluded_auth($auth)
Truth table33%1/3
A or B
A= $self->_is_excluded_dist($package)B= $self->_is_excluded_auth($auth)
| |||||||||||||||||||||||||||||
| 266 | 2 | msg(qq{EXCLUDED: "$package"}); | |||||||||||||||||||||||||||
| 267 | 2 | push @mods, $package; | |||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | 2 | return @mods; | |||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | sub purge { | ||||||||||||||||||||||||||||
| 274 | 0 | ▶ | my $self; | ||||||||||||||||||||||||||
|
Subroutine
purge: not called CC=17 SCAR=57.2
Pod
documented
| |||||||||||||||||||||||||||||
| 275 | 0 | eval { | |||||||||||||||||||||||||||
| 276 | 0 | ▶ | if ( (ref $_[0]) && $_[0]->isa(__PACKAGE__) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $_[0] and $_[0]->isa(__PACKAGE__)
MC/DC0%0/2
ref $_[0] and $_[0]->isa(__PACKAGE__)
ref $_[0]
$_[0]->isa(__PACKAGE__)
Truth table0%0/3
A and B
A= ref $_[0]B= $_[0]->isa(__PACKAGE__)
| |||||||||||||||||||||||||||||
| 277 | 0 | $self = shift; | |||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||
| 279 | }; | ||||||||||||||||||||||||||||
| 280 | 0 | ▶ | $self ||= __PACKAGE__->new(); | ||||||||||||||||||||||||||
|
Condition0%0/3
$self ||= __PACKAGE__->new
MC/DC0%0/2
$self ||= __PACKAGE__->new
$self
__PACKAGE__->new
Truth table0%0/3
A ||= B
A= $selfB= __PACKAGE__->new
| |||||||||||||||||||||||||||||
| 281 | 0 | ▶ | my %config = ref($_[0]) eq 'HASH' ? %{ shift() } : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 282 | 0 | $self->_connect_db(); | |||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | 0 | ▶ | my $flush = $config{flush_flag} || 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
$config{'flush_flag'} || 0
MC/DC0%0/1
$config{'flush_flag'} || 0
$config{'flush_flag'}
Truth table0%0/2
A
A= $config{'flush_flag'}
| |||||||||||||||||||||||||||||
| 285 | 0 | my %distvars; | |||||||||||||||||||||||||||
| 286 | 0 | my $override = 0; | |||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | 0 | ▶ | if(@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 289 | 0 | $override = 1; | |||||||||||||||||||||||||||
| 290 | 0 | for(@_) { | |||||||||||||||||||||||||||
| 291 | 0 | ▶ | next unless(/^(.*)\-(.+)$/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 292 | 0 | push @{$distvars{$1}}, $2; | |||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||
| 295 | else { | ||||||||||||||||||||||||||||
| 296 | 0 | for(keys %{$self->{checked}}) { | |||||||||||||||||||||||||||
| 297 | 0 | ▶ | next unless(/^(.*)\-(.+)$/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 298 | 0 | push @{$distvars{$1}}, $2; | |||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | 0 | foreach my $dist (sort keys %distvars) { | |||||||||||||||||||||||||||
| 303 | 0 | my $passed = $override; | |||||||||||||||||||||||||||
| 304 | 0 | my @vers = sort { versioncmp($a, $b) } @{$distvars{$dist}}; | |||||||||||||||||||||||||||
| 305 | 0 | ▶ | while(@vers) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 306 | 0 | my $vers = pop @vers; # the latest | |||||||||||||||||||||||||||
| 307 | 0 | ▶ | if($passed) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 308 | msg("'$dist-$vers' ['". | ||||||||||||||||||||||||||||
| 309 | 0 | uc($self->{checked}->{"$dist-$vers"}). | |||||||||||||||||||||||||||
| 310 | "'] has been purged"); | ||||||||||||||||||||||||||||
| 311 | 0 | delete $self->{checked}->{"$dist-$vers"}; | |||||||||||||||||||||||||||
| 312 | 0 | ▶ | if($flush) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 313 | 0 | my $builddir = | |||||||||||||||||||||||||||
| 314 | catfile($self->_get_build_dir(), "$dist-$vers"); | ||||||||||||||||||||||||||||
| 315 | 0 | ▶ | rmtree($builddir) if(-d $builddir); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||
| 318 | elsif($self->{checked}->{"$dist-$vers"} eq 'pass') { | ||||||||||||||||||||||||||||
| 319 | 0 | $passed = 1; | |||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | 0 | $self->_disconnect_db(); | |||||||||||||||||||||||||||
| 325 | 0 | return 1; | |||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | sub flush { | ||||||||||||||||||||||||||||
| 329 | 0 | ▶ | my $self; | ||||||||||||||||||||||||||
|
Subroutine
flush: not called CC=13 SCAR=52.0
Pod
documented
| |||||||||||||||||||||||||||||
| 330 | 0 | eval { | |||||||||||||||||||||||||||
| 331 | 0 | ▶ | if ( (ref $_[0]) && $_[0]->isa(__PACKAGE__) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $_[0] and $_[0]->isa(__PACKAGE__)
MC/DC0%0/2
ref $_[0] and $_[0]->isa(__PACKAGE__)
ref $_[0]
$_[0]->isa(__PACKAGE__)
Truth table0%0/3
A and B
A= ref $_[0]B= $_[0]->isa(__PACKAGE__)
| |||||||||||||||||||||||||||||
| 332 | 0 | $self = shift; | |||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||
| 334 | }; | ||||||||||||||||||||||||||||
| 335 | 0 | ▶ | $self ||= __PACKAGE__->new(); | ||||||||||||||||||||||||||
|
Condition0%0/3
$self ||= __PACKAGE__->new
MC/DC0%0/2
$self ||= __PACKAGE__->new
$self
__PACKAGE__->new
Truth table0%0/3
A ||= B
A= $selfB= __PACKAGE__->new
| |||||||||||||||||||||||||||||
| 336 | 0 | ▶ | my %config = ref($_[0]) eq 'HASH' ? %{ shift() } : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 337 | 0 | $self->_connect_db(); | |||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | 0 | ▶ | my $param = shift || 'all'; | ||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 'all'
MC/DC0%0/1
shift() || 'all'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | 0 | my $build_dir = $self->_get_build_dir(); | |||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | 0 | ▶ | if ( $param eq 'old' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 344 | 0 | my %dists; | |||||||||||||||||||||||||||
| 345 | 0 | opendir(my $DIR, $build_dir); | |||||||||||||||||||||||||||
| 346 | 0 | ▶ | while(my $dir = readdir($DIR)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 347 | 0 | ▶ | next if $dir =~ /^\.+$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 348 | 0 | $dir =~ /(.*)-(.+)/; | |||||||||||||||||||||||||||
| 349 | 0 | $dists{$1}->{$2} = "$dir"; | |||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||
| 351 | 0 | closedir($DIR); | |||||||||||||||||||||||||||
| 352 | 0 | for my $dist (keys %dists) { | |||||||||||||||||||||||||||
| 353 | 0 | for(sort { versioncmp($a, $b) } keys %{$dists{$dist}}) { | |||||||||||||||||||||||||||
| 354 | 0 | rmtree(catfile($build_dir,$dists{$dist}->{$_})); | |||||||||||||||||||||||||||
| 355 | 0 | msg("'$dists{$dist}->{$_}' flushed"); | |||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||
| 359 | else { | ||||||||||||||||||||||||||||
| 360 | 0 | msg("Flushing '$build_dir'"); | |||||||||||||||||||||||||||
| 361 | 0 | ▶ | rmtree($build_dir) if -e $build_dir; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 362 | 0 | msg("Flushed '$build_dir'"); | |||||||||||||||||||||||||||
| 363 | 0 | require File::Glob; | |||||||||||||||||||||||||||
| 364 | 0 | ( my $base = $self->{conf}->get_conf('base') ) =~ s![\\/]$!!; | |||||||||||||||||||||||||||
| 365 | 0 | foreach my $sourcefile ( File::Glob::bsd_glob( $base . q{/sourcefile*} ) ) { | |||||||||||||||||||||||||||
| 366 | 0 | msg("Removing '$sourcefile'"); | |||||||||||||||||||||||||||
| 367 | 0 | rmtree $sourcefile; | |||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | 0 | $self->_disconnect_db(); | |||||||||||||||||||||||||||
| 372 | 0 | return 1; | |||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||
| 375 | sub reindex { | ||||||||||||||||||||||||||||
| 376 | 0 | ▶ | my $self; | ||||||||||||||||||||||||||
|
Subroutine
reindex: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 377 | 0 | eval { | |||||||||||||||||||||||||||
| 378 | 0 | ▶ | if ( (ref $_[0]) && $_[0]->isa(__PACKAGE__) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $_[0] and $_[0]->isa(__PACKAGE__)
MC/DC0%0/2
ref $_[0] and $_[0]->isa(__PACKAGE__)
ref $_[0]
$_[0]->isa(__PACKAGE__)
Truth table0%0/3
A and B
A= ref $_[0]B= $_[0]->isa(__PACKAGE__)
| |||||||||||||||||||||||||||||
| 379 | 0 | $self = shift; | |||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||
| 381 | }; | ||||||||||||||||||||||||||||
| 382 | 0 | ▶ | $self ||= __PACKAGE__->new(); | ||||||||||||||||||||||||||
|
Condition0%0/3
$self ||= __PACKAGE__->new
MC/DC0%0/2
$self ||= __PACKAGE__->new
$self
__PACKAGE__->new
Truth table0%0/3
A ||= B
A= $selfB= __PACKAGE__->new
| |||||||||||||||||||||||||||||
| 383 | 0 | $self->{conf}->set_conf( no_update => 0 ); | |||||||||||||||||||||||||||
| 384 | 0 | $self->{cpanplus}->reload_indices( update_source => 1 ); | |||||||||||||||||||||||||||
| 385 | $self->{conf}->set_conf( no_update => 1 ) | ||||||||||||||||||||||||||||
| 386 | 0 | ▶ | if glob( catfile( $self->{conf}->get_conf('base'), $self->{conf}->_get_source('stored') .'*'. STORABLE_EXT, ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 387 | 0 | return 1; | |||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||
| 390 | sub _is_excluded_dist { | ||||||||||||||||||||||||||||
| 391 | 17 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_is_excluded_dist: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 392 | 17 | ▶ | my $dist = shift || return; | ||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 393 | 17 | ▶ | return unless $self->{exclude_dists}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 394 | 2 | ▶ | return 1 if $dist =~ $self->{exclude_dists}->re(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | sub _is_excluded_auth { | ||||||||||||||||||||||||||||
| 398 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_is_excluded_auth: called CC=4 SCAR=14.9
| |||||||||||||||||||||||||||||
| 399 | 1 | ▶ | my $auth = shift || return; | ||||||||||||||||||||||||||
|
Condition50%1/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||
| 400 | 1 | ▶ | return unless $self->{exclude_auths}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 401 | 1 | ▶ | return 1 if $auth =~ $self->{exclude_auths}->re(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | sub _download_list { | ||||||||||||||||||||||||||||
| 405 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_download_list: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||
| 407 | 0 | my $path = $self->{conf}->get_conf('base'); | |||||||||||||||||||||||||||
| 408 | 0 | my $local = catfile( $path, RECENT_FILE ); | |||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | 0 | my $hosts = $self->{conf}->get_conf('hosts'); | |||||||||||||||||||||||||||
| 411 | 0 | my $h_ind = 0; | |||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | 0 | ▶ | while ($h_ind < @$hosts) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 414 | 0 | my $host = $hosts->[$h_ind]; | |||||||||||||||||||||||||||
| 415 | my $mirror_path = File::Spec::Unix->catfile( | ||||||||||||||||||||||||||||
| 416 | 0 | $host->{'path'}, | |||||||||||||||||||||||||||
| 417 | RECENT_FILE | ||||||||||||||||||||||||||||
| 418 | ); | ||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||
| 420 | my %args = ( | ||||||||||||||||||||||||||||
| 421 | scheme => $host->{scheme}, | ||||||||||||||||||||||||||||
| 422 | host => $host->{host}, | ||||||||||||||||||||||||||||
| 423 | 0 | path => $mirror_path, | |||||||||||||||||||||||||||
| 424 | ); | ||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | 0 | my $remote = $self->{cpanplus}->_host_to_uri( %args ); | |||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||
| 428 | 0 | my $ff = File::Fetch->new( uri => $remote ); | |||||||||||||||||||||||||||
| 429 | 0 | my $status = $ff->fetch( to => $path ); | |||||||||||||||||||||||||||
| 430 | 0 | ▶ | last if $status; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 431 | 0 | $h_ind++; | |||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | 0 | ▶ | return () if(@$hosts == $h_ind); # no host accessible | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | 0 | my @testlist; | |||||||||||||||||||||||||||
| 437 | 0 | ▶ | my $fh = IO::File->new($local) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 438 | or croak("Cannot access local RECENT file [$local]: $!\n"); | ||||||||||||||||||||||||||||
| 439 | 0 | ▶ | while (<$fh>) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 440 | 0 | ▶ | next unless(/^authors/); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 441 | 0 | ▶ | next unless(/\.(?:tar\.(?:bz2|gz|Z)|t(?:gz|bz)|(?<!ppm\.)zip|pm.gz)\n$/i); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 442 | 0 | s!authors/id/!!; | |||||||||||||||||||||||||||
| 443 | 0 | chomp; | |||||||||||||||||||||||||||
| 444 | 0 | push @testlist, $_; | |||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||
| 447 | 0 | return @testlist; | |||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||
| 450 | sub _get_build_dir { | ||||||||||||||||||||||||||||
| 451 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_get_build_dir: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 452 | File::Spec->catdir( | ||||||||||||||||||||||||||||
| 453 | $self->{conf}->get_conf('base'), | ||||||||||||||||||||||||||||
| 454 | $self->{cpanplus}->_perl_version( perl => $^X ), | ||||||||||||||||||||||||||||
| 455 | 0 | $self->{conf}->_get_build('moddir') | |||||||||||||||||||||||||||
| 456 | ); | ||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||
| 459 | sub _setup_local_lib { | ||||||||||||||||||||||||||||
| 460 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
_setup_local_lib: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 461 | 1 | ▶ | return if !$self->{local_lib}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 462 | 1 | require Cwd; | |||||||||||||||||||||||||||
| 463 | 1 | require File::Temp; | |||||||||||||||||||||||||||
| 464 | 1 | require CPANPLUS::YACSmoke::locallib; | |||||||||||||||||||||||||||
| 465 | 1 | my $tmpdir = File::Temp::tempdir( DIR => '.', CLEANUP => 1 ); | |||||||||||||||||||||||||||
| 466 | 1 | my $abs = Cwd::abs_path($tmpdir); | |||||||||||||||||||||||||||
| 467 | 1 | CPANPLUS::YACSmoke::locallib->ensure_dir_structure_for( $abs, { quiet => 1 } ); | |||||||||||||||||||||||||||
| 468 | 1 | CPANPLUS::YACSmoke::locallib->setup_env_hash_for( $abs ); | |||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||
| 473 | 11 | 'Yakkity Yac'; | |||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||
| 475 | __END__ | ||||||||||||||||||||||||||||