aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xemi8
-rw-r--r--lib/Iurt/Emi.pm25
2 files changed, 24 insertions, 9 deletions
diff --git a/emi b/emi
index 72c3f7d..3726495 100755
--- a/emi
+++ b/emi
@@ -32,7 +32,7 @@ use Iurt::Config qw(config_usage config_init);
use Iurt::Process qw(check_pid);
use Iurt::Queue qw(get_upload_tree_state);
use Iurt::Util qw(plog_init plog);
-use Iurt::Emi qw(find_prefixes_ready_to_upload upload_prefix_in_media);
+use Iurt::Emi qw(find_prefixes_ready_to_upload record_uploaded_packages upload_prefix_in_media);
use MDK::Common qw(cat_ touch);
my %run;
@@ -135,6 +135,12 @@ foreach my $target (keys %targets) {
foreach my $prefix (keys %is_finisher) {
upload_prefix_in_media($config, \%pkg_tree, $prefix, $media, 1);
}
+
+ # Now that the finishers are done, metadata was updated so the packages are available
+ foreach my $prefix (@{$targets{$target}{$media}{to_upload}}) {
+ my $path = $pkg_tree{$prefix}{media}{$media}{path};
+ record_uploaded_packages($config, \%pkg_tree, $prefix, $media) unless -f "$reject/$path/$prefix.youri";;
+ }
}
}
diff --git a/lib/Iurt/Emi.pm b/lib/Iurt/Emi.pm
index 6a8ea8e..f35d0ec 100644
--- a/lib/Iurt/Emi.pm
+++ b/lib/Iurt/Emi.pm
@@ -13,6 +13,7 @@ use strict;
our @EXPORT = qw(
find_prefixes_ready_to_upload
+ record_uploaded_packages
upload_prefix_in_media
);
@@ -160,14 +161,6 @@ sub upload_prefix_in_media {
plog('DEBUG', "running $command");
if (!system($command)) {
plog('INFO', "upload succeeded");
- my %arches;
- foreach my $pkg (@packages) {
- my ($arch) = $pkg =~ /\.([^.]*)\.rpm$/;
- $arches{$arch} = 1 unless $arch eq 'src';
- }
- # Only kee noarch if it's the only architecture
- delete $arches{'noarch'} if 1 < keys %arches;
- append_to_file("$done/$path/$prefix.upload", map {"$_\n"} keys %arches);
} else {
# should send a mail or something
plog('ERROR', "upload failed ($!), rejecting files in $reject$path/");
@@ -202,3 +195,19 @@ sub upload_prefix_in_media {
}
}
}
+
+sub record_uploaded_packages {
+ my ($config, $pkg_tree, $prefix, $media) = @_;
+ my $done = "$config->{queue}/done";
+
+ my $youri_file = "$prefix.youri";
+ my $path = $pkg_tree->{$prefix}{media}{$media}{path};
+ my %arches;
+ foreach my $pkg (@{$pkg_tree->{$prefix}{media}{$media}{rpms}}) {
+ my ($arch) = $pkg =~ /\.([^.]*)\.rpm$/;
+ $arches{$arch} = 1 unless $arch eq 'src';
+ }
+ # Only keep noarch if it's the only architecture
+ delete $arches{'noarch'} if 1 < keys %arches;
+ append_to_file("$done/$path/$prefix.upload", map {"$_\n"} keys %arches);
+}