diff options
author | Pascal Terjan <pterjan@mageia.org> | 2019-11-02 11:17:36 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@mageia.org> | 2019-11-02 11:17:36 +0000 |
commit | 689de43220800a71cdb80ac03b7c38fe6e0fe8e2 (patch) | |
tree | 83bd6cde4092365e358322c138d6c9dd20fc0ec4 /lib | |
parent | 3a8b9560ccd568a1b1e97990a0b3da3f58b5d244 (diff) | |
download | iurt-689de43220800a71cdb80ac03b7c38fe6e0fe8e2.tar iurt-689de43220800a71cdb80ac03b7c38fe6e0fe8e2.tar.gz iurt-689de43220800a71cdb80ac03b7c38fe6e0fe8e2.tar.bz2 iurt-689de43220800a71cdb80ac03b7c38fe6e0fe8e2.tar.xz iurt-689de43220800a71cdb80ac03b7c38fe6e0fe8e2.zip |
emi: Fix bug introduce in previous commit
It moved the creation of .upload too early, potentially before
metadata was updated when several packages were uploaded at once.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Iurt/Emi.pm | 25 |
1 files changed, 17 insertions, 8 deletions
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); +} |