aboutsummaryrefslogtreecommitdiff
path: root/SBO-Lib/lib/SBO/Lib.pm
diff options
context:
space:
mode:
authorJ Pipkin <j@dawnrazor.net>2013-03-30 12:28:05 -0500
committerJ Pipkin <j@dawnrazor.net>2013-03-30 12:28:05 -0500
commitdca5f6844883debaa867fca6b68359a5f4ed4e1a (patch)
tree013053f70f3785f1d487a43c6aef38aa71b98600 /SBO-Lib/lib/SBO/Lib.pm
parent1862adcb7db0e27fc2da2f3409f31a8f1fd44c3d (diff)
parent7c90f21cbea304210d113fad4d918cde72cb0eae (diff)
downloadsbotools2-dca5f6844883debaa867fca6b68359a5f4ed4e1a.tar.xz
Merge branch 'queue_order', fixes #53
Diffstat (limited to 'SBO-Lib/lib/SBO/Lib.pm')
-rw-r--r--SBO-Lib/lib/SBO/Lib.pm15
1 files changed, 6 insertions, 9 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm
index 770e300..b34d6f5 100644
--- a/SBO-Lib/lib/SBO/Lib.pm
+++ b/SBO-Lib/lib/SBO/Lib.pm
@@ -924,10 +924,8 @@ sub get_requires($) {
return $$info[0] ne '' ? $info : undef;
}
-# avoid being called to early to check prototype when add_to_queue calls itself
-sub add_to_queue($);
# used by get_build_queue.
-sub add_to_queue($) {
+sub add_to_queue {
my $args = shift;
my $sbo = \${$args}{NAME};
return unless $$sbo;
@@ -957,12 +955,11 @@ sub get_build_queue {
);
add_to_queue(\%args);
}
- # Remove duplicate entries (leaving first occurrence)
- my (%seen, @build_queue);
- FIRST: for my $sb (@$temp_queue) {
- next FIRST if $seen{$sb}++;
- push @build_queue, $sb;
- }
+ # Remove duplicate entries (leaving last occurrence)
+ my @build_queue = reverse @$temp_queue;
+ my %seen;
+ @build_queue = grep {!$seen{$_}++} @build_queue;
+ @build_queue = reverse @build_queue;
return \@build_queue;
}