From e90b0acc99db5067807cfbd9c6c2e973f979c118 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Thu, 8 Mar 2012 15:56:00 +0000 Subject: Really fix the race, collect .done before .rpm, as some may arrive between the two traversals --- emi | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'emi') diff --git a/emi b/emi index 90a327b..0270b0e 100755 --- a/emi +++ b/emi @@ -117,6 +117,7 @@ my $reject = "$config->{queue}/rejected"; my %pkg_tree; my %excluded; +my %archdone; # @@ -128,17 +129,9 @@ sub done_func { my $section = "$m/$s"; - if ($r =~ /(\d{14}\.\w+\.\w+\.\d+)_(.*\.([^.]+)\.rpm)$/) { - my ($prefix, $rpm, $arch) = ($1, $2, $3); - $arch = $config->{arch_translation}{$arch} if $config->{arch_translation}{$arch}; - plog('DEBUG', "found rpm $rpm ($prefix) for section $section"); - $pkg_tree{$prefix}{target} = $f; - $pkg_tree{$prefix}{section}{$section}{path} = "/$f/$m/$s"; - if ($arch eq 'src') { - push @{$pkg_tree{$prefix}{section}{$section}{srpms}}, $rpm; - $pkg_tree{$prefix}{section}{$section}{arch}{src} = 1; - } - push @{$pkg_tree{$prefix}{section}{$section}{rpms}} , $rpm; + if ($r =~ /(\d{14}\.\w+\.\w+\.\d+)_(.*)\.done$/) { + my ($prefix, $arch) = ($1, $2); + $archdone{$prefix}{$section}{$arch} = 1; } elsif ($r =~ /(\d{14}\.\w+\.\w+\.\d+)_(.*)\.excluded$/) { my ($prefix, $arch) = ($1, $2); $arch = $config->{arch_translation}{$arch} if $config->{arch_translation}{$arch}; @@ -150,12 +143,19 @@ sub done_func { sub done_post { my ($_todo, $f, $m, $s, $r) = @_; my $section = "$m/$s"; - if ($r =~ /(\d{14}\.\w+\.\w+\.\d+)_(.*)\.done$/) { - my ($prefix, $arch) = ($1, $2); - if (defined($pkg_tree{$prefix})) { - plog('DEBUG', "found .done ($prefix, $arch)"); + if ($r =~ /(\d{14}\.\w+\.\w+\.\d+)_(.*\.([^.]+)\.rpm)$/) { + my ($prefix, $rpm, $arch) = ($1, $2, $3); + $arch = $config->{arch_translation}{$arch} if $config->{arch_translation}{$arch}; + plog('DEBUG', "found rpm $rpm ($prefix) for section $section"); + $pkg_tree{$prefix}{target} = $f; + $pkg_tree{$prefix}{section}{$section}{path} = "/$f/$m/$s"; + if ($arch eq 'src') { + push @{$pkg_tree{$prefix}{section}{$section}{srpms}}, $rpm; + $pkg_tree{$prefix}{section}{$section}{arch}{src} = 1; + } elsif ($archdone{$prefix}{$section}{$arch}) { $pkg_tree{$prefix}{section}{$section}{arch}{$arch} = 1; } + push @{$pkg_tree{$prefix}{section}{$section}{rpms}} , $rpm; } } -- cgit v1.2.1