From 5c54fa4c92a717168d6af76819bb4cd178946e1f Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Sun, 8 Nov 2015 18:01:04 +0000 Subject: Keep src.rpm until all archs are done --- emi | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/emi b/emi index 1ee4cba..0b127e6 100755 --- a/emi +++ b/emi @@ -253,7 +253,7 @@ sub upload_prefix_in_section { my $path = $pkg_tree{$prefix}{section}{$section}{path}; - plog('OK', "all archs done: $prefix"); + plog('OK', "all mandatory archs done: $prefix"); foreach my $rpm (@{$pkg_tree{$prefix}{section}{$section}{rpms}}) { push @packages, "$done/$path/${prefix}_$rpm"; plog('OK', " uploading $rpm in $done/$path"); @@ -293,14 +293,24 @@ sub upload_prefix_in_section { # delete the files which should have heen either put in queue or rejected unlink(@packages); - # keep the log file for debugging - # unlink("$done/$path/$prefix.youri"); - - # unlink the sources rpm, other arch will be able to grab it into - # the repository - foreach (@{$pkg_tree{$prefix}{todo}}) { - plog('DEBUG', "unlink $todo/$path/${prefix}_$_"); - unlink("$todo/$path/${prefix}_$_"); + # unlink the sources rpm unless some non mandatory arch still need to be done + my $all_done = 1; + if (!defined($pkg_tree{$prefix}{section}{$section}{arch}{noarch})) { + my $arch_list = find { ref($_) eq 'ARRAY' } $config->{arch}, (ref($config->{arch}) eq 'HASH' ? ($config->{arch}{$target}, $config->{arch}{default}) : ()); + my @arch_list = $arch_list ? @$arch_list : keys %{$config->{bot}}; + # If we are here, mandatory arches are done, no need to check them + my $mandatory_arch = find { ref($_) eq 'ARRAY' } $config->{mandatory_arch}, + (ref($config->{mandatory_arch}) eq 'HASH' ? ($config->{mandatory_arch}{$target}, $config->{mandatory_arch}{default}) : ()), []; + foreach my $arch (difference2(@arch_list, $mandatory_arch)) { + next if $pkg_tree{$prefix}{section}{$section}{arch}{$arch}; + $all_done = 0; + } + } + if ($all_done) { + foreach (@{$pkg_tree{$prefix}{todo}}) { + plog('DEBUG', "unlink $todo/$path/${prefix}_$_"); + unlink("$todo/$path/${prefix}_$_"); + } } } -- cgit v1.2.1