From cdfb56c6951da7e44a5a11af9ee85a5bab09dd64 Mon Sep 17 00:00:00 2001 From: xocel Date: Fri, 28 Dec 2012 11:02:57 +1300 Subject: fixed tests --- SBO-Lib/lib/SBO/Lib.pm | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index ded1dac..5844868 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -14,8 +14,8 @@ use strict; use warnings FATAL => 'all'; -package SBO::Lib 1.2; -my $version = '1.2'; +package SBO::Lib; +our $VERSION = '1.2'; require Exporter; our @ISA = qw(Exporter); @@ -39,6 +39,7 @@ our @EXPORT = qw( get_tmp_extfn get_arch get_build_queue + merge_queues $tempdir $conf_dir $conf_file @@ -119,7 +120,7 @@ our $slackbuilds_txt = "$config{SBO_HOME}/SLACKBUILDS.TXT"; my $name_regex = '\ASLACKBUILD\s+NAME:\s+'; sub show_version () { - say "sbotools version $version"; + say "sbotools version $VERSION"; say 'licensed under the WTFPL'; say ''; } @@ -765,3 +766,16 @@ sub get_build_queue { } return \@build_queue; } + +sub merge_queues { + # Usage: merge_queues(\@queue_a, \@queue_b); + # Results in queue_b being merged into queue_a (without duplicates) + exists $_[1] or script_error 'merge_queues requires two arguments.'; + my $queue_a = $_[0]; + my $queue_b = $_[1]; + + for my $item (reverse @$queue_b) { + push @$queue_a, $item unless $item ~~ @$queue_a; + } + return $queue_a; +} \ No newline at end of file -- cgit v1.2.3