From 1a3aea490feaaae4c7f63418c8b460c2408056a8 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Sat, 18 Jan 2014 17:48:35 -0800 Subject: Try to improve cleanup (and not forget a build when another arch fails) --- ulri | 49 +++++++++---------------------------------------- 1 file changed, 9 insertions(+), 40 deletions(-) (limited to 'ulri') diff --git a/ulri b/ulri index fef4f06..b83b6c7 100755 --- a/ulri +++ b/ulri @@ -35,7 +35,7 @@ use strict; use MDK::Common qw(any cat_ if_ find); use Iurt::Config qw(config_usage get_date config_init get_author_email check_arch check_noarch); use Iurt::Process qw(check_pid); -use Iurt::File qw(check_upload_tree); +use Iurt::File qw(check_upload_tree cleanup_failed_build); use Iurt::Mail qw(sendmail); use Iurt::Util qw(plog_init plog ssh_setup ssh sout sget sput); use File::Copy 'move'; @@ -259,17 +259,6 @@ sub todo_func { } } -sub todo_post { - my ($todo, $f, $m, $s, $r) = @_; - - if ($r =~ /(\d{14}\.\w+\.\w+\.\d+)_([\w-]+)\.(\w+)\.(\w+)\.(\d{14})\.(\d+)\.lock$/) { - if (!$pkg_tree{$1}{srpms}) { - plog('INFO', "cleaning orphan $r"); - unlink "$todo/$f/$m/$s/$r"; - } - } -} - sub done_func { my ($_todo, $_f, $m, $s, $r) = @_; @@ -286,8 +275,7 @@ sub done_func { } } - -check_upload_tree($todo, \&todo_func, \&todo_post); +check_upload_tree($todo, \&todo_func); # getting already compiled packages # The cache should not be needed if the .done file are removed as the same @@ -409,7 +397,11 @@ foreach my $prefix (keys %pkg_tree) { make_path("$done_dir/$prefix"); sget($remote, "$prefix_dir/log/*", "$done_dir/$prefix"); ssh($remote, "rm -rf $prefix_dir"); - $something_finished = 1; + if (!$ent->{srpms}) { + cleanup_failed_build($todo_dir, $done_dir, $fail_dir, $prefix, $ent); + } else { + $something_finished = 1; + } } } } # if ($status) @@ -467,32 +459,9 @@ foreach my $prefix (keys %pkg_tree) { "to $fail_dir/ failed ($!)"); $compildone->{$prefix}{$media}{$arch} = 0; } - - # Move built packages to failures if one arch failed - foreach my $rpm (@{$ent->{rpms}}) { - my $file = "$done_dir/${prefix}_$rpm"; - plog('DEBUG', "moving built rpm $file to $fail_dir/${prefix}_$rpm"); - link $file, "$fail_dir/${prefix}_$rpm"; - unlink $file; - } - # Should clean the queue - # Must remove the SRPM and the lock - foreach my $srpm (@{$ent->{srpms}}) { - my $file = "$todo_dir/${prefix}_$srpm"; - plog('DEBUG', "moving $file to $fail_dir/${prefix}_$srpm"); - link $file, "$fail_dir/${prefix}_$srpm"; - # FIXME If another arch is currently building, we will not clean its logs (Bug #4343) - delete $pkg_tree{$prefix}; - unlink $file; - # If one arch has been generated, we also have a src.rpm in done - $file = "$done_dir/${prefix}_$srpm"; - if (-f $file) { - plog('DEBUG', "deleting $file"); - unlink $file; - } - } - + cleanup_failed_build($todo_dir, $done_dir, $fail_dir, $prefix, $ent); + # Notify user if build failed # if ($user) { -- cgit v1.2.1