aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Iurt/File.pm26
-rwxr-xr-xulri4
2 files changed, 26 insertions, 4 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}}) {
diff --git a/ulri b/ulri
index 334a926..b4230c9 100755
--- a/ulri
+++ b/ulri
@@ -430,7 +430,7 @@ foreach my $prefix (keys %pkg_tree) {
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);
+ cleanup_failed_build($todo_dir, $done_dir, $fail_dir, $prefix, $ent, $arch, $config);
} else {
$something_finished = 1;
}
@@ -492,7 +492,7 @@ foreach my $prefix (keys %pkg_tree) {
$compildone->{$prefix}{$media}{$arch} = 0;
}
- cleanup_failed_build($todo_dir, $done_dir, $fail_dir, $prefix, $ent);
+ cleanup_failed_build($todo_dir, $done_dir, $fail_dir, $prefix, $ent, $arch, $config);
# Notify user if build failed
#