line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
4
|
|
|
4
|
|
2156
|
use v5.14.0; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
167
|
|
2
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
190
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package OS::Package::Role::Prune; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Provides prune method for OS::Package object. |
7
|
|
|
|
|
|
|
our $VERSION = '0.2.7'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
18
|
use OS::Package::Log; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
399
|
|
10
|
4
|
|
|
4
|
|
23
|
use Path::Tiny; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
152
|
|
11
|
4
|
|
|
4
|
|
21
|
use Try::Tiny; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
159
|
|
12
|
4
|
|
|
4
|
|
16
|
use Role::Tiny; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
27
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub prune { |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
17
|
|
|
|
|
|
|
|
18
|
0
|
0
|
|
|
|
|
if ( !defined $self->fakeroot ) { |
19
|
0
|
|
|
|
|
|
$LOGGER->warn('fakeroot is not defined'); |
20
|
0
|
|
|
|
|
|
return; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
if ( !-d $self->fakeroot ) { |
24
|
0
|
|
|
|
|
|
$LOGGER->warn('fakeroot does not exist'); |
25
|
0
|
|
|
|
|
|
return 1; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
if ( defined $self->prune_files ) { |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
$LOGGER->info( sprintf 'prune files: %s', $self->name ); |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
foreach my $file ( @{ $self->prune_files } ) { |
|
0
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $pfile = |
35
|
|
|
|
|
|
|
sprintf( '%s/%s/%s', $self->fakeroot, $self->prefix, $file ); |
36
|
0
|
|
|
|
|
|
$LOGGER->debug( sprintf 'removing file: %s', $pfile ); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
unlink path($pfile)->stringify; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
if ( defined $self->prune_dirs ) { |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
$LOGGER->info( sprintf 'prune directories: %s', $self->name ); |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
foreach my $dir ( @{ $self->prune_dirs } ) { |
|
0
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $pdir = |
49
|
|
|
|
|
|
|
sprintf( '%s/%s/%s', $self->fakeroot, $self->prefix, $dir ); |
50
|
0
|
|
|
|
|
|
$LOGGER->debug( sprintf 'removing directory: %s', $pdir ); |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
path($pdir)->remove_tree( { safe => 0 } ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return 1; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |