From 1be1c9d62000e1fa7aedce432957e379bdeb305c Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Mon, 25 Apr 2022 14:10:47 +0000 Subject: ulri: rely on status.log to know a build completed This will fix packages not marked as noarch but having only noarch subpackages, even if we still end up wasting resources. The only risk I see is if the noarch packages get built on all mandatory architectures first, upload starts and other architectures complete in hte middle, however this should not modify the files being uploaded, we use a temporary file and rename so it should be fine. --- NEWS | 2 ++ lib/Iurt/Emi.pm | 3 ++- ulri | 41 +++++++++++++++++++---------------------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/NEWS b/NEWS index ad64f1a..b1a2682 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ - iurt: record the list of generated packages - iurt: allow generated src.rpm to have a different name, some packages use macros for Name and those can change based on the distro version. +- ulri: rely on status.log to know a build completed rather than having + packages of the right architecture. 0.7.16 - iurt: use --target noarch for noarch packages rather than the arch used to diff --git a/lib/Iurt/Emi.pm b/lib/Iurt/Emi.pm index ee87526..bf76a64 100644 --- a/lib/Iurt/Emi.pm +++ b/lib/Iurt/Emi.pm @@ -152,7 +152,8 @@ sub upload_prefix_in_media { plog('OK', " uploading $rpm in $done/$path"); } - # This should not happen :( + # When a package is not marked as noarch but only has noarch subpackages, there will be nothing + # left to upload when it finishes building on non mandaory arch. return unless @packages; my $command = generate_upload_command($prefix, $media, $target, $user, \@packages, $o_finish, "$done$path/$youri_file"); diff --git a/ulri b/ulri index 7f61efb..aa6bf1f 100755 --- a/ulri +++ b/ulri @@ -322,6 +322,7 @@ foreach my $prefix (keys %pkg_tree) { my $fail; my $later; + my $done; # Check if the build bot finished on the other side # @@ -338,18 +339,20 @@ foreach my $prefix (keys %pkg_tree) { if ($r ne 'ok') { plog('FAIL', "$r: $p"); $fail = 1; + } else { + plog('OK', "build complete: $p"); + $done = 1; } } - if (!$fail && !$later) { + if ($done) { my @list = split "\n", sout($remote, "ls $prefix_dir"); my $error; - my $done; my $arch_check = join '|', $arch, if_($untranslated_arch{$arch}, @{$untranslated_arch{$arch}}); plog('MSG', "checking for $arch_check arch"); foreach my $result (@list) { - $result =~ /\.(src|$arch_check|noarch)\.rpm$/ or next; + $result =~ /\.rpm$/ or next; # do not copy the initial src package $result =~ /^$prefix/ and next; @@ -357,10 +360,6 @@ foreach my $prefix (keys %pkg_tree) { my $result_file = "$done_dir/${prefix}_$result"; plog('OK', "build ok: $result"); - if ($result =~ /\.$arch_check\.rpm$/) { - $done = 1; - } - plog('DEBUG', "copy files to done"); make_path($done_dir); if (sget($remote, "$prefix_dir/$result", @@ -378,22 +377,20 @@ foreach my $prefix (keys %pkg_tree) { } next if $error; - if ($done) { - if (check_if_mandatory_arch_failed($media, $ent, $config)) { - # Discard this arch as another mandatory one failed - cleanup_failed_build($todo_dir, $done_dir, $fail_dir, $prefix, $ent, $media, $arch, $config); - } else { - create_file("$done_dir/${prefix}_$arch.done", "$bot $host"); - $pkg_tree{$prefix}{media}{$media}{done_arch}{$arch} = 1; - make_path("$done_dir/$prefix"); - sget($remote, "$prefix_dir/log/*", "$done_dir/$prefix"); - $something_finished = 1; - } - # Either we already fetched the success logs, or don't care - # as this success was discarded due to another failure. - ssh($remote, "rm -rf $prefix_dir"); - next bot; + if (check_if_mandatory_arch_failed($media, $ent, $config)) { + # Discard this arch as another mandatory one failed + cleanup_failed_build($todo_dir, $done_dir, $fail_dir, $prefix, $ent, $media, $arch, $config); + } else { + create_file("$done_dir/${prefix}_$arch.done", "$bot $host"); + $pkg_tree{$prefix}{media}{$media}{done_arch}{$arch} = 1; + make_path("$done_dir/$prefix"); + sget($remote, "$prefix_dir/log/*", "$done_dir/$prefix"); + $something_finished = 1; } + # Either we already fetched the success logs, or don't care + # as this success was discarded due to another failure. + ssh($remote, "rm -rf $prefix_dir"); + next bot; } make_path($fail_dir); -- cgit v1.2.1