line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Shipwright::Source::Shipyard; |
2
|
1
|
|
|
1
|
|
778
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
64
|
|
3
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use Shipwright::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
75
|
|
6
|
1
|
|
|
1
|
|
5
|
use File::Spec::Functions qw/catdir/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
36
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use base qw/Shipwright::Source::Base/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
416
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head2 run |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub run { |
15
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
$self->log->info( "preparing to run source: " . $self->source ); |
18
|
0
|
|
|
|
|
|
my ( $base, $dist ) = $self->source =~ m{(.*)/([^/]+)}; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $source_shipwright = Shipwright->new( repository => $base ); |
21
|
0
|
0
|
|
|
|
|
$self->name($dist) unless $self->name; |
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
if ( $source_shipwright->backend->has_branch_support ) { |
24
|
0
|
|
|
|
|
|
$source_shipwright->backend->export( |
25
|
|
|
|
|
|
|
target => catdir( $self->directory, $self->name ), |
26
|
|
|
|
|
|
|
path => "/sources/$dist", |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
else { |
30
|
0
|
|
|
|
|
|
$source_shipwright->backend->export( |
31
|
|
|
|
|
|
|
target => catdir( $self->directory, $self->name ), |
32
|
|
|
|
|
|
|
path => "/dists/$dist", |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
$source_shipwright->backend->export( |
37
|
|
|
|
|
|
|
target => catdir( $self->scripts_directory, $self->name ), |
38
|
|
|
|
|
|
|
path => "/scripts/$dist", |
39
|
|
|
|
|
|
|
); |
40
|
0
|
|
|
|
|
|
my $source_version = $source_shipwright->backend->version->{$dist}; |
41
|
0
|
|
|
|
|
|
my $source_branch; |
42
|
0
|
0
|
0
|
|
|
|
if ( $source_shipwright->backend->branches |
43
|
|
|
|
|
|
|
&& $source_shipwright->backend->branches->{$dist} ) |
44
|
|
|
|
|
|
|
{ |
45
|
0
|
|
|
|
|
|
$source_branch = $source_shipwright->backend->branches->{$dist}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
$self->_update_version( $self->name, $source_version ); |
49
|
0
|
|
|
|
|
|
$self->_update_url( $self->name, 'shipyard:' . $self->source ); |
50
|
0
|
0
|
|
|
|
|
$self->_update_branches( $self->name, $source_branch ) if $source_branch; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# follow |
53
|
0
|
0
|
|
|
|
|
if ( $self->follow ) { |
54
|
0
|
|
|
|
|
|
my $out = run_cmd( |
55
|
|
|
|
|
|
|
$source_shipwright->backend->_cmd( |
56
|
|
|
|
|
|
|
'cat', path => "/scripts/$dist/require.yml", |
57
|
|
|
|
|
|
|
), |
58
|
|
|
|
|
|
|
1 |
59
|
|
|
|
|
|
|
); |
60
|
0
|
|
0
|
|
|
|
my $require = load_yaml($out) || {}; |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
for my $type ( keys %$require ) { |
63
|
0
|
|
|
|
|
|
for my $req ( keys %{ $require->{$type} } ) { |
|
0
|
|
|
|
|
|
|
64
|
0
|
0
|
|
|
|
|
unless ( -e catdir( $self->directory, $req ) ) { |
65
|
0
|
|
|
|
|
|
my $s = Shipwright::Source->new( |
66
|
|
|
|
|
|
|
%$self, |
67
|
|
|
|
|
|
|
source => "shipyard:$base/$req", |
68
|
|
|
|
|
|
|
name => $req |
69
|
|
|
|
|
|
|
); |
70
|
0
|
|
|
|
|
|
$s->run; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
return catdir( $self->directory, $self->name ); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |