diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-09-25 06:23:47 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-09-25 06:23:47 +0000 |
commit | 529be23f6c4868580f4675876af4bdb58b33540f (patch) | |
tree | f088a8b76d602a9abf39bd033e41382f5766bbd9 | |
parent | 2d25ef3471034136b7f388440d1670dd7bfad712 (diff) | |
download | iurt-529be23f6c4868580f4675876af4bdb58b33540f.tar iurt-529be23f6c4868580f4675876af4bdb58b33540f.tar.gz iurt-529be23f6c4868580f4675876af4bdb58b33540f.tar.bz2 iurt-529be23f6c4868580f4675876af4bdb58b33540f.tar.xz iurt-529be23f6c4868580f4675876af4bdb58b33540f.zip |
(warn_about_failure) split it out
-rwxr-xr-x | ulri | 65 |
1 files changed, 35 insertions, 30 deletions
@@ -489,36 +489,7 @@ foreach my $prefix (keys %pkg_tree) { # Notify user if build failed # if ($user) { - my $text = join("\n", "Build of the following packages failed:\n", map { "- $_" } @{$ent->{srpms}}) . "\n"; - my $srpms = join(' ', @{$ent->{srpms}}, undef); - - my $to = get_author_email($user) || "Unknown <$config->{admin}>"; - my $cc; - my $fpath = "$config->{http_queue}/failure/$path/$prefix"; - $fpath =~ tr!/!!s; # Squash double slashes ... - $fpath =~ s!/!//!; # ... except for http:// - - $text .= "\nFailure details available in $fpath/log\n"; - $text .= "Reason:\n"; - $text .= read_file("$fail_dir/$prefix/log/status.log"); - $text .= "\nLog files generated:\n"; - - opendir my $DP1, "$fail_dir/$prefix/log/"; - foreach my $f1 (sort(readdir($DP1))) { - next if ! -d "$fail_dir/$prefix/log/$f1" || $f1 =~ m/^\./; - - opendir my $DP2, "$fail_dir/$prefix/log/$f1"; - foreach my $f2 (readdir $DP2) { - next if $f2 =~ m/^\./; - $text .= "$fpath/log/$f1/$f2\n"; - } - closedir $DP2; - } - closedir $DP1; - - sendmail($to, $cc, - "Rebuild failed on $arch for $srpms", $text, - "Ulri the scheduler bot <$config->{admin}>", 0, $config); + warn_about_failure($user, $ent, $arch, $fail_dir, $path, $prefix); } # clean the log on the compilation machine @@ -745,6 +716,40 @@ exit(); # Subroutines # +sub warn_about_failure { + my ($user, $ent, $arch, $fail_dir, $path, $prefix) = @_; + my $text = join("\n", "Build of the following packages failed:\n", map { "- $_" } @{$ent->{srpms}}) . "\n"; + my $srpms = join(' ', @{$ent->{srpms}}, undef); + + my $to = get_author_email($user) || "Unknown <$config->{admin}>"; + my $cc; + my $fpath = "$config->{http_queue}/failure/$path/$prefix"; + $fpath =~ tr!/!!s; # Squash double slashes ... + $fpath =~ s!/!//!; # ... except for http:// + + $text .= "\nFailure details available in $fpath/log\n"; + $text .= "Reason:\n"; + $text .= read_file("$fail_dir/$prefix/log/status.log"); + $text .= "\nLog files generated:\n"; + + opendir my $DP1, "$fail_dir/$prefix/log/"; + foreach my $f1 (sort(readdir($DP1))) { + next if ! -d "$fail_dir/$prefix/log/$f1" || $f1 =~ m/^\./; + + opendir my $DP2, "$fail_dir/$prefix/log/$f1"; + foreach my $f2 (readdir $DP2) { + next if $f2 =~ m/^\./; + $text .= "$fpath/log/$f1/$f2\n"; + } + closedir $DP2; + } + closedir $DP1; + + sendmail($to, $cc, + "Rebuild failed on $arch for $srpms", $text, + "Ulri the scheduler bot <$config->{admin}>", 0, $config); +} + sub get_pid_from_file { my ($file) = @_; |