| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PITA::Image::Discover; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
42
|
use 5.006; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
208
|
|
|
4
|
3
|
|
|
3
|
|
15
|
use strict; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
92
|
|
|
5
|
3
|
|
|
3
|
|
4473
|
use PITA::XML (); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Params::Util (); |
|
7
|
|
|
|
|
|
|
use PITA::Image::Task (); |
|
8
|
|
|
|
|
|
|
use PITA::Scheme::Perl::Discovery (); |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use vars qw{$VERSION @ISA}; |
|
11
|
|
|
|
|
|
|
BEGIN { |
|
12
|
|
|
|
|
|
|
$VERSION = '0.60'; |
|
13
|
|
|
|
|
|
|
@ISA = 'PITA::Image::Task'; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
|
17
|
|
|
|
|
|
|
my $class = shift; |
|
18
|
|
|
|
|
|
|
my $self = bless { @_ }, $class; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# Check the task params |
|
21
|
|
|
|
|
|
|
unless ( $self->job_id ) { |
|
22
|
|
|
|
|
|
|
Carp::croak("Task does not have a job_id"); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
unless ( Params::Util::_SET($self->platforms, 'PITA::Image::Platform') ) { |
|
25
|
|
|
|
|
|
|
Carp::croak("Did not provide a list of platforms"); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Create a discovery object for each platform |
|
29
|
|
|
|
|
|
|
my @discoveries = (); |
|
30
|
|
|
|
|
|
|
foreach my $platform ( @{$self->platforms} ) { |
|
31
|
|
|
|
|
|
|
push @discoveries, PITA::Scheme::Perl::Discovery->new( |
|
32
|
|
|
|
|
|
|
path => $platform->path, |
|
33
|
|
|
|
|
|
|
); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
$self->{discoveries} = \@discoveries; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$self; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub job_id { |
|
41
|
|
|
|
|
|
|
$_[0]->{job_id}; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub platforms { |
|
45
|
|
|
|
|
|
|
$_[0]->{platforms}; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub discoveries { |
|
49
|
|
|
|
|
|
|
$_[0]->{discoveries}; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
##################################################################### |
|
57
|
|
|
|
|
|
|
# Run the discovery process |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub run { |
|
60
|
|
|
|
|
|
|
my $self = shift; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# Create a Guest to hold the platforms. |
|
63
|
|
|
|
|
|
|
### Although we might not be running in the Local driver, |
|
64
|
|
|
|
|
|
|
### WE can't tell the difference, so we might as well be. |
|
65
|
|
|
|
|
|
|
### The driver will correct it later if it's wrong. |
|
66
|
|
|
|
|
|
|
my $guest = PITA::XML::Guest->new( |
|
67
|
|
|
|
|
|
|
driver => 'Local', |
|
68
|
|
|
|
|
|
|
params => {}, |
|
69
|
|
|
|
|
|
|
); |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# Run the discovery on each platform |
|
72
|
|
|
|
|
|
|
foreach my $discovery ( @{$self->discoveries} ) { |
|
73
|
|
|
|
|
|
|
require Devel::Dumpvar; |
|
74
|
|
|
|
|
|
|
$discovery->delegate; |
|
75
|
|
|
|
|
|
|
if ( $discovery->platform ) { |
|
76
|
|
|
|
|
|
|
$guest->add_platform( $discovery->platform ); |
|
77
|
|
|
|
|
|
|
} else { |
|
78
|
|
|
|
|
|
|
my $path = $discovery->path; |
|
79
|
|
|
|
|
|
|
Carp::croak("Error finding platform at $path"); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# Looks good, save |
|
84
|
|
|
|
|
|
|
$self->{result} = $guest; |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub result { |
|
90
|
|
|
|
|
|
|
$_[0]->{result}; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |