about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--README8
-rw-r--r--_xtools2
-rwxr-xr-xxlocate31
-rw-r--r--xtools.14
4 files changed, 11 insertions, 34 deletions
diff --git a/README b/README
index 3e4c268..7cc4345 100644
--- a/README
+++ b/README
@@ -52,10 +52,9 @@ COMMANDS
 
      xlint template – scan XBPS template for common mistakes
 
-     xlocate [-u | -g | -S | pattern] – locate files in all XBPS packages
+     xlocate [-g | -S | pattern] – locate files in all XBPS packages
        -g  Update a git based xlocate database
        -S  Sync with the official git based xlocate database
-       -u  Update a find based xlocate database (obsolete)
 
      xlog pkg – open commit log for XBPS template
 
@@ -124,9 +123,10 @@ LICENSE
      To the extent possible under law, the creator of this work has waived all
      copyright and related or neighboring rights to this work.
 
-     http://creativecommons.org/publicdomain/zero/1.0/
+           http://creativecommons.org/publicdomain/zero/1.0/
 
 BUGS
-     All bugs should be reported to https://github.com/chneukirchen/xtools
+     All bugs should be reported to
+           https://github.com/chneukirchen/xtools
 
 Void Linux                        May 2, 2017                       Void Linux
diff --git a/_xtools b/_xtools
index e0063d2..ce3ba4b 100644
--- a/_xtools
+++ b/_xtools
@@ -65,7 +65,7 @@ _xilog() {
 
 _xlocate() {
 	_arguments : \
-		'-u[update xlocate.db]' \
+		'-S[sync with official xlocate.git]' \
 		'-g[update xlocate.git]' \
 		'1::pattern: '
 }
diff --git a/xlocate b/xlocate
index 894ab6e..2da6641 100755
--- a/xlocate
+++ b/xlocate
@@ -1,7 +1,6 @@
 #!/bin/sh
-# xlocate [-u | -g | -S | PATTERN] - locate files in all XBPS packages
+# xlocate [-g | -S | PATTERN] - locate files in all XBPS packages
 
-: ${XLOCATE_DB:=~/.cache/xlocate.db}
 : ${XLOCATE_GIT:=~/.cache/xlocate.git}
 : ${XLOCATE_REPO:=https://repo.voidlinux.eu/xlocate/xlocate.git}
 
@@ -11,14 +10,6 @@ else
 	PROGRESS=cat
 fi
 
-xupdatedb() {
-	echo "xlocate: reindexing database..." 1>&2
-	xbps-query -Ro '*' |
-		$PROGRESS |
-		sed 's/ *([^)]*)$//; s|: ||; s,^,/,' |
-		/usr/libexec/frcode >"$XLOCATE_DB"
-}
-
 xupdategit() {
 	set -e
 	DIR=$(mktemp -dt xlocate.XXXXXX)
@@ -54,15 +45,15 @@ xsyncgit() {
 	git -C "$XLOCATE_GIT" fetch -u -f "$XLOCATE_REPO" master:master
 }
 
-if [ "$1" = -u ]; then
-	xupdatedb
-	exit $?
-elif [ "$1" = -g ]; then
+if [ "$1" = -g ]; then
 	xupdategit
 	exit $?
 elif [ "$1" = -S ]; then
 	xsyncgit
 	exit $?
+else
+	echo "xlocate: invalid option '$1'" 1>&2
+	exit 1
 fi
 
 if [ -d "$XLOCATE_GIT" ]; then
@@ -80,18 +71,6 @@ if [ -d "$XLOCATE_GIT" ]; then
 	fi
 	git -c grep.lineNumber=false --git-dir="$XLOCATE_GIT" grep "$@" @ |
 		sed 's/^@://; s/:/\t/' | grep .
-elif [ -e "$XLOCATE_DB" ]; then
-	if find /var/db/xbps/ -name '*repodata' -newer "$XLOCATE_DB" | grep -q .; then
-		echo "xlocate: database outdated, please run xlocate -u." 1>&2
-	fi
-	rx=
-	case "$1" in
-		# Just . is unlikely to be a regex here...
-		*[*+\\\[\]^$]*) rx=-r;;
-	esac
-	# XXX also matches template in package name.
-	glocate $rx -d "$XLOCATE_DB" "$1" |
-		sed 's|^/\([^/]*\)-[^-/]*/|\1\t/|'
 else
 	xbps-query --regex -Ro "$@" |
 		sed 's/ *([^)]*)$//; s/^\([^ ]*\)-[^-]*: /\1\t/'
diff --git a/xtools.1 b/xtools.1
index e894566..1dcd8c9 100644
--- a/xtools.1
+++ b/xtools.1
@@ -108,7 +108,7 @@ replace checksum in-place
 .Pp
 .Nm xlocate
 .Oo
-.Fl u | g | S |
+.Fl g | S |
 .Ar pattern
 .Oc
 .Nd locate files in all XBPS packages
@@ -117,8 +117,6 @@ replace checksum in-place
 Update a git based xlocate database
 .It Fl S
 Sync with the official git based xlocate database
-.It Fl u
-Update a find based xlocate database (obsolete)
 .El
 .Pp
 .Nm xlog