diff options
author | Pascal Terjan <pterjan@gmail.com> | 2016-11-24 00:00:14 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@gmail.com> | 2016-11-24 00:18:29 +0000 |
commit | 2328f608ff92c8efad17fbc36e0bbcb50376ef21 (patch) | |
tree | 33a1b542ce57573496d76b0d0720ce2a80632e7b | |
parent | a3acef1071ae40919dff3fed0065d797b10f8286 (diff) | |
download | iurt-2328f608ff92c8efad17fbc36e0bbcb50376ef21.tar iurt-2328f608ff92c8efad17fbc36e0bbcb50376ef21.tar.gz iurt-2328f608ff92c8efad17fbc36e0bbcb50376ef21.tar.bz2 iurt-2328f608ff92c8efad17fbc36e0bbcb50376ef21.tar.xz iurt-2328f608ff92c8efad17fbc36e0bbcb50376ef21.zip |
Delete src.rpm after last non mandatory arch fails
-rw-r--r-- | lib/Iurt/Queue.pm | 26 | ||||
-rwxr-xr-x | ulri | 4 |
2 files changed, 27 insertions, 3 deletions
diff --git a/lib/Iurt/Queue.pm b/lib/Iurt/Queue.pm index c4c79ad..d065713 100644 --- a/lib/Iurt/Queue.pm +++ b/lib/Iurt/Queue.pm @@ -12,6 +12,7 @@ use strict; our @EXPORT = qw( get_upload_tree_state cleanup_failed_build + check_if_all_archs_processed check_if_mandatory_arch_failed ); @@ -62,8 +63,23 @@ sub check_if_mandatory_arch_failed { } } +sub check_if_all_archs_processed { + my ($media, $prefix, $ent, $config) = @_; + return 1 if $ent->{media}{$media}{done_arch}{noarch}; + return 1 if $ent->{media}{$media}{failed_arch}{noarch}; + my $arch_list = get_target_arch($config, $ent->{target}); + foreach my $arch ($arch_list) { + next if $ent->{media}{$media}{done_arch}{$arch}; + next if $ent->{media}{$media}{excluded_arch}{$arch}; + next if $ent->{media}{$media}{failed_arch}{$arch}; + # This arch is not done yet! + return; + } + return 1; +} + sub cleanup_failed_build { - my ($todo_dir, $done_dir, $fail_dir, $prefix, $ent, $arch, $config) = @_; + my ($todo_dir, $done_dir, $fail_dir, $prefix, $ent, $media, $arch, $config) = @_; my $mandatory_arch = get_mandatory_arch($config, $ent->{target}); my $fatal_failure = member($arch, @$mandatory_arch) || $arch eq 'noarch'; @@ -86,6 +102,14 @@ sub cleanup_failed_build { if (!$fatal_failure) { # keep rpms for other architectures $ent->{rpms} = $kept_rpms; + # but delete src.rpm if we are now done + if (check_if_all_archs_processed($media, $prefix, $ent, $config)) { + foreach my $srpm (@{$ent->{srpms}}) { + my $file = "$todo_dir/${prefix}_$srpm"; + plog('DEBUG', "moving $file to $fail_dir/"); + move($file, "$fail_dir/${prefix}_$srpm"); + } + } return; } @@ -385,7 +385,7 @@ foreach my $prefix (keys %pkg_tree) { sget($remote, "$prefix_dir/log/*", "$done_dir/$prefix"); ssh($remote, "rm -rf $prefix_dir"); if (check_if_mandatory_arch_failed($media, $prefix, $ent, $config)) { - cleanup_failed_build($todo_dir, $done_dir, $fail_dir, $prefix, $ent, $arch, $config); + cleanup_failed_build($todo_dir, $done_dir, $fail_dir, $prefix, $ent, $media, $arch, $config); } else { $something_finished = 1; } @@ -408,7 +408,7 @@ foreach my $prefix (keys %pkg_tree) { $pkg_tree{$prefix}{media}{$media}{arch}{$arch} = 0; } - cleanup_failed_build($todo_dir, $done_dir, $fail_dir, $prefix, $ent, $arch, $config); + cleanup_failed_build($todo_dir, $done_dir, $fail_dir, $prefix, $ent, $media, $arch, $config); # Notify user if build failed # |