From 896b0ac9531b0b3bc2f08989a84eed6733e4328a Mon Sep 17 00:00:00 2001 From: Andreas Guldstrand Date: Wed, 14 Feb 2018 07:01:29 +0100 Subject: Strip -compat32 from slackbuild names and make sure to properly return an array reference This fixes #65 --- SBO-Lib/lib/SBO/Lib/Info.pm | 2 +- SBO-Lib/lib/SBO/Lib/Tree.pm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SBO-Lib/lib/SBO/Lib/Info.pm b/SBO-Lib/lib/SBO/Lib/Info.pm index 1cc0224..60812ab 100644 --- a/SBO-Lib/lib/SBO/Lib/Info.pm +++ b/SBO-Lib/lib/SBO/Lib/Info.pm @@ -180,7 +180,7 @@ C returns the requirements for a given C<$sbo>. # wrapper to pull the list of requirements for a given sbo sub get_requires { my $location = get_sbo_location(shift); - return() unless $location; + return [] unless $location; my $info = get_from_info(LOCATION => $location, GET => 'REQUIRES'); return $info; } diff --git a/SBO-Lib/lib/SBO/Lib/Tree.pm b/SBO-Lib/lib/SBO/Lib/Tree.pm index 49997f6..51dbf2c 100644 --- a/SBO-Lib/lib/SBO/Lib/Tree.pm +++ b/SBO-Lib/lib/SBO/Lib/Tree.pm @@ -76,7 +76,7 @@ filesystem once when searching, and populating the internal cache. =cut sub get_sbo_location { - my @sbos = defined $_[0] && ref $_[0] eq 'ARRAY' ? @{ $_[0] } : @_; + my @sbos = map { s/-compat32$//r } defined $_[0] && ref $_[0] eq 'ARRAY' ? @{ $_[0] } : @_; script_error('get_sbo_location requires an argument.') unless @sbos; # if we already have the location, return it now. @@ -95,7 +95,7 @@ package name to its location. =cut sub get_sbo_locations { - my @sbos = defined $_[0] && ref $_[0] eq 'ARRAY' ? @{ $_[0] } : @_; + my @sbos = map { s/-compat32$//r } defined $_[0] && ref $_[0] eq 'ARRAY' ? @{ $_[0] } : @_; script_error('get_sbo_locations requires an argument.') unless @_; my %locations; -- cgit v1.2.3