| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# --8<--8<--8<--8<-- |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# Copyright (C) 2008 Smithsonian Astrophysical Observatory |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# This file is part of Decision::Depends |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
# Decision-Depends is free software: you can redistribute it and/or modify |
|
8
|
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by |
|
9
|
|
|
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or (at |
|
10
|
|
|
|
|
|
|
# your option) any later version. |
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful, |
|
13
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15
|
|
|
|
|
|
|
# GNU General Public License for more details. |
|
16
|
|
|
|
|
|
|
# |
|
17
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License |
|
18
|
|
|
|
|
|
|
# along with this program. If not, see . |
|
19
|
|
|
|
|
|
|
# |
|
20
|
|
|
|
|
|
|
# -->8-->8-->8-->8-- |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package Decision::Depends::List; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
require 5.005_62; |
|
25
|
11
|
|
|
11
|
|
63
|
use strict; |
|
|
11
|
|
|
|
|
20
|
|
|
|
11
|
|
|
|
|
620
|
|
|
26
|
11
|
|
|
11
|
|
55
|
use warnings; |
|
|
11
|
|
|
|
|
27
|
|
|
|
11
|
|
|
|
|
387
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
11
|
|
|
11
|
|
58
|
use Carp; |
|
|
11
|
|
|
|
|
20
|
|
|
|
11
|
|
|
|
|
961
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our $VERSION = '0.20'; |
|
31
|
|
|
|
|
|
|
|
|
32
|
11
|
|
|
11
|
|
7084
|
use Decision::Depends::Time; |
|
|
11
|
|
|
|
|
30
|
|
|
|
11
|
|
|
|
|
353
|
|
|
33
|
11
|
|
|
11
|
|
6941
|
use Decision::Depends::Var; |
|
|
11
|
|
|
|
|
37
|
|
|
|
11
|
|
|
|
|
421
|
|
|
34
|
11
|
|
|
11
|
|
7753
|
use Decision::Depends::Sig; |
|
|
11
|
|
|
|
|
30
|
|
|
|
11
|
|
|
|
|
6420
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
## no critic ( ProhibitAccessOfPrivateData ) |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Preloaded methods go here. |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub new |
|
41
|
|
|
|
|
|
|
{ |
|
42
|
52
|
|
|
52
|
0
|
176
|
my $class = shift; |
|
43
|
52
|
|
33
|
|
|
431
|
$class = ref($class) || $class; |
|
44
|
|
|
|
|
|
|
|
|
45
|
52
|
|
|
|
|
400
|
my $self = bless {}, $class; |
|
46
|
|
|
|
|
|
|
|
|
47
|
52
|
|
|
|
|
337
|
$self->{state} = shift; |
|
48
|
|
|
|
|
|
|
|
|
49
|
52
|
|
|
|
|
269
|
$self->{list} = []; |
|
50
|
|
|
|
|
|
|
|
|
51
|
52
|
|
|
|
|
274
|
$self; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub Verbose |
|
55
|
|
|
|
|
|
|
{ |
|
56
|
89
|
|
|
89
|
0
|
568
|
$_[0]->{state}->Verbose; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub add |
|
60
|
|
|
|
|
|
|
{ |
|
61
|
63
|
|
|
63
|
0
|
204
|
my ( $self, $obj ) = @_; |
|
62
|
|
|
|
|
|
|
|
|
63
|
63
|
|
|
|
|
99
|
push @{$self->{list}}, $obj; |
|
|
63
|
|
|
|
|
361
|
|
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub ndeps |
|
67
|
|
|
|
|
|
|
{ |
|
68
|
0
|
|
|
0
|
0
|
0
|
@{shift->{list}}; |
|
|
0
|
|
|
|
|
0
|
|
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub depends |
|
72
|
|
|
|
|
|
|
{ |
|
73
|
49
|
|
|
49
|
0
|
96
|
my ( $self, $targets ) = @_; |
|
74
|
|
|
|
|
|
|
|
|
75
|
49
|
|
|
|
|
70
|
my %depends; |
|
76
|
49
|
|
|
|
|
265
|
local $Carp::CarpLevel = $Carp::CarpLevel + 1; |
|
77
|
|
|
|
|
|
|
|
|
78
|
49
|
|
|
|
|
213
|
for my $target ( @$targets ) |
|
79
|
|
|
|
|
|
|
{ |
|
80
|
53
|
50
|
|
|
|
191
|
print STDOUT " Target ", $target->file, "\n" |
|
81
|
|
|
|
|
|
|
if $self->Verbose; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# keep track of changed dependencies |
|
84
|
53
|
|
|
|
|
796
|
my %deps = ( time => [], |
|
85
|
|
|
|
|
|
|
var => [], |
|
86
|
|
|
|
|
|
|
sig => [] ); |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
|
89
|
53
|
|
|
|
|
321
|
my $time = $target->getTime; |
|
90
|
|
|
|
|
|
|
|
|
91
|
53
|
100
|
|
|
|
201
|
unless( defined $time ) |
|
92
|
|
|
|
|
|
|
{ |
|
93
|
20
|
50
|
|
|
|
89
|
print STDOUT " target `", $target->file, |
|
94
|
|
|
|
|
|
|
"' doesn't exist\n" if $self->Verbose; |
|
95
|
|
|
|
|
|
|
|
|
96
|
20
|
|
|
|
|
120
|
$depends{$target->file} = \%deps; |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
else |
|
99
|
|
|
|
|
|
|
{ |
|
100
|
33
|
|
|
|
|
63
|
for my $dep ( @{$self->{list}} ) |
|
|
33
|
|
|
|
|
173
|
|
|
101
|
|
|
|
|
|
|
{ |
|
102
|
44
|
|
|
|
|
425
|
my ( $type, $deps ) = $dep->depends( $target->file, $time ); |
|
103
|
41
|
|
|
|
|
87
|
push @{$deps{$type}}, @$deps; |
|
|
41
|
|
|
|
|
169
|
|
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
30
|
|
|
|
|
72
|
my $ndeps = 0; |
|
107
|
30
|
|
|
|
|
66
|
map { $ndeps += @{$deps{$_}} } qw( var time sig ); |
|
|
90
|
|
|
|
|
109
|
|
|
|
90
|
|
|
|
|
252
|
|
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
# return list of dependencies. if there are none, return |
|
110
|
|
|
|
|
|
|
# the empty hash if force is one |
|
111
|
30
|
100
|
33
|
|
|
452
|
$depends{$target->file} = \%deps |
|
|
|
|
66
|
|
|
|
|
|
112
|
|
|
|
|
|
|
if $ndeps or $target->force || $self->{state}->Force; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
|
|
116
|
46
|
|
|
|
|
327
|
\%depends; |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub update |
|
122
|
|
|
|
|
|
|
{ |
|
123
|
16
|
|
|
16
|
0
|
41
|
my ( $self, $targets ) = @_; |
|
124
|
|
|
|
|
|
|
|
|
125
|
16
|
|
|
|
|
128
|
local $Carp::CarpLevel = $Carp::CarpLevel + 1; |
|
126
|
|
|
|
|
|
|
|
|
127
|
16
|
|
|
|
|
70
|
for my $target ( @$targets ) |
|
128
|
|
|
|
|
|
|
{ |
|
129
|
16
|
50
|
|
|
|
70
|
print STDOUT ("Updating target ", $target->file, "\n" ) |
|
130
|
|
|
|
|
|
|
if $self->Verbose; |
|
131
|
|
|
|
|
|
|
|
|
132
|
16
|
|
|
|
|
30
|
$_->update( $target->file ) foreach @{$self->{list}}; |
|
|
16
|
|
|
|
|
87
|
|
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
} |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1; |