line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## no critic (RequireUseStrict) |
2
|
|
|
|
|
|
|
package Tapper::Producer::Temare; |
3
|
|
|
|
|
|
|
BEGIN { |
4
|
2
|
|
|
2
|
|
104112
|
$Tapper::Producer::Temare::AUTHORITY = 'cpan:TAPPER'; |
5
|
|
|
|
|
|
|
} |
6
|
|
|
|
|
|
|
{ |
7
|
|
|
|
|
|
|
$Tapper::Producer::Temare::VERSION = '4.1.3'; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
# ABSTRACT: produce preconditions via temare |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
19533
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use File::Temp 'tempfile'; |
13
|
|
|
|
|
|
|
use YAML 'LoadFile'; |
14
|
|
|
|
|
|
|
use Tapper::Config; |
15
|
|
|
|
|
|
|
use Try::Tiny; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub produce { |
19
|
|
|
|
|
|
|
my ($self, $job, $produce) = @_; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my ($fh, $file) = tempfile( UNLINK => 1 ); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use Data::Dumper; |
24
|
|
|
|
|
|
|
my $temare_path=Tapper::Config->subconfig->{paths}{temare_path}; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$ENV{PYTHONPATH}="$temare_path/src"; |
27
|
|
|
|
|
|
|
my $subject = $produce->{subject}; |
28
|
|
|
|
|
|
|
my $bitness = $produce->{bitness}; |
29
|
|
|
|
|
|
|
my $host = $job->host->name; |
30
|
|
|
|
|
|
|
$ENV{TAPPER_TEMARE} = $file; |
31
|
|
|
|
|
|
|
my $cmd="$temare_path/temare subjectprep $host $subject $bitness"; |
32
|
|
|
|
|
|
|
my $precondition = qx($cmd); |
33
|
|
|
|
|
|
|
if ($?) { |
34
|
|
|
|
|
|
|
my $error_msg = "Temare error.\n"; |
35
|
|
|
|
|
|
|
$error_msg .= "Error code: $?\n"; |
36
|
|
|
|
|
|
|
$error_msg .= "Error message: $precondition\n"; |
37
|
|
|
|
|
|
|
die $error_msg; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $config = try {LoadFile($file)} catch { die "Error occured while loading precondition $precondition:\n$_"}; |
41
|
|
|
|
|
|
|
close $fh; |
42
|
|
|
|
|
|
|
unlink $file if -e $file; |
43
|
|
|
|
|
|
|
my $topic = $config->{subject} || 'Misc'; |
44
|
|
|
|
|
|
|
return { |
45
|
|
|
|
|
|
|
topic => $topic, |
46
|
|
|
|
|
|
|
precondition_yaml => $precondition |
47
|
|
|
|
|
|
|
}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=pod |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=encoding utf-8 |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 NAME |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Tapper::Producer::Temare - produce preconditions via temare |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 produce |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Choose a new testrun from the test matrix, generate the required |
65
|
|
|
|
|
|
|
external config files (e.g. svm file for xen, .sh files for KVM, ..). |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
@param Job object - the job we build a package for |
68
|
|
|
|
|
|
|
@param hash ref - producer precondition |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
@return success - hash ref containing list of new preconditions |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
@throws die() |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 AUTHOR |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
AMD OSRC Tapper Team <tapper@amd64.org> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This software is Copyright (c) 2013 by Advanced Micro Devices, Inc.. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This is free software, licensed under: |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |