From 351f891c10520c9deebb065f8565c6ba3b6a260b Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Fri, 22 Jan 2016 17:55:25 +0000 Subject: Reduce the use of global variables --- ulri | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'ulri') diff --git a/ulri b/ulri index bd677ff..0fc586e 100755 --- a/ulri +++ b/ulri @@ -212,9 +212,6 @@ my $failure = "$config->{queue}/failure"; my $done = "$config->{queue}/done"; my $reject = "$config->{queue}/reject"; -# Raise this when the noarch package starts to build on any bot -my %noarch_build; - # # Part 0: gather data from upload tree # @@ -260,7 +257,7 @@ sub todo_func { if ($arch =~ /noarch/) { plog('DEBUG', "... and $prefix is noarch"); - $noarch_build{$prefix} = 1; + $compildone->{$prefix}{$media}{noarch} = 1; $arch =~ s/-.*//; } @@ -307,7 +304,7 @@ sub done_func { } sub exclude_machine { - my ($host) = @_; + my ($config, $host) = @_; plog('INFO', "Excluding build host $host"); foreach my $arch (keys %{$config->{bot}}) { delete $config->{bot}{$arch}{$host}; @@ -589,10 +586,8 @@ foreach my $prefix (sort keys %pkg_tree) { # need to find a bot for each arch foreach my $arch (@arch_list) { - # Skip this arch if package is building as noarch + # Skip this arch if package is already building as noarch or for this arch # - next if $noarch_build{$prefix}; - next if $compildone->{$prefix}{$media}{noarch}; next if $compildone->{$prefix}{$media}{$arch}; @@ -635,7 +630,7 @@ foreach my $prefix (sort keys %pkg_tree) { # # create also the log dir for botcmd.log if (ssh($remote, "mkdir -p $prefix_dir/log")) { - exclude_machine($host); + exclude_machine($config, $host); next; } my $pkgs; @@ -647,15 +642,14 @@ foreach my $prefix (sort keys %pkg_tree) { $pkgs .= " $prefix_dir/$srpm"; } if (!$ok) { - exclude_machine($host); + exclude_machine($config, $host); next; } # Register that the package is building $run{bot}{$host}{$bot} = $prefix; $compildone->{$prefix}{$media}{$arch} = 1; - # Enable noarch lock after the first bot snarfs the package - $noarch_build{$prefix} = 1 if $noarch; + $compildone->{$prefix}{$media}{noarch} = 1 if $noarch; # spawn remote build bot and save output on local file # (remove status.log before building, otherwise we can have -- cgit v1.2.1