line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PITA::Scheme::Perl5::Build; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Class for implementing the perl5-build testing scheme |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
34192
|
use 5.005; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
72
|
|
6
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
49
|
|
7
|
2
|
|
|
2
|
|
10
|
use Carp (); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
25
|
|
8
|
2
|
|
|
2
|
|
9
|
use File::Spec (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
32
|
|
9
|
2
|
|
|
2
|
|
939
|
use File::Which (); |
|
2
|
|
|
|
|
1076
|
|
|
2
|
|
|
|
|
31
|
|
10
|
2
|
|
|
2
|
|
1369
|
use PITA::Scheme::Perl (); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use vars qw{$VERSION @ISA}; |
13
|
|
|
|
|
|
|
BEGIN { |
14
|
|
|
|
|
|
|
$VERSION = '0.43'; |
15
|
|
|
|
|
|
|
@ISA = 'PITA::Scheme::Perl'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
##################################################################### |
23
|
|
|
|
|
|
|
# Constructor |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub default_path { |
26
|
|
|
|
|
|
|
File::Which::which('perl') || ''; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new { |
30
|
|
|
|
|
|
|
my $class = shift; |
31
|
|
|
|
|
|
|
my $self = $class->SUPER::new(@_); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
### Additional checks, if any |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$self; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
##################################################################### |
43
|
|
|
|
|
|
|
# PITA::Scheme Methods |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub prepare_package { |
46
|
|
|
|
|
|
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# Do the generic unpacking |
49
|
|
|
|
|
|
|
$self->SUPER::prepare_package(@_); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Validate that the package has a Makefile.PL in the root |
52
|
|
|
|
|
|
|
unless ( -f $self->workarea_file('Build.PL') ) { |
53
|
|
|
|
|
|
|
Carp::croak("Package does not contain a Makefile.PL"); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
$self; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub execute_all { |
60
|
|
|
|
|
|
|
my $self = shift; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# Run the Makefile.PL |
63
|
|
|
|
|
|
|
$self->execute_buildpl or return ''; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# Run the make |
66
|
|
|
|
|
|
|
$self->execute_build or return ''; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# Run the tests |
69
|
|
|
|
|
|
|
$self->execute_buildtest or return ''; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub execute_buildpl { |
75
|
|
|
|
|
|
|
my $self = shift; |
76
|
|
|
|
|
|
|
unless ( -f $self->workarea_file('Build.PL') ) { |
77
|
|
|
|
|
|
|
Carp::croak("Cannot execute_makefilepl without a Build.PL"); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# Run the Makefile.PL |
81
|
|
|
|
|
|
|
my $command = $self->execute_command('perl', 'Build.PL'); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# Did it create a make file |
84
|
|
|
|
|
|
|
if ( -f $self->workarea_file('Build') ) { |
85
|
|
|
|
|
|
|
# Worked as expected |
86
|
|
|
|
|
|
|
### Do we need to add stuff here later? |
87
|
|
|
|
|
|
|
return 1; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# Didn't work |
91
|
|
|
|
|
|
|
### Do we need to add stuff here later? |
92
|
|
|
|
|
|
|
return ''; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub execute_build { |
96
|
|
|
|
|
|
|
my $self = shift; |
97
|
|
|
|
|
|
|
unless ( -f $self->workarea_file('Build') ) { |
98
|
|
|
|
|
|
|
Carp::croak("Cannot execute_make without a Build file"); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# Run the make |
102
|
|
|
|
|
|
|
my $command = $self->execute_command('perl', 'Build'); |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# Did it create a blib directory? |
105
|
|
|
|
|
|
|
if ( -d $self->workarea_file('blib') ) { |
106
|
|
|
|
|
|
|
# Worked as expected |
107
|
|
|
|
|
|
|
### Do we need to add stuff here later? |
108
|
|
|
|
|
|
|
return 1; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# Didn't work |
112
|
|
|
|
|
|
|
### Do we need to add stuff here later? |
113
|
|
|
|
|
|
|
return ''; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub execute_buildtest { |
117
|
|
|
|
|
|
|
my $self = shift; |
118
|
|
|
|
|
|
|
unless ( -f $self->workarea_file('Build') ) { |
119
|
|
|
|
|
|
|
Carp::croak("Cannot execute_maketest without a Build file"); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
unless ( -d $self->workarea_file('blib') ) { |
122
|
|
|
|
|
|
|
Carp::croak("Cannot execute_maketest without a blib"); |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
# Run the make test |
126
|
|
|
|
|
|
|
my $command = $self->execute_command('perl', 'Build', 'test'); |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# Did it... erm... |
129
|
|
|
|
|
|
|
if ( 1 ) { |
130
|
|
|
|
|
|
|
# Worked as expected |
131
|
|
|
|
|
|
|
### Do we need to add stuff here later? |
132
|
|
|
|
|
|
|
return 1; |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
# Didn't work |
136
|
|
|
|
|
|
|
### Do we need to add stuff here later? |
137
|
|
|
|
|
|
|
return ''; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
1; |