aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Iurt/File.pm51
1 files changed, 32 insertions, 19 deletions
diff --git a/lib/Iurt/File.pm b/lib/Iurt/File.pm
index 71165c6..5029cb8 100644
--- a/lib/Iurt/File.pm
+++ b/lib/Iurt/File.pm
@@ -66,23 +66,32 @@ sub cleanup_failed_build {
my ($todo_dir, $done_dir, $fail_dir, $prefix, $ent, $config) = @_;
my $fatal_failure;
+ my $is_noarch;
my $mandatory_arch = get_mandatory_arch($config, $ent->{target});
my $arch_list = get_target_arch($config, $ent->{target});
+ my @processed_arches;
my @failed_arches;
+
foreach my $arch (@$arch_list, "noarch") {
- if (-f "$done_dir/${prefix}_$arch.fail") {
+ my $prefix_arch = "$done_dir/${prefix}_$arch";
+ if (-f "$prefix_arch.fail") {
+ push @processed_arches, $arch;
push @failed_arches, $arch;
+ $arch eq "noarch" and $is_noarch = 1;
if (member($arch, @$mandatory_arch, "noarch")) {
plog('DEBUG', "failure for mandatory arch $arch, aborting build");
$fatal_failure = 1;
} else {
plog('DEBUG', "failure for non-mandatory arch $arch");
}
+ $arch eq "noarch" and $is_noarch = 1;
+ } elsif (-f "$prefix_arch.done" || -f "$prefix_arch.excluded") {
+ push @processed_arches, $arch;
+ $arch eq "noarch" and $is_noarch = 1;
}
}
- return unless @failed_arches;
-
+ my $all_processed = $is_noarch || (() = sort(@$arch_list)) ~~ (() = sort(@processed_arches));
my ($failed_rpms, $kept_rpms);
if ($fatal_failure) {
$failed_rpms = $ent->{rpms};
@@ -98,28 +107,32 @@ sub cleanup_failed_build {
move($file, "$fail_dir/${prefix}_$rpm");
}
- if (!$fatal_failure) {
+ if ($fatal_failure) {
+ # abort all remaining builds
+ delete $ent->{rpms};
+ } else {
# keep rpms for other architectures
$ent->{rpms} = $kept_rpms;
- return;
}
- # abort all remaining builds
- delete $ent->{rpms};
-
- foreach my $srpm (@{$ent->{srpms}}) {
- my $file = "$todo_dir/${prefix}_$srpm";
- plog('DEBUG', "moving $file to $fail_dir/");
- move($file, "$fail_dir/${prefix}_$srpm");
- # 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;
- }
+ if ($fatal_failure || (@failed_arches && $all_processed)) {
+ # no need to keep the src.rpm in todo, move it to fail
+ foreach my $srpm (@{$ent->{srpms}}) {
+ my $file = "$todo_dir/${prefix}_$srpm";
+ plog('DEBUG', "moving $file to $fail_dir/");
+ move($file, "$fail_dir/${prefix}_$srpm");
+ if ($fatal_failure) {
+ # 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;
+ }
+ }
+ }
}
- if (-d "$done_dir/$prefix") {
+ if ($fatal_failure && -d "$done_dir/$prefix") {
make_path("$fail_dir/$prefix");
foreach my $file (glob "$done_dir/$prefix/*") {
plog('DEBUG', "moving $file to $fail_dir/$prefix/");