diff options
author | Jacob Pipkin <j@dawnrazor.net> | 2012-11-01 22:22:18 -0500 |
---|---|---|
committer | Jacob Pipkin <j@dawnrazor.net> | 2012-11-01 22:22:18 -0500 |
commit | 942bfa63aec5bd4cc229f44ffe2e2437374cb091 (patch) | |
tree | bb36545292ec116ed9f2e9e4ed6fd7bbb49607ca | |
parent | cb042eb7a7dcca1fa46859af29a6544cf76294fd (diff) | |
download | sbotools2-942bfa63aec5bd4cc229f44ffe2e2437374cb091.tar.xz |
get_build_queue: take an array ref as first arg, make the temp_queue keep state, changes for clarity
-rw-r--r-- | SBO-Lib/lib/SBO/Lib.pm | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index c7c186b..ae827de 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -754,16 +754,18 @@ sub add_to_queue ($) { # recursively add a sbo's requirements to the build queue. sub get_build_queue ($$) { - unless ($_[0] && $_[1]) { - script_error 'get_build_queue requires two arguments.'; + exists $_[1] or script_error 'get_build_queue requires two arguments.'; + my ($sbos, $warnings) = @_; + state $temp_queue = ['']; + my @build_queue; + for my $sbo (@$sbos) { + my %args = ( + QUEUE => \@temp_queue, + NAME => $sbo, + WARNINGS => $warnings + ); + add_to_queue(\%args); } - my (@temp_queue, @build_queue); - my %args = ( - QUEUE => \@temp_queue, - NAME => $_[0], - WARNINGS => \%{$_[1]} - ); - add_to_queue(\%args); # Remove duplicate entries (leaving first occurrence) my %seen; for my $sb( reverse(@temp_queue) ) { |