diff options
author | Olivier Blin <dev@blino.org> | 2015-11-08 23:26:20 +0100 |
---|---|---|
committer | Olivier Blin <dev@blino.org> | 2015-11-17 00:13:55 +0100 |
commit | 2da58954b3cb4dbd6e24d8ce029175613f532a90 (patch) | |
tree | 98be0028f63b439068832bf9269ae02487cb5321 /lib | |
parent | f429de1f34816962b20b0a3ec23eafe0453fcbd8 (diff) | |
download | iurt-2da58954b3cb4dbd6e24d8ce029175613f532a90.tar iurt-2da58954b3cb4dbd6e24d8ce029175613f532a90.tar.gz iurt-2da58954b3cb4dbd6e24d8ce029175613f532a90.tar.bz2 iurt-2da58954b3cb4dbd6e24d8ce029175613f532a90.tar.xz iurt-2da58954b3cb4dbd6e24d8ce029175613f532a90.zip |
ulri: Keep other builds going when a failure occurs on non-mandatory arch
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Iurt/File.pm | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/Iurt/File.pm b/lib/Iurt/File.pm index 6dc45d2..b91ec2c 100644 --- a/lib/Iurt/File.pm +++ b/lib/Iurt/File.pm @@ -1,9 +1,11 @@ package Iurt::File; use base qw(Exporter); +use Iurt::Config qw(get_mandatory_arch); use File::Copy 'move'; use File::Path 'make_path'; use Iurt::Util qw(plog); +use MDK::Common qw(find member partition); use strict; our @EXPORT = qw( @@ -61,13 +63,33 @@ sub check_upload_tree { } sub cleanup_failed_build { - my ($todo_dir, $done_dir, $fail_dir, $prefix, $ent) = @_; + my ($todo_dir, $done_dir, $fail_dir, $prefix, $ent, $arch, $config) = @_; - foreach my $rpm (@{$ent->{rpms}}) { + my $mandatory_arch = get_mandatory_arch($config, $ent->{target}); + my $fatal_failure = member($arch, @$mandatory_arch) || $arch eq 'noarch'; + + my ($failed_rpms, $kept_rpms); + if ($fatal_failure) { + plog('DEBUG', "failure is for mandatory arch $arch, aborting build"); + $failed_rpms = $ent->{rpms}; + } else { + plog('DEBUG', "failure is for non-mandatory arch $arch, keeping other builds going"); + ($failed_rpms, $kept_rpms) = partition { /\.$arch\.rpm$/ } @{$ent->{rpms}}; + } + + foreach my $rpm (@$failed_rpms) { my $file = "$done_dir/${prefix}_$rpm"; plog('DEBUG', "moving built rpm $file to $fail_dir/"); move($file, "$fail_dir/${prefix}_$rpm"); } + + if (!$fatal_failure) { + # keep rpms for other architectures + $ent->{rpms} = $kept_rpms; + return; + } + + # abort all remaining builds delete $ent->{rpms}; foreach my $srpm (@{$ent->{srpms}}) { |