diff options
author | Pascal Terjan <pterjan@gmail.com> | 2016-10-03 22:58:07 +0100 |
---|---|---|
committer | Pascal Terjan <pterjan@gmail.com> | 2016-10-03 22:58:07 +0100 |
commit | a52f4d1693ae1114fc188a70db8056780cbf4cf1 (patch) | |
tree | 9dfc5430e65ad17390477bba1994d2f0a4b7d3e5 /ulri | |
parent | 8f4c6e4d8d1fd00db08bf089f4003243cc633a4a (diff) | |
download | iurt-a52f4d1693ae1114fc188a70db8056780cbf4cf1.tar iurt-a52f4d1693ae1114fc188a70db8056780cbf4cf1.tar.gz iurt-a52f4d1693ae1114fc188a70db8056780cbf4cf1.tar.bz2 iurt-a52f4d1693ae1114fc188a70db8056780cbf4cf1.tar.xz iurt-a52f4d1693ae1114fc188a70db8056780cbf4cf1.zip |
Do not give up on a build when failing to check its status
Diffstat (limited to 'ulri')
-rwxr-xr-x | ulri | 136 |
1 files changed, 67 insertions, 69 deletions
@@ -277,84 +277,87 @@ foreach my $prefix (keys %pkg_tree) { plog('INFO', "check status: $host/$arch ($bot [$pid])"); my $status = sout($remote, "cat $status_file"); + if (!$status) { + plog('WARN', "failed to get status for $host/$arch"); + next bot; + } + my $success; my $fail; my $later; # Check if the build bot finished on the other side # - if ($status) { - plog('INFO', "check result: $host/$arch ($bot [$pid])"); - foreach my $res (split "\n", $status) { - my ($p, $r) = $res =~ /(.*):\s+(.*)/; - plog('DEBUG', $res); - if ($r eq 'install_deps_failure') { - plog('FAIL', "install deps failure, rebuild later: $p"); - $later{$prefix} = 1; - $later = 1; - } - if ($r ne 'ok') { - plog('FAIL', "$r: $p"); - $fail = 1; - } + plog('INFO', "check result: $host/$arch ($bot [$pid])"); + foreach my $res (split "\n", $status) { + my ($p, $r) = $res =~ /(.*):\s+(.*)/; + plog('DEBUG', $res); + if ($r eq 'install_deps_failure') { + plog('FAIL', "install deps failure, rebuild later: $p"); + $later{$prefix} = 1; + $later = 1; } + if ($r ne 'ok') { + plog('FAIL', "$r: $p"); + $fail = 1; + } + } + + if (!$fail) { + my @list = split "\n", sout($remote, "ls $prefix_dir"); + my $error; + my $done; + + my $arch_check = join '|', $arch, if_($untranslated_arch{$arch}, @{$untranslated_arch{$arch}}); + plog('MSG', "checking for $arch_check arch"); + foreach my $result (@list) { + $result =~ /\.(src|$arch_check|noarch)\.rpm$/ or next; + + # do not copy the initial src package + $result =~ /^$prefix/ and next; - if (!$fail) { - my @list = split "\n", sout($remote, "ls $prefix_dir"); - my $error; - my $done; - - my $arch_check = join '|', $arch, if_($untranslated_arch{$arch}, @{$untranslated_arch{$arch}}); - plog('MSG', "checking for $arch_check arch"); - foreach my $result (@list) { - $result =~ /\.(src|$arch_check|noarch)\.rpm$/ or next; - - # do not copy the initial src package - $result =~ /^$prefix/ and next; - - my $result_file = "$done_dir/${prefix}_$result"; - - plog('OK', "build ok: $result"); - if ($result =~ /\.$arch_check\.rpm$/) { - $done = 1; - } - - plog('DEBUG', "copy files to done"); - make_path($done_dir); - if (sget($remote, "$prefix_dir/$result", - "$result_file.new")) { - plog('ERROR', "copying $result from $host failed ($!)"); - $error = 1; - last; - } - if (!move("$result_file.new", $result_file)) { - $error = 1; - last; - } - # Add the package to the list of built ones, in case we fail another arch and need to cleanup - push @{$ent->{rpms}}, $result_file; + my $result_file = "$done_dir/${prefix}_$result"; + + plog('OK', "build ok: $result"); + if ($result =~ /\.$arch_check\.rpm$/) { + $done = 1; } - next if $error; - if ($done) { - create_file("$done_dir/${prefix}_$arch.done", "$bot $host"); - $success = 1; + plog('DEBUG', "copy files to done"); + make_path($done_dir); + if (sget($remote, "$prefix_dir/$result", + "$result_file.new")) { + plog('ERROR', "copying $result from $host failed ($!)"); + $error = 1; + last; + } + if (!move("$result_file.new", $result_file)) { + $error = 1; + last; } + # Add the package to the list of built ones, in case we fail another arch and need to cleanup + push @{$ent->{rpms}}, $result_file; + } + next if $error; + + if ($done) { + create_file("$done_dir/${prefix}_$arch.done", "$bot $host"); + $success = 1; + } - if ($success) { - # Fetch build log and clean remote machine - make_path("$done_dir/$prefix"); - sget($remote, "$prefix_dir/log/*", "$done_dir/$prefix"); - ssh($remote, "rm -rf $prefix_dir"); - if (-d "$fail_dir/$prefix") { - # Other arch had failed - cleanup_failed_build($todo_dir, $done_dir, $fail_dir, $prefix, $ent, $arch, $config); - } else { - $something_finished = 1; - } + if ($success) { + # Fetch build log and clean remote machine + make_path("$done_dir/$prefix"); + sget($remote, "$prefix_dir/log/*", "$done_dir/$prefix"); + ssh($remote, "rm -rf $prefix_dir"); + if (-d "$fail_dir/$prefix") { + # Other arch had failed + cleanup_failed_build($todo_dir, $done_dir, $fail_dir, $prefix, $ent, $arch, $config); + } else { + $something_finished = 1; } } - } # if ($status) + } # # Handle build failure @@ -393,11 +396,6 @@ foreach my $prefix (keys %pkg_tree) { next bot; } - if (!$status) { - plog('ERROR', "build bot died on $host, reschedule compilation"); - next bot; - } - plog('INFO', "Failure reason: $success || $later || $fail || $timeout || $zombie || $ended"); plog('FAIL', "build failed"); |