line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::Build::Plugin::Cleanse::BuildDir; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
228220
|
use strict; |
|
2
|
|
|
|
|
20
|
|
|
2
|
|
|
|
|
51
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
37
|
|
5
|
2
|
|
|
2
|
|
30
|
use 5.008001; |
|
2
|
|
|
|
|
6
|
|
6
|
2
|
|
|
2
|
|
1073
|
use Alien::Build; |
|
2
|
|
|
|
|
76119
|
|
|
2
|
|
|
|
|
57
|
|
7
|
2
|
|
|
2
|
|
773
|
use Alien::Build::Plugin; |
|
2
|
|
|
|
|
19286
|
|
|
2
|
|
|
|
|
14
|
|
8
|
2
|
|
|
2
|
|
177
|
use File::Path qw /remove_tree/; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
115
|
|
9
|
2
|
|
|
2
|
|
12
|
use Cwd qw /getcwd/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
69
|
|
10
|
2
|
|
|
2
|
|
10
|
use Path::Tiny qw /path/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
540
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.06'; # VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub init { |
17
|
1
|
|
|
1
|
1
|
16799
|
my($self, $meta) = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$meta->after_hook ( build => sub { |
20
|
1
|
|
|
1
|
|
31039
|
my($build) = @_; |
21
|
|
|
|
|
|
|
|
22
|
1
|
50
|
|
|
|
4
|
return if $build->install_type ne 'share'; |
23
|
1
|
50
|
|
|
|
10
|
return if $build->meta_prop->{out_of_source}; |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
13
|
my $build_dir = path ($build->install_prop->{extract})->absolute; |
26
|
|
|
|
|
|
|
|
27
|
1
|
50
|
|
|
|
53
|
if (!defined $build_dir) { |
28
|
0
|
|
|
|
|
0
|
$build->log ("Unable to determine build dir\n"); |
29
|
0
|
|
|
|
|
0
|
return; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# a spot of paranoia |
33
|
|
|
|
|
|
|
#return if $build_dir !~ /\b_alien\b/; |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
4
|
$build->log ("Going to delete $build_dir\n"); |
36
|
1
|
|
|
|
|
93
|
$build->log ("Currently in " . getcwd() . "\n"); |
37
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
56
|
my $curdir = getcwd(); |
39
|
1
|
50
|
|
|
|
5
|
if (path($curdir)->subsumes ($build_dir)) { |
40
|
0
|
|
|
|
|
0
|
$build->log ("Going to parent of build directory\n"); |
41
|
0
|
|
|
|
|
0
|
chdir "$build_dir/.."; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
50
|
|
|
141
|
my $count = eval { |
45
|
|
|
|
|
|
|
remove_tree ($build_dir, { |
46
|
|
|
|
|
|
|
safe => 1, |
47
|
|
|
|
|
|
|
#verbose => 1, |
48
|
|
|
|
|
|
|
}); |
49
|
|
|
|
|
|
|
} || 0; |
50
|
1
|
|
|
|
|
488
|
$build->log ("Deleted $count items\n"); |
51
|
1
|
|
|
|
|
8
|
}); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |