line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::Build::Plugin::Extract::Negotiate; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
1245
|
use strict; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
112
|
|
4
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
88
|
|
5
|
4
|
|
|
4
|
|
65
|
use 5.008004; |
|
4
|
|
|
|
|
14
|
|
6
|
4
|
|
|
4
|
|
369
|
use Alien::Build::Plugin; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
25
|
|
7
|
4
|
|
|
4
|
|
813
|
use Alien::Build::Plugin::Extract::ArchiveTar; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
41
|
|
8
|
4
|
|
|
4
|
|
1203
|
use Alien::Build::Plugin::Extract::ArchiveZip; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
26
|
|
9
|
4
|
|
|
4
|
|
834
|
use Alien::Build::Plugin::Extract::CommandLine; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
40
|
|
10
|
4
|
|
|
4
|
|
1306
|
use Alien::Build::Plugin::Extract::Directory; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
26
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: Extraction negotiation plugin |
13
|
|
|
|
|
|
|
our $VERSION = '2.47'; # VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has '+format' => 'tar'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub init |
19
|
|
|
|
|
|
|
{ |
20
|
7
|
|
|
7
|
1
|
13
|
my($self, $meta) = @_; |
21
|
|
|
|
|
|
|
|
22
|
7
|
|
|
|
|
26
|
my $format = $self->format; |
23
|
7
|
50
|
|
|
|
20
|
$format = 'tar.gz' if $format eq 'tgz'; |
24
|
7
|
50
|
|
|
|
16
|
$format = 'tar.bz2' if $format eq 'tbz'; |
25
|
7
|
50
|
|
|
|
15
|
$format = 'tar.xz' if $format eq 'txz'; |
26
|
|
|
|
|
|
|
|
27
|
7
|
|
|
|
|
15
|
my $plugin = $self->pick($format); |
28
|
7
|
|
|
|
|
28
|
$meta->apply_plugin($plugin, format => $format); |
29
|
7
|
|
|
|
|
15
|
$self; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub pick |
34
|
|
|
|
|
|
|
{ |
35
|
19
|
|
|
19
|
1
|
20980
|
my(undef, $format) = @_; |
36
|
|
|
|
|
|
|
|
37
|
19
|
100
|
33
|
|
|
129
|
if($format =~ /^tar(\.(gz|bz2))?$/) |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
38
|
|
|
|
|
|
|
{ |
39
|
12
|
100
|
|
|
|
79
|
if(Alien::Build::Plugin::Extract::ArchiveTar->available($format)) |
40
|
|
|
|
|
|
|
{ |
41
|
11
|
|
|
|
|
442
|
return 'Extract::ArchiveTar'; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
else |
44
|
|
|
|
|
|
|
{ |
45
|
1
|
|
|
|
|
359
|
return 'Extract::CommandLine'; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
elsif($format eq 'zip') |
49
|
|
|
|
|
|
|
{ |
50
|
|
|
|
|
|
|
# Archive::Zip is not that reliable. But if it is already installed it is probably working |
51
|
5
|
100
|
|
|
|
35
|
if(Alien::Build::Plugin::Extract::ArchiveZip->available($format)) |
52
|
|
|
|
|
|
|
{ |
53
|
2
|
|
|
|
|
19
|
return 'Extract::ArchiveZip'; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# If it isn't available, then use the command-line unzip. Alien::unzip will be used |
57
|
|
|
|
|
|
|
# as necessary in environments where it isn't already installed. |
58
|
|
|
|
|
|
|
else |
59
|
|
|
|
|
|
|
{ |
60
|
3
|
|
|
|
|
29
|
return 'Extract::CommandLine'; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
elsif($format eq 'tar.xz' || $format eq 'tar.Z') |
64
|
|
|
|
|
|
|
{ |
65
|
0
|
|
|
|
|
0
|
return 'Extract::CommandLine'; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
elsif($format eq 'd') |
68
|
|
|
|
|
|
|
{ |
69
|
2
|
|
|
|
|
11
|
return 'Extract::Directory'; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
else |
72
|
|
|
|
|
|
|
{ |
73
|
0
|
|
|
|
|
|
die "do not know how to handle format: $format"; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |