line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## no critic (RequireUseStrict) |
2
|
|
|
|
|
|
|
package Tapper::Producer::NewestPackage; |
3
|
|
|
|
|
|
|
BEGIN { |
4
|
1
|
|
|
1
|
|
2230
|
$Tapper::Producer::NewestPackage::AUTHORITY = 'cpan:TAPPER'; |
5
|
|
|
|
|
|
|
} |
6
|
|
|
|
|
|
|
{ |
7
|
|
|
|
|
|
|
$Tapper::Producer::NewestPackage::VERSION = '4.1.3'; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
# ABSTRACT: produce preconditions via find latest changed file |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
609
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use YAML; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use 5.010; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use Tapper::Config; |
17
|
|
|
|
|
|
|
use File::stat; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub younger { stat($a)->mtime() <=> stat($b)->mtime() } |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub produce { |
24
|
|
|
|
|
|
|
my ($self, $job, $produce) = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $source_dir = $produce->{source_dir}; |
27
|
|
|
|
|
|
|
my @files = sort younger <$source_dir/*>; |
28
|
|
|
|
|
|
|
return { |
29
|
|
|
|
|
|
|
error => 'No files found in $source_dir', |
30
|
|
|
|
|
|
|
} if not @files; |
31
|
|
|
|
|
|
|
my $use_file = pop @files; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $nfs = Tapper::Config->subconfig->{paths}{prc_nfs_mountdir}; |
34
|
|
|
|
|
|
|
die "$use_file not available to Installer" unless $use_file=~/^$nfs/; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $retval = [{ |
37
|
|
|
|
|
|
|
precondition_type => 'package', |
38
|
|
|
|
|
|
|
filename => $use_file, |
39
|
|
|
|
|
|
|
},]; |
40
|
|
|
|
|
|
|
return { |
41
|
|
|
|
|
|
|
precondition_yaml => Dump(@$retval), |
42
|
|
|
|
|
|
|
}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=pod |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=encoding utf-8 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 NAME |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Tapper::Producer::NewestPackage - produce preconditions via find latest changed file |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 younger |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Comparator for files by mtime. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 produce |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Produce resulting precondition. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 AUTHOR |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
AMD OSRC Tapper Team <tapper@amd64.org> |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This software is Copyright (c) 2013 by Advanced Micro Devices, Inc.. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This is free software, licensed under: |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |