blob: 4a59893969ac8648515362da3eefd392de8275ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#!/usr/bin/perl
#---------------------------------------------------------------------------------------------------
# Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
# Contact: http://www.qt-project.org/legal
#
# You may use this file under the terms of the 3-clause BSD license.
# See the file LICENSE from this package for details.
#
# Following Perl modules are needed
# CGI::FormBuilder
# CGI::FormBuilder::Source::File
# CGI::FormBuilder::Mail::FormatMultiPart
#---------------------------------------------------------------------------------------------------
# Add current dir to be able to load our own custom mailer 'reltestmailer'
use Cwd;
push @INC, cwd;
use POSIX qw(strftime);
use CGI::FormBuilder;
use Data::Dumper;
sub meaning
{
my ($form, $field_name) = @_;
my $val = $form->field->{$field_name};
return $val if (!defined $form->{'fieldopts'}->{$field_name}->{'options'});
my $result = "Not tested";
$result = "Yes" if ($val = 2);
$result = "No" if ($val = 1);
return $result;
}
# First create our form
my $form = CGI::FormBuilder->new(source => 'reltest-form.conf');
# Check to see if we're submitted and valid
if ($form->submitted && $form->validate) {
our $field = $form->fields;
# Translate options over to values
our %result;
for my $val (keys %{$field}) {
$result{$val} = meaning($form, $val);
}
# Show confirmation screen
print $form->confirm(header => 1);
# Mail off a copy to the mailing list
$form->mailresults(plugin => 'reltestmailer',
from => $field->{'report_name'} . '<releasing@qt-project.org>',
to => 'Releases Mailing List <releasing@qt-project.org>',
smtp => 'mx.qt-project.org',
subject => "Testing: $field->{'package_date'} + $field->{'mkspec_used'} " .
($field->{'releasable'} == 2 ? '[success!]' : '[fail]')
);
} else {
# Auto-fill with today's date
my $now = strftime("%m/%d/%Y", localtime);
$form->field(name => 'report_date',
value => $now);
$form->field(name => 'package_date',
value => $now);
# Print out the form
print $form->render(header => 1);
}
|