| 1 | package Module::Build::Bundle; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use 5.008; #$^V | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Cwd qw(getcwd); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Tie::IxHash; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use English qw( -no_match_vars ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use File::Slurp; #read_file | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use base qw(Module::Build::Base); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use constant EXTENDED_POD_LINK_VERSION => 5.12.0; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | our $VERSION = '0.17'; | |||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | #HACK: we need a writable copy for testing purposes | ||||||||||||||||||||||||||||||||||||||||||
| 19 | ## no critic qw(Variables::ProhibitPackageVars Variables::ProhibitPunctuationVars) | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | our $myPERL_VERSION = $^V; | |||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub ACTION_build { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ACTION_build: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | if ( !$self->{'_completed_actions'}{'contents'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | $self->ACTION_contents(); | |||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | return Module::Build::Base::ACTION_build($self); | |||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 4 | ▶ | sub ACTION_contents { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ACTION_contents: called CC=12 SCAR=25.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | #Fetching requirements from Build.PL | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 4 | my @list = %{ $self->requires() }; | |||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 4 | ▶ | my $section_header = $self->notes('section_header') || 'CONTENTS'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->notes('section_header') || 'CONTENTS'
MC/DC100%1/1
$self->notes('section_header') || 'CONTENTS'
$self->notes('section_header')
Truth table100%2/2
A
A= $self->notes('section_header')
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 4 | my $sorted = 'Tie::IxHash'->new(@list); | |||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | $sorted->SortByKey(); | |||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 4 | my $pod = "=head1 $section_header\n\n=over\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 44 | 4 | foreach ( $sorted->Keys ) { | |||||||||||||||||||||||||||||||||||||||||
| 45 | 7 | my ( $module, $version ) = $sorted->Shift(); | |||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 7 | my $dist = $module; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 7 | $dist =~ s/::/\-/g; | |||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 7 | my $module_path = $module; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 7 | $module_path =~ s[::][/]g; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 7 | $module_path .= '.pm'; | |||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 7 | ▶ | if ( $myPERL_VERSION ge EXTENDED_POD_LINK_VERSION ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 3 | ▶ | if ($version) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 1 | $pod .= "=item * L<$module|$module>, " | |||||||||||||||||||||||||||||||||||||||||
| 57 | . "L<$version|http://search.cpan.org/dist/$dist-$version/lib/$module_path>\n\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 58 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 2 | $pod .= "=item * L<$module|$module>\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 62 | 4 | ▶ | if ($version) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 2 | $pod .= "=item * L<$module|$module>, $version\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 64 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 65 | 2 | $pod .= "=item * L<$module|$module>\n\n"; | |||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 4 | $pod .= "=back\n\n=head1"; | |||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 4 | my $cwd = getcwd(); | |||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | my @path = split /::/, $self->{properties}->{module_name} | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 4 | ▶ | || $self->{properties}->{module_name}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'properties'}{'module_name'} || $self->{'properties'}{'module_name'}
MC/DC0%0/2
$self->{'properties'}{'module_name'} || $self->{'properties'}{'module_name'}
$self->{'properties'}{'module_name'}
$self->{'properties'}{'module_name'}
Truth table33%1/3
A || B
A= $self->{'properties'}{'module_name'}B= $self->{'properties'}{'module_name'}
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | #HACK: induced from test suite | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 4 | ▶ | my $dir = $self->notes('temp_wd') ? $self->notes('temp_wd') : $cwd .'/t/'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | ## no critic qw(ValuesAndExpressions::ProhibitNoisyQuotes) | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 4 | my $file = ( join '/', ( $dir, @path ) ) . '.pm'; | |||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 4 | ▶ | my $contents = read_file($file) or croak "Unable to read file: $file - $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 3 | my $rv = $contents =~ s/=head1\s*$section_header\s*.*=head1/$pod/s; | |||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | 3 | ▶ | if ( !$rv ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | croak "No $section_header section replaced"; | |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 3 | ▶ | open my $fout, '>', $file | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | or croak "Unable to open file: $file - $!"; | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | 3 | print $fout $contents; | |||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 3 | ▶ | close $fout or croak "Unable to close file: $file - $!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 3 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | #Lifted from Module::Build::Base | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 1 | ▶ | sub do_create_metafile { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
do_create_metafile: called CC=8 SCAR=23.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 103 | 1 | ▶ | return if $self->{wrote_metadata}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 1 | my $p = $self->{properties}; | |||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 1 | ▶ | unless ($p->{license}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | $self->log_warn("No license specified, setting license = 'unknown'\n"); | |||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $p->{license} = 'unknown'; | |||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 1 | my @metafiles = ( $self->metafile, $self->metafile2 ); | |||||||||||||||||||||||||||||||||||||||||
| 112 | # If we're in the distdir, the metafile may exist and be non-writable. | ||||||||||||||||||||||||||||||||||||||||||
| 113 | 1 | $self->delete_filetree($_) for @metafiles; | |||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | # Since we're building ourself, we have to do some special stuff | ||||||||||||||||||||||||||||||||||||||||||
| 116 | # here: the ConfigData module is found in blib/lib. | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 1 | local @INC = @INC; | |||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | ▶ | if (($self->module_name || '') eq 'Module::Build') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$self->module_name || ''
MC/DC0%0/1
$self->module_name || ''
$self->module_name
Truth table50%1/2
A
A= $self->module_name
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $self->depends_on('config_data'); | |||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | push @INC, File::Spec->catdir($self->blib, 'lib'); | |||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 1 | my $meta_obj = $self->_get_meta_object( | |||||||||||||||||||||||||||||||||||||||||
| 124 | quiet => 0, fatal => 1, auto => 1 | ||||||||||||||||||||||||||||||||||||||||||
| 125 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | #JONASBN: Changed file parameter | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 1 | my @created = $self->_write_meta_files( $meta_obj, $self->metafile ); | |||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 1 | ▶ | if ( @created ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 1 | $self->{wrote_metadata} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 1 | $self->_add_to_manifest('MANIFEST', $_) for @created; | |||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | #lifted from Module::Build::Base, sets generated_by | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 1 | ▶ | sub get_metadata { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_metadata: called CC=19 SCAR=36.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 1 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 1 | ▶ | my $fatal = $args{fatal} || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'fatal'} || 0
MC/DC0%0/1
$args{'fatal'} || 0
$args{'fatal'}
Truth table50%1/2
A
A= $args{'fatal'}
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 1 | my $p = $self->{properties}; | |||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 1 | ▶ | $self->auto_config_requires if $args{auto}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | # validate required fields | ||||||||||||||||||||||||||||||||||||||||||
| 147 | 1 | foreach my $f (qw(dist_name dist_version dist_author dist_abstract license)) { | |||||||||||||||||||||||||||||||||||||||||
| 148 | 5 | my $field = $self->$f(); | |||||||||||||||||||||||||||||||||||||||||
| 149 | 5 | ▶ | unless ( defined $field and length $field ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $field and length $field
MC/DC0%0/2
defined $field and length $field
defined $field
length $field
Truth table33%1/3
A and B
A= defined $fieldB= length $field
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | my $err = "ERROR: Missing required field '$f' for metafile\n"; | |||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | if ( $fatal ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | die $err; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | $self->log_warn($err); | |||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | my %metadata = ( | ||||||||||||||||||||||||||||||||||||||||||
| 161 | name => $self->dist_name, | ||||||||||||||||||||||||||||||||||||||||||
| 162 | version => $self->normalize_version($self->dist_version), | ||||||||||||||||||||||||||||||||||||||||||
| 163 | author => $self->dist_author, | ||||||||||||||||||||||||||||||||||||||||||
| 164 | abstract => $self->dist_abstract, | ||||||||||||||||||||||||||||||||||||||||||
| 165 | #JONASBN changed the generated_by | ||||||||||||||||||||||||||||||||||||||||||
| 166 | generated_by => "Module::Build::Bundle version $Module::Build::Bundle::VERSION", | ||||||||||||||||||||||||||||||||||||||||||
| 167 | 'meta-spec' => { | ||||||||||||||||||||||||||||||||||||||||||
| 168 | version => '2', | ||||||||||||||||||||||||||||||||||||||||||
| 169 | url => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec', | ||||||||||||||||||||||||||||||||||||||||||
| 170 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 171 | 1 | ▶ | dynamic_config => exists $p->{dynamic_config} ? $p->{dynamic_config} : 1, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | release_status => $self->release_status, | ||||||||||||||||||||||||||||||||||||||||||
| 173 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | 1 | my ($meta_license, $meta_license_url) = $self->_get_license; | |||||||||||||||||||||||||||||||||||||||||
| 176 | 1 | $metadata{license} = [ $meta_license ]; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 1 | ▶ | $metadata{resources}{license} = [ $meta_license_url ] if defined $meta_license_url; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | 1 | $metadata{prereqs} = $self->_normalize_prereqs; | |||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | 1 | ▶ | if (exists $p->{no_index}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | $metadata{no_index} = $p->{no_index}; | |||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | } elsif (my $pkgs = eval { $self->find_dist_packages }) { | |||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | ▶ | $metadata{provides} = $pkgs if %$pkgs; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $self->log_warn("$@\nWARNING: Possible missing or corrupt 'MANIFEST' file.\n" . | |||||||||||||||||||||||||||||||||||||||||
| 187 | "Nothing to enter for 'provides' field in metafile.\n"); | ||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | 1 | ▶ | if (my $add = $self->meta_add) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 1 | ▶ | if (not exists $add->{'meta-spec'} or $add->{'meta-spec'}{version} != 2) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not exists $add->{"meta-spec"} or $add->{"meta-spec"}{"version"} != 2
MC/DC0%0/2
not exists $add->{"meta-spec"} or $add->{"meta-spec"}{"version"} != 2
not exists $add->{"meta-spec"}
$add->{"meta-spec"}{"version"} != 2
Truth table33%1/3
not(A) or B
A= not exists $add->{"meta-spec"}B= $add->{"meta-spec"}{"version"} != 2
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 1 | require CPAN::Meta::Converter; | |||||||||||||||||||||||||||||||||||||||||
| 193 | 1 | ▶ | if (CPAN::Meta::Converter->VERSION('2.141170')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 1 | $add = CPAN::Meta::Converter->new($add)->upgrade_fragment; | |||||||||||||||||||||||||||||||||||||||||
| 195 | 1 | delete $add->{prereqs}; # XXX this would now overwrite all prereqs | |||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | $self->log_warn("Can't meta_add without CPAN::Meta 2.141170"); | |||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | 1 | ▶ | while (my($k, $v) = each %{$add}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | 1 | $metadata{$k} = $v; | |||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 1 | ▶ | if (my $merge = $self->meta_merge) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 1 | ▶ | if (eval { require CPAN::Meta::Merge }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 1 | %metadata = %{ CPAN::Meta::Merge->new(default_version => '1.4')->merge(\%metadata, $merge) }; | |||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||
| 211 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | $self->log_warn("Can't merge without CPAN::Meta::Merge"); | |||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | 1 | return \%metadata; | |||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | #lifted from Module::Build::Base, added package and version resolution and | ||||||||||||||||||||||||||||||||||||||||||
| 220 | # addition to configure requires | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | sub prepare_metadata { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepare_metadata: not called CC=21 SCAR=61.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | my ($self, $node, $keys) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my $p = $self->{properties}; | |||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | #JONASBN: Added package resolution | ||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | my $package = ref $self; | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | my $version = $package::VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | # A little helper sub | ||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | my $add_node = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | my ($name, $val) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | $node->{$name} = $val; | |||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | push @$keys, $name if $keys; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | foreach (qw(dist_name dist_version dist_author dist_abstract license)) { | |||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | (my $name = $_) =~ s/^dist_//; | |||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | $add_node->($name, $self->$_()); | |||||||||||||||||||||||||||||||||||||||||
| 239 | die "ERROR: Missing required field '$_' for META.yml\n" | ||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | unless defined($node->{$name}) && length($node->{$name}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $node->{$name} and length $node->{$name}
MC/DC0%0/2
defined $node->{$name} and length $node->{$name}
defined $node->{$name}
length $node->{$name}
Truth table0%0/3
A and B
A= defined $node->{$name}B= length $node->{$name}
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $node->{version} = $self->normalize_version($node->{version}); | |||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | if (defined( my $l = $self->license )) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | die "Unknown license string '$l'" | ||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | unless exists $self->valid_licenses->{ $l }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | if (my $key = $self->valid_licenses->{ $l }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | my $class = "Software::License::$key"; | |||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | if (eval "use $class; 1") { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | # S::L requires a 'holder' key | ||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | $node->{resources}{license} = $class->new({holder=>"nobody"})->url; | |||||||||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||||||||||
| 254 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | $node->{resources}{license} = $self->_license_url($l); | |||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||
| 258 | # XXX we are silently omitting the url for any unknown license | ||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | # copy prereq data structures so we can modify them before writing to META | ||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | my %prereq_types; | |||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | for my $type ( 'configure_requires', @{$self->prereq_action_types} ) { | |||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | if (exists $p->{$type}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | for my $mod ( keys %{ $p->{$type} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 266 | $prereq_types{$type}{$mod} = | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | $self->normalize_version($p->{$type}{$mod}); | |||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | # add current Module::Build to configure_requires if there | ||||||||||||||||||||||||||||||||||||||||||
| 273 | # isn't one already specified (but not ourself, so we're not circular) | ||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | if ( $self->dist_name ne 'Module-Build' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->dist_name ne "Module-Build" and $self->auto_configure_requires and not exists $prereq_types{"configure_requires"}{"Module::Build"}
$self->dist_name ne "Module-Build" and $self->auto_configure_requires
MC/DC0%0/3
$self->dist_name ne "Module-Build" and $self->auto_configure_requires and not exists $prereq_types{"configure_requires"}{"Module::Build"}
$self->dist_name ne "Module-Build"
$self->auto_configure_requires
not exists $prereq_types{"configure_requires"}{"Module::Build"}
Truth table0%0/4
A and B and not(C)
A= $self->dist_name ne "Module-Build"B= $self->auto_configure_requiresC= not exists $prereq_types{"configure_requires"}{"Module::Build"}
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | && $self->auto_configure_requires | ||||||||||||||||||||||||||||||||||||||||||
| 276 | && ! exists $prereq_types{'configure_requires'}{'Module::Build'} | ||||||||||||||||||||||||||||||||||||||||||
| 277 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | $prereq_types{configure_requires}{'Module::Build'} = $VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 279 | #JONASBN added configure requires | ||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | $prereq_types{configure_requires}{$package} = $version; | |||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | for my $t ( keys %prereq_types ) { | |||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | $add_node->($t, $prereq_types{$t}); | |||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | if (exists $p->{dynamic_config}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | $add_node->('dynamic_config', $p->{dynamic_config}); | |||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | my $pkgs = eval { $self->find_dist_packages }; | |||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | $self->log_warn("$@\nWARNING: Possible missing or corrupt 'MANIFEST' file.\n" . | |||||||||||||||||||||||||||||||||||||||||
| 293 | "Nothing to enter for 'provides' field in META.yml\n"); | ||||||||||||||||||||||||||||||||||||||||||
| 294 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | ▶ | $node->{provides} = $pkgs if %$pkgs; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | ; | ||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | if (exists $p->{no_index}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | $add_node->('no_index', $p->{no_index}); | |||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | $add_node->('generated_by', "$package version $version"); | |||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | $add_node->('meta-spec', | |||||||||||||||||||||||||||||||||||||||||
| 305 | {version => '1.4', | ||||||||||||||||||||||||||||||||||||||||||
| 306 | url => 'http://module-build.sourceforge.net/META-spec-v1.4.html', | ||||||||||||||||||||||||||||||||||||||||||
| 307 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | while (my($k, $v) = each %{$self->meta_add}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | $add_node->($k, $v); | |||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | while (my($k, $v) = each %{$self->meta_merge}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | $self->_hash_merge($node, $k, $v); | |||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | return $node; | |||||||||||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | sub is_windowsish { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_windowsish: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | __END__ | ||||||||||||||||||||||||||||||||||||||||||