line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
1580
|
use v5.14.0; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
109
|
|
2
|
3
|
|
|
3
|
|
12
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
101
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package OS::Package::Artifact::Role::Extract; |
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
1698
|
use Archive::Extract; |
|
3
|
|
|
|
|
241274
|
|
|
3
|
|
|
|
|
127
|
|
7
|
3
|
|
|
3
|
|
1649
|
use File::Copy; |
|
3
|
|
|
|
|
5564
|
|
|
3
|
|
|
|
|
199
|
|
8
|
3
|
|
|
3
|
|
21
|
use File::Path qw( make_path remove_tree ); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
148
|
|
9
|
3
|
|
|
3
|
|
14
|
use Path::Tiny; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
123
|
|
10
|
3
|
|
|
3
|
|
431
|
use OS::Package::Config; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
383
|
|
11
|
3
|
|
|
3
|
|
18
|
use OS::Package::Log; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
206
|
|
12
|
3
|
|
|
3
|
|
14
|
use Role::Tiny; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
26
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# ABSTRACT: Provides the extract method for Artifact role. |
15
|
|
|
|
|
|
|
our $VERSION = '0.2.7'; # VERSION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
local $Archive::Extract::PREFER_BIN = 1; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub extract { |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
if ( ! path($self->workdir)->exists ) { |
24
|
0
|
|
|
|
|
|
path($self->workdir)->mkpath; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my $archive; |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
if ( ! defined $self->distfile ) { |
30
|
0
|
|
|
|
|
|
return 1; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
if ( $self->distfile =~ /\.(tar|tgz|gz|Z|zip|bz2|tbz|lzma|xz|tx)$/ ) { |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
$archive = Archive::Extract->new( archive => $self->savefile ); |
36
|
0
|
|
|
|
|
|
$LOGGER->info( sprintf 'extracting archive: %s', $self->distfile ); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
$archive->extract( to => $self->workdir ); |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
$self->archive($archive); |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
$LOGGER->info( sprintf 'extracted archive: %s', |
43
|
|
|
|
|
|
|
$self->archive->extract_path ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
else { |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
$LOGGER->info( sprintf 'staging distfile to workdir: %s', |
48
|
|
|
|
|
|
|
$self->distfile ); |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
copy( $self->savefile, |
51
|
|
|
|
|
|
|
sprintf( '%s/%s', $self->workdir, $self->distfile ) ); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
return 1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |