aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Pipkin <j@dawnrazor.net>2012-06-05 21:18:40 -0500
committerJacob Pipkin <j@dawnrazor.net>2012-06-05 21:18:40 -0500
commitda7a0ae64572ce945820934a10e78fbd1e67900e (patch)
tree650b18aaa7e172a9e431a1c6dcbf83c3e090b8d3
parent004265df979938f0f43e597f0243cc746d899033 (diff)
downloadsbotools2-da7a0ae64572ce945820934a10e78fbd1e67900e.tar.xz
reduced extra code in sbofind, seems to also be faster? huh.
-rwxr-xr-xsbofind11
1 files changed, 4 insertions, 7 deletions
diff --git a/sbofind b/sbofind
index 999801a..f431e6c 100755
--- a/sbofind
+++ b/sbofind
@@ -50,21 +50,18 @@ slackbuilds_or_fetch ();
# find anything with $search in its name
my (@findings, $name);
my $found = 'FALSE';
-my $regex = qr/NAME:\s.*\Q$search\E.*/i;
+my $name_regex = qr/NAME:\s+(.*\Q$search\E.*)$/i;
+my $loc_regex = qr/LOCATION:\s+(.*)$/;
my $fh = open_read ("$config{SBO_HOME}/SLACKBUILDS.TXT");
FIRST: while (my $line = <$fh>) {
unless ($found eq 'TRUE') {
- if ($line =~ $regex) {
+ if ($name = ($line =~ $name_regex)[0]) {
$found = 'TRUE';
- my @split = split (' ', $line);
- chomp ($name = $split[2]);
next FIRST;
}
} else {
- if ($line =~ /LOCATION/) {
+ if (my ($location) = ($line =~ $loc_regex)[0]) {
$found = 'FALSE';
- my @split = split (' ', $line);
- chomp (my $location = $split[2]);
$location =~ s#^\.##;
push (@findings, {$name => $config{SBO_HOME} . $location} );
}