diff options
Diffstat (limited to 'SBO-Lib/lib/SBO/Lib.pm')
-rw-r--r-- | SBO-Lib/lib/SBO/Lib.pm | 20 |
1 files changed, 17 insertions, 3 deletions
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 '<http://sam.zoy.org/wtfpl/COPYING>'; } @@ -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 |