From 59bcfada7cacf4b0cd92029023a4aaf2cf105340 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Thu, 10 Aug 2017 14:22:58 +0200 Subject: xlocate: drop obsolete flag -u Closes #65. --- xlocate | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) (limited to 'xlocate') 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/' -- cgit 1.4.1