| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Alien::Base::ModuleBuild::Repository; |
|
2
|
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
192575
|
use strict; |
|
|
5
|
|
|
|
|
16
|
|
|
|
5
|
|
|
|
|
129
|
|
|
4
|
5
|
|
|
5
|
|
23
|
use warnings; |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
108
|
|
|
5
|
5
|
|
|
5
|
|
22
|
use Carp; |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
268
|
|
|
6
|
5
|
|
|
5
|
|
1896
|
use Alien::Base::ModuleBuild::File; |
|
|
5
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
153
|
|
|
7
|
5
|
|
|
5
|
|
1468
|
use Alien::Base::ModuleBuild::Utils qw/pattern_has_capture_groups/; |
|
|
5
|
|
|
|
|
21
|
|
|
|
5
|
|
|
|
|
3683
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Private class |
|
10
|
|
|
|
|
|
|
our $VERSION = '1.17'; # VERSION |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
|
13
|
50
|
|
|
50
|
0
|
81742
|
my $class = shift; |
|
14
|
50
|
100
|
|
|
|
237
|
my (%self) = ref $_[0] ? %{ shift() } : @_; |
|
|
32
|
|
|
|
|
249
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
50
|
|
|
|
|
150
|
my $obj = bless \%self, $class; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$obj->{c_compiler_required} = 1 |
|
19
|
50
|
100
|
|
|
|
248
|
unless defined $obj->{c_compiler_required}; |
|
20
|
|
|
|
|
|
|
|
|
21
|
50
|
|
|
|
|
112
|
my $location = $obj->{location}; |
|
22
|
50
|
100
|
|
|
|
142
|
$location = '' unless defined $location; |
|
23
|
|
|
|
|
|
|
|
|
24
|
50
|
100
|
100
|
|
|
233
|
if(defined $obj->{exact_filename} && $location !~ m{/$}) { |
|
25
|
15
|
|
|
|
|
49
|
$obj->{location} = $location . '/' |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
50
|
|
|
|
|
275
|
return $obj; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
8
|
|
|
8
|
0
|
23
|
sub protocol { return shift->{protocol} } |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub host { |
|
34
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
|
35
|
1
|
50
|
|
|
|
6
|
$self->{host} = shift if @_; |
|
36
|
1
|
|
|
|
|
3
|
return $self->{host}; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub location { |
|
40
|
27
|
|
|
27
|
0
|
120
|
my $self = shift; |
|
41
|
27
|
100
|
|
|
|
78
|
$self->{location} = shift if @_; |
|
42
|
27
|
|
|
|
|
122
|
return $self->{location}; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub is_network_fetch { |
|
46
|
0
|
|
|
0
|
0
|
0
|
die "must override in the subclass"; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub is_secure_fetch { |
|
50
|
0
|
|
|
0
|
0
|
0
|
die "must override in the subclass"; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub has_digest |
|
54
|
|
|
|
|
|
|
{ |
|
55
|
13
|
|
|
13
|
0
|
62
|
my($self) = @_; |
|
56
|
13
|
50
|
100
|
|
|
98
|
defined $self->{exact_filename} && $self->{exact_version} && (defined $self->{sha1} || defined $self->{sha256}); |
|
|
|
|
66
|
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub probe { |
|
60
|
26
|
|
|
26
|
0
|
351
|
my $self = shift; |
|
61
|
|
|
|
|
|
|
|
|
62
|
26
|
|
|
|
|
814
|
require Alien::Base::ModuleBuild; |
|
63
|
26
|
100
|
66
|
|
|
192
|
if(!Alien::Base::ModuleBuild->alien_install_network && $self->is_network_fetch) { |
|
64
|
1
|
|
|
|
|
22
|
die "network fetch is disabled via ALIEN_INSTALL_NETWORK"; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
25
|
|
|
|
|
109
|
my $rule = Alien::Base::ModuleBuild->alien_download_rule; |
|
68
|
25
|
100
|
|
|
|
128
|
if($rule eq 'warn') { |
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
|
70
|
10
|
100
|
100
|
|
|
48
|
unless($self->is_secure_fetch || $self->has_digest) { |
|
71
|
1
|
|
|
|
|
17
|
warn "!!! NOTICE OF FUTURE CHANGE IN BEHAVIOR !!!\n"; |
|
72
|
1
|
|
|
|
|
24
|
warn "A future version of Alien::Base::ModuleBuild will die here by default with this exception: File fetch is insecure and has no digest. Required by ALIEN_DOWNLOAD_RULE=digest_or_encrypt."; |
|
73
|
1
|
|
|
|
|
12
|
warn "!!! NOTICE OF FUTURE CHANGE IN BEHAVIOR !!!\n"; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
} elsif($rule eq 'digest') { |
|
77
|
|
|
|
|
|
|
|
|
78
|
2
|
100
|
|
|
|
6
|
unless($self->has_digest) { |
|
79
|
1
|
|
|
|
|
16
|
die "File fetch has no digest. Required by ALIEN_DOWNLOAD_RULE=digest."; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
} elsif($rule eq 'encrypt') { |
|
83
|
|
|
|
|
|
|
|
|
84
|
2
|
100
|
|
|
|
10
|
unless($self->is_secure_fetch) { |
|
85
|
1
|
|
|
|
|
37
|
die "File fetch is insecure. Secure fetch required by ALIEN_DOWNLOAD_RULE=encrypt."; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
} elsif($rule eq 'digest_or_encrypt') { |
|
89
|
|
|
|
|
|
|
|
|
90
|
7
|
100
|
100
|
|
|
33
|
unless($self->is_secure_fetch || $self->has_digest) { |
|
91
|
1
|
|
|
|
|
18
|
die "File fetch is insecure and has no digest. Required by ALIEN_DOWNLOAD_RULE=digest_or_encrypt."; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} elsif($rule eq 'digest_and_encrypt') { |
|
95
|
|
|
|
|
|
|
|
|
96
|
4
|
100
|
100
|
|
|
11
|
unless($self->is_secure_fetch && $self->has_digest) { |
|
97
|
3
|
|
|
|
|
35
|
die "File fetch is insecure and has no digest. Both are required by ALIEN_DOWNLOAD_RULE=digest_and_encrypt."; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
} else { |
|
101
|
0
|
|
|
|
|
0
|
die 'internal error'; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
19
|
|
|
|
|
108
|
my $pattern = $self->{pattern}; |
|
105
|
|
|
|
|
|
|
|
|
106
|
19
|
|
|
|
|
39
|
my @files; |
|
107
|
|
|
|
|
|
|
|
|
108
|
19
|
100
|
|
|
|
54
|
if ($self->{exact_filename}) { |
|
109
|
|
|
|
|
|
|
# if filename provided, use that specific file |
|
110
|
7
|
|
|
|
|
21
|
@files = ($self->{exact_filename}); |
|
111
|
|
|
|
|
|
|
} else { |
|
112
|
12
|
|
|
|
|
46
|
@files = $self->list_files; |
|
113
|
|
|
|
|
|
|
|
|
114
|
12
|
100
|
|
|
|
332
|
if ($pattern) { |
|
115
|
2
|
|
|
|
|
8
|
@files = grep { $_ =~ $pattern } @files; |
|
|
110
|
|
|
|
|
250
|
|
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
12
|
50
|
|
|
|
41
|
carp "Could not find any matching files" unless @files; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
19
|
|
|
|
|
46
|
@files = map { +{ |
|
122
|
|
|
|
|
|
|
repository => $self, |
|
123
|
|
|
|
|
|
|
platform => $self->{platform}, |
|
124
|
429
|
|
|
|
|
1055
|
filename => $_, |
|
125
|
|
|
|
|
|
|
} } @files; |
|
126
|
|
|
|
|
|
|
|
|
127
|
19
|
100
|
100
|
|
|
143
|
if ($self->{exact_filename} and $self->{exact_version}) { |
|
|
|
100
|
100
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# if filename and version provided, use a specific version |
|
129
|
6
|
|
|
|
|
17
|
$files[0]->{version} = $self->{exact_version}; |
|
130
|
6
|
50
|
|
|
|
23
|
$files[0]->{sha1} = $self->{sha1} if defined $self->{sha1}; |
|
131
|
6
|
100
|
|
|
|
21
|
$files[0]->{sha256} = $self->{sha256} if defined $self->{sha256}; |
|
132
|
|
|
|
|
|
|
} elsif ($pattern and pattern_has_capture_groups($pattern)) { |
|
133
|
1
|
|
|
|
|
5
|
foreach my $file (@files) { |
|
134
|
|
|
|
|
|
|
$file->{version} = $1 |
|
135
|
17
|
50
|
|
|
|
71
|
if $file->{filename} =~ $pattern; |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
@files = |
|
140
|
19
|
|
|
|
|
102
|
map { Alien::Base::ModuleBuild::File->new($_) } |
|
|
429
|
|
|
|
|
766
|
|
|
141
|
|
|
|
|
|
|
@files; |
|
142
|
|
|
|
|
|
|
|
|
143
|
19
|
|
|
|
|
160
|
return @files; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
# subclasses are expected to provide |
|
147
|
0
|
|
|
0
|
0
|
|
sub connection { croak "$_[0] doesn't provide 'connection' method" } |
|
148
|
0
|
|
|
0
|
0
|
|
sub list_files { croak "$_[0] doesn't provide 'list_files' method" } |
|
149
|
|
|
|
|
|
|
# get_file must return filename actually used |
|
150
|
0
|
|
|
0
|
0
|
|
sub get_file { croak "$_[0] doesn't provide 'get_files' method" } |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
1; |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
__END__ |