aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2017-05-18 17:01:51 +0200
committerAndreas Guldstrand <andreas.guldstrand@gmail.com>2017-05-18 17:01:51 +0200
commit74ceb302d143950e02606329cda0fbca70a99985 (patch)
treefdba40dc5422ca24abed1bad3d1d8793d03d42ce
parent15ebf5ad1fd33d451409e9f51d10d32df4a22087 (diff)
downloadsbotools-74ceb302d143950e02606329cda0fbca70a99985.tar.xz
sbofind: add version to result output - This closes #60.
-rwxr-xr-xsbofind5
-rwxr-xr-xt/17-find.t4
2 files changed, 5 insertions, 4 deletions
diff --git a/sbofind b/sbofind
index d9b6dbe..9869ee9 100755
--- a/sbofind
+++ b/sbofind
@@ -13,7 +13,7 @@
use 5.16.0;
use strict;
use warnings FATAL => 'all';
-use SBO::Lib qw/ slackbuilds_or_fetch slurp script_error open_read get_build_queue %config $slackbuilds_txt $repo_path show_version in indent /;
+use SBO::Lib qw/ slackbuilds_or_fetch slurp script_error open_read get_build_queue %config $slackbuilds_txt $repo_path show_version in indent get_from_info /;
use File::Basename;
use Getopt::Long qw(:config bundling);
@@ -159,8 +159,9 @@ if (exists $$findings[0]) {
for my $hash (@$findings) {
my $name = $hash->{name};
my $location = $hash->{location};
+ my $version = get_from_info(LOCATION => $location, GET => 'VERSION')->[0];
my $sbo = "SBo: "; $sbo = "Local: " if $hash->{local};
- say "$sbo $name";
+ say "$sbo $name $version";
say "Path: $location";
say "info: ". get_file_contents("$location/$name.info") if $show_info;
say "README: ". get_file_contents("$location/README") if $show_readme;
diff --git a/t/17-find.t b/t/17-find.t
index 5ea3e74..2be2a56 100755
--- a/t/17-find.t
+++ b/t/17-find.t
@@ -16,14 +16,14 @@ make_slackbuilds_txt();
set_lo("$RealBin/LO");
# 1: basic sbofind testing
-sbofind 'nonexistentslackbuild4', { expected => qr!Local:\s+nonexistentslackbuild4\nPath:\s+\Q$RealBin/LO/nonexistentslackbuild4! };
+sbofind 'nonexistentslackbuild4', { expected => qr!Local:\s+nonexistentslackbuild4 .*\nPath:\s+\Q$RealBin/LO/nonexistentslackbuild4! };
# 2: basic sbofind testing - nothing found
sbofind 'nonexistentslackbuild3', { expected => "Nothing found for search term: nonexistentslackbuild3\n" };
# 3: find something using a tag
replace_tags_txt("nonexistentslackbuild2: testingtag\n");
-sbofind 'testingtag', { expected => qr!Local:\s+nonexistentslackbuild2\nPath:\s+\Q$RealBin/LO/nonexistentslackbuild2! };
+sbofind 'testingtag', { expected => qr!Local:\s+nonexistentslackbuild2 .*\nPath:\s+\Q$RealBin/LO/nonexistentslackbuild2! };
# 4: show build queue
sbofind '-q', 'nonexistentslackbuild2', { expected => qr/Queue:\s+nonexistentslackbuild3 nonexistentslackbuild2/ };