sbotools2

Maintenance fork of the original sbotools version 2
Log | Files | Refs | README

commit 217f82f6b6c10e244a43fbc16196cf5107697eb1
parent 695f85104c7e8b5d78b779276bfeb033ce8682ad
Author: Andreas Guldstrand <andreas.guldstrand@gmail.com>
Date:   Sat, 23 Apr 2016 20:59:27 +0200

SBO::Lib: get_sbo_locations: No need to open slackbuilds.txt if all sbos already known

Diffstat:
MSBO-Lib/lib/SBO/Lib.pm | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git 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;