diff options
author | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-04-23 20:59:27 +0200 |
---|---|---|
committer | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-04-23 20:59:27 +0200 |
commit | 217f82f6b6c10e244a43fbc16196cf5107697eb1 (patch) | |
tree | e419e14e6209bb68cc1381fde78a2139ff3e9125 /SBO-Lib/lib | |
parent | 695f85104c7e8b5d78b779276bfeb033ce8682ad (diff) | |
download | sbotools2-217f82f6b6c10e244a43fbc16196cf5107697eb1.tar.xz |
SBO::Lib: get_sbo_locations: No need to open slackbuilds.txt if all sbos already known
Diffstat (limited to 'SBO-Lib/lib')
-rw-r--r-- | SBO-Lib/lib/SBO/Lib.pm | 9 |
1 files changed, 5 insertions, 4 deletions
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; |