From 217f82f6b6c10e244a43fbc16196cf5107697eb1 Mon Sep 17 00:00:00 2001 From: Andreas Guldstrand Date: Sat, 23 Apr 2016 20:59:27 +0200 Subject: SBO::Lib: get_sbo_locations: No need to open slackbuilds.txt if all sbos already known --- SBO-Lib/lib/SBO/Lib.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 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 3099c72..620dc50 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -471,16 +471,17 @@ sub get_sbo_locations { script_error('get_sbo_locations requires an argument.') unless @_; my %locations; + + # if an sbo is already in the $store, set the %location for it and filter it out + @sbos = grep { exists $$store{$_} ? ($locations{$_} = $$store{$_}, 0) : 1 } @sbos; + return %locations unless @sbos; + my ($fh, $exit) = open_read($slackbuilds_txt); if ($exit) { warn $fh; exit $exit; } - # if an sbo is already in the $store, set the %location for it and filter it out - @sbos = grep { exists $$store{$_} ? ($locations{$_} = $$store{$_}, 0) : 1 } @sbos; - return %locations unless @sbos; - while (my $line = <$fh>) { my ($loc, $sbo) = $line =~ m!LOCATION:\s+\.(/[^/]+/([^/\n]+))$! or next; -- cgit v1.2.3