aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsbofind2
-rwxr-xr-xt/17-find.t43
-rw-r--r--t/LO-R/R/R.SlackBuild15
-rw-r--r--t/LO-R/R/R.info10
-rw-r--r--t/LO-R/R/README1
-rw-r--r--t/LO-R/bar/README1
-rw-r--r--t/LO-R/bar/bar.SlackBuild15
-rw-r--r--t/LO-R/bar/bar.info10
-rw-r--r--t/LO-R/foo/README1
-rw-r--r--t/LO-R/foo/foo.SlackBuild15
-rw-r--r--t/LO-R/foo/foo.info10
11 files changed, 121 insertions, 2 deletions
diff --git a/sbofind b/sbofind
index 2659076..8424bf1 100755
--- a/sbofind
+++ b/sbofind
@@ -72,7 +72,7 @@ sub perform_search {
script_error 'perform_search requires an argument.' unless @_ == 1;
my $search_arg = shift;
my $search_tag_re = $search_exact ? qr/^(\S+).*(:\s|,)\b\Q$search_arg\E\b(,|$)/i : qr/^(\S+):\s.*\Q$search_arg\E/i;
- my $search_name_re = $search_exact ? qr/\Q$search_arg\E/i : qr/.*\Q$search_arg\E.*/i;
+ my $search_name_re = $search_exact ? qr/^\Q$search_arg\E$/i : qr/.*\Q$search_arg\E.*/i;
# first get a bunch of names from the TAGS.txt if it's available
my $tags_file = "$config{SBO_HOME}/repo/TAGS.txt";
diff --git a/t/17-find.t b/t/17-find.t
index 2be2a56..c911d4c 100755
--- a/t/17-find.t
+++ b/t/17-find.t
@@ -10,7 +10,7 @@ use lib $RealBin;
use Test::Sbotools qw/ make_slackbuilds_txt set_lo sbofind replace_tags_txt set_repo sbosnap /;
use File::Temp 'tempdir';
-plan tests => 7;
+plan tests => 10;
make_slackbuilds_txt();
set_lo("$RealBin/LO");
@@ -41,9 +41,18 @@ cd $tempdir
git init
mkdir -p test
cp -a "$RealBin/LO/nonexistentslackbuild" test/
+cp -a "$RealBin/LO-R/R" test/
+cp -a "$RealBin/LO-R/foo" test/
+cp -a "$RealBin/LO-R/bar" test/
echo "SLACKBUILD NAME: nonexistentslackbuild" > SLACKBUILDS.TXT
echo "SLACKBUILD FOO: bar" >> SLACKBUILDS.TXT
echo "SLACKBUILD LOCATION: ./test/nonexistentslackbuild" >> SLACKBUILDS.TXT
+echo "SLACKBUILD NAME: R" >> SLACKBUILDS.TXT
+echo "SLACKBUILD LOCATION: ./test/R" >> SLACKBUILDS.TXT
+echo "SLACKBUILD NAME: foo" >> SLACKBUILDS.TXT
+echo "SLACKBUILD LOCATION: ./test/foo" >> SLACKBUILDS.TXT
+echo "SLACKBUILD NAME: bar" >> SLACKBUILDS.TXT
+echo "SLACKBUILD LOCATION: ./test/bar" >> SLACKBUILDS.TXT
git add test SLACKBUILDS.TXT
git commit -m 'initial'
GIT
@@ -52,3 +61,35 @@ set_lo('FALSE');
sbosnap 'fetch', { test => 0, note => 1 };
sbofind 'nonexistentslackbuild', { expected => qr!\Q/usr/sbo/repo/test/nonexistentslackbuild! };
+
+replace_tags_txt("R: r\nfoo: r\nbar: rar");
+
+# 8: non-restricted search finds a lot
+sbofind qw/R/, { expected => <<"END" };
+SBo: R 1.0
+Path: /usr/sbo/repo/test/R
+
+SBo: foo 1.0
+Path: /usr/sbo/repo/test/foo
+
+SBo: bar 1.0
+Path: /usr/sbo/repo/test/bar
+
+END
+
+# 9: checking for exact matches (including tags)
+sbofind qw/ -e R /, { expected => <<"END" };
+SBo: R 1.0
+Path: /usr/sbo/repo/test/R
+
+SBo: foo 1.0
+Path: /usr/sbo/repo/test/foo
+
+END
+
+# 10: exact matches (excluding tags)
+sbofind qw/ -et R /, { expected => <<"END" };
+SBo: R 1.0
+Path: /usr/sbo/repo/test/R
+
+END
diff --git a/t/LO-R/R/R.SlackBuild b/t/LO-R/R/R.SlackBuild
new file mode 100644
index 0000000..0ba406f
--- /dev/null
+++ b/t/LO-R/R/R.SlackBuild
@@ -0,0 +1,15 @@
+#!/bin/bash
+PRGNAM="R"
+VERSION=${VERSION:-1.0}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+TMP=${TMP:-/tmp/SBo}
+OUTPUT=${OUTPUT:-/tmp}
+
+mkdir -p $TMP/$PRGNAM-$VERSION
+cp README $TMP/$PRGNAM-$VERSION
+mkdir -p $OUTPUT/package-$PRGNAM/usr/doc/$PRGNAM-$VERSION
+cp README $OUTPUT/package-$PRGNAM/usr/doc/$PRGNAM-$VERSION
+cd $OUTPUT/package-$PRGNAM
+
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-noarch-$BUILD$TAG.tgz
diff --git a/t/LO-R/R/R.info b/t/LO-R/R/R.info
new file mode 100644
index 0000000..bfd1964
--- /dev/null
+++ b/t/LO-R/R/R.info
@@ -0,0 +1,10 @@
+PRGNAM="R"
+VERSION="1.0"
+HOMEPAGE="http://www.example.com"
+DOWNLOAD="http://pink-mist.github.io/sbotools/testing/perf.dummy"
+MD5SUM="9cba6c70fb57a22a155073d54748b614"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Andreas Guldstrand"
+EMAIL="doesnt@matter.org"
diff --git a/t/LO-R/R/README b/t/LO-R/R/README
new file mode 100644
index 0000000..6d388bb
--- /dev/null
+++ b/t/LO-R/R/README
@@ -0,0 +1 @@
+This doesn't exist!
diff --git a/t/LO-R/bar/README b/t/LO-R/bar/README
new file mode 100644
index 0000000..6d388bb
--- /dev/null
+++ b/t/LO-R/bar/README
@@ -0,0 +1 @@
+This doesn't exist!
diff --git a/t/LO-R/bar/bar.SlackBuild b/t/LO-R/bar/bar.SlackBuild
new file mode 100644
index 0000000..f73714a
--- /dev/null
+++ b/t/LO-R/bar/bar.SlackBuild
@@ -0,0 +1,15 @@
+#!/bin/bash
+PRGNAM="bar"
+VERSION=${VERSION:-1.0}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+TMP=${TMP:-/tmp/SBo}
+OUTPUT=${OUTPUT:-/tmp}
+
+mkdir -p $TMP/$PRGNAM-$VERSION
+cp README $TMP/$PRGNAM-$VERSION
+mkdir -p $OUTPUT/package-$PRGNAM/usr/doc/$PRGNAM-$VERSION
+cp README $OUTPUT/package-$PRGNAM/usr/doc/$PRGNAM-$VERSION
+cd $OUTPUT/package-$PRGNAM
+
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-noarch-$BUILD$TAG.tgz
diff --git a/t/LO-R/bar/bar.info b/t/LO-R/bar/bar.info
new file mode 100644
index 0000000..60cf3df
--- /dev/null
+++ b/t/LO-R/bar/bar.info
@@ -0,0 +1,10 @@
+PRGNAM="bar"
+VERSION="1.0"
+HOMEPAGE="http://www.example.com"
+DOWNLOAD="http://pink-mist.github.io/sbotools/testing/perf.dummy"
+MD5SUM="9cba6c70fb57a22a155073d54748b614"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Andreas Guldstrand"
+EMAIL="doesnt@matter.org"
diff --git a/t/LO-R/foo/README b/t/LO-R/foo/README
new file mode 100644
index 0000000..6d388bb
--- /dev/null
+++ b/t/LO-R/foo/README
@@ -0,0 +1 @@
+This doesn't exist!
diff --git a/t/LO-R/foo/foo.SlackBuild b/t/LO-R/foo/foo.SlackBuild
new file mode 100644
index 0000000..0b3c318
--- /dev/null
+++ b/t/LO-R/foo/foo.SlackBuild
@@ -0,0 +1,15 @@
+#!/bin/bash
+PRGNAM="foo"
+VERSION=${VERSION:-1.0}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+TMP=${TMP:-/tmp/SBo}
+OUTPUT=${OUTPUT:-/tmp}
+
+mkdir -p $TMP/$PRGNAM-$VERSION
+cp README $TMP/$PRGNAM-$VERSION
+mkdir -p $OUTPUT/package-$PRGNAM/usr/doc/$PRGNAM-$VERSION
+cp README $OUTPUT/package-$PRGNAM/usr/doc/$PRGNAM-$VERSION
+cd $OUTPUT/package-$PRGNAM
+
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-noarch-$BUILD$TAG.tgz
diff --git a/t/LO-R/foo/foo.info b/t/LO-R/foo/foo.info
new file mode 100644
index 0000000..d8cf9dd
--- /dev/null
+++ b/t/LO-R/foo/foo.info
@@ -0,0 +1,10 @@
+PRGNAM="foo"
+VERSION="1.0"
+HOMEPAGE="http://www.example.com"
+DOWNLOAD="http://pink-mist.github.io/sbotools/testing/perf.dummy"
+MD5SUM="9cba6c70fb57a22a155073d54748b614"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Andreas Guldstrand"
+EMAIL="doesnt@matter.org"