diff options
Diffstat (limited to 'SBO-Lib/lib')
-rw-r--r-- | SBO-Lib/lib/SBO/Lib.pm | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index c8b844c..24fae5f 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -733,12 +733,12 @@ sub add_to_queue ($) { my $args = shift; my $sbo = \${$args}{NAME}; return unless $$sbo; - push(@{$args}{QUEUE}, $$sbo); + unshift @$args{QUEUE}, $$sbo; my $location = get_sbo_location $$sbo; return unless $location; my $requires = get_from_info (LOCATION => $location, GET => 'REQUIRES'); - for my $req (@$requires) { - next if $req eq $$sbo; + FIRST: for my $req (@$requires) { + next FIRST if $req eq $$sbo; if ($req eq "%README%") { ${$args}{WARNINGS}{$$sbo}="%README%"; } else { @@ -752,20 +752,19 @@ sub add_to_queue ($) { sub get_build_queue ($$) { exists $_[1] or script_error 'get_build_queue requires two arguments.'; my ($sbos, $warnings) = @_; - state $temp_queue = ['']; - my @build_queue; + state $temp_queue = [()]; for my $sbo (@$sbos) { my %args = ( - QUEUE => \@temp_queue, + QUEUE => $temp_queue,, NAME => $sbo, WARNINGS => $warnings ); add_to_queue(\%args); } # Remove duplicate entries (leaving first occurrence) - my %seen; - for my $sb( reverse(@temp_queue) ) { - next if $seen{ $sb }++; + my (%seen, @build_queue); + FIRST: for my $sb (@$temp_queue) { + next FIRST if $seen{$sb}++; push @build_queue, $sb; } return \@build_queue; |