aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Iurt
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Iurt')
-rw-r--r--lib/Iurt/File.pm26
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}}) {