diff options
-rwxr-xr-x | toru-path | 23 | ||||
-rwxr-xr-x | toru-utils | 2 | ||||
-rwxr-xr-x | toru-where | 9 |
3 files changed, 17 insertions, 17 deletions
@@ -2,22 +2,30 @@ source $(dirname $(command -v $0))/toru-utils +TORUPATH=${T:-${TORUPATH}} + if [ ! -w "$TORUPATH" ]; then error "Toru's path isn't writable. Please check $TORUPATH" exit 1 fi LASTSYNCFILE=${TORUPATH}/lastsync.paths +PATHFILE=${TORUPATH}/paths.tch + +if [ ! -e "${PATHFILE}" ]; then + tcamgr create "${PATHFILE}" +fi # TODO pass other paths via flags -pkgbuilds=($(get_pkgbuilds ${ABSROOT})) -paths=() +# ABSROOT has trailing slash +fullrepos=($(for _repo in ${REPOS[@]}; do echo "${ABSROOT}${_repo}"; done)) +pkgbuilds=($(get_pkgbuilds ${fullrepos[@]})) msg "Updating path cache" msg2 "${#pkgbuilds[@]} PKGBUILDs to update" for _pkgbuild in ${pkgbuilds[@]}; do - $DEBUG && plain "$_pkgbuild" - source ${_pkgbuild} || { +# plain "$_pkgbuild" + source ${_pkgbuild} >/dev/null 2>&1 || { error "${_pkgbuild} contains errors, skipping" continue } @@ -25,15 +33,10 @@ for _pkgbuild in ${pkgbuilds[@]}; do fullpath=$(dirname ${_pkgbuild}) for _pkg in ${pkgbase} ${pkgname[@]} ${provides[@]}; do - paths+=(${_pkg/[<>=]*}:${fullpath}) + tcamgr put ${PATHFILE} ${_pkg/[<>=]*} ${fullpath} done unset pkgbase pkgname provides done - -# TODO remove old paths -# by joining new paths to old paths and exclude the joining points from the -# cache (sort of a sql join) -echo ${paths[@]} | tr ' ' "\n" | sort >> ${TORUPATH}/paths lastsync ${LASTSYNCFILE} @@ -1,6 +1,4 @@ #!/bin/bash -#!/bin/bash - source /etc/abs.conf source /etc/libretools.conf @@ -1,11 +1,10 @@ #!/bin/bash # Locates a PKGBUILD dir on toru's path cache -source $(dirname $(command -v $0))/toru-utils +source /etc/libretools.conf -# Look in all cached but pick the last one -grep "^${1}:" "${TORUPATH}/paths" 2>/dev/null| \ - tail -n1 2>/dev/null|\ - cut -d: -f2 2>/dev/null +PATHFILE=${TORUPATH}/paths.tch + +exec tcamgr get ${PATHFILE} $1 exit $? |