summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtoru-path23
-rwxr-xr-xtoru-utils2
-rwxr-xr-xtoru-where9
3 files changed, 17 insertions, 17 deletions
diff --git a/toru-path b/toru-path
index 9bfc3ff..7f1d599 100755
--- a/toru-path
+++ b/toru-path
@@ -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}
diff --git a/toru-utils b/toru-utils
index c0918ae..316e6b8 100755
--- a/toru-utils
+++ b/toru-utils
@@ -1,6 +1,4 @@
#!/bin/bash
-#!/bin/bash
-
source /etc/abs.conf
source /etc/libretools.conf
diff --git a/toru-where b/toru-where
index 02a7a88..f732dc0 100755
--- a/toru-where
+++ b/toru-where
@@ -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 $?