summaryrefslogtreecommitdiff
path: root/src/toru/toru-path
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-11-07 15:06:55 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-11-07 15:06:55 -0300
commit73b813613aa08646515f4e06c71503b18125cec3 (patch)
tree5b98b01f1c331692e2dcae4fd4f6fb4e4a7064df /src/toru/toru-path
parent6c14fad1750b4342b5b283e0851c00e3c074a15c (diff)
parent040111e9d8419456255816600784a496febd57b0 (diff)
Merge branch 'master' of git://gitorious.org/parabola/libretools
Diffstat (limited to 'src/toru/toru-path')
-rwxr-xr-xsrc/toru/toru-path50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/toru/toru-path b/src/toru/toru-path
new file mode 100755
index 0000000..baeaeb5
--- /dev/null
+++ b/src/toru/toru-path
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+source $(dirname $(command -v $0))/toru-utils
+
+TORUPATH=${T:-${TORUPATH}}
+VERBOSE=${V:-false}
+
+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
+# ABSROOT has trailing slash
+fullrepos=()
+for (( i = ${#REPOS[@]}-1 ; i >= 0 ; i-- )); do
+ ${VERBOSE} && msg "Processing [%s]" ${REPOS[$i]}
+
+ [ -d "${ABSROOT}${REPOS[$i]}" ] && \
+ fullrepos+=("${ABSROOT}${REPOS[$i]}")
+done
+pkgbuilds=($(get_pkgbuilds ${fullrepos[@]}))
+
+msg "Updating path cache"
+msg2 "${#pkgbuilds[@]} PKGBUILDs to update"
+for _pkgbuild in ${pkgbuilds[@]}; do
+# plain "$_pkgbuild"
+ source ${_pkgbuild} >/dev/null 2>&1 || {
+ error "${_pkgbuild} contains errors, skipping"
+ continue
+ }
+
+ fullpath=$(dirname ${_pkgbuild})
+
+ for _pkg in ${pkgbase} ${pkgname[@]} ${provides[@]}; do
+ $VERBOSE && msg2 "${_pkg} -> ${fullpath}"
+ tcamgr put ${PATHFILE} ${_pkg/[<>=]*} ${fullpath}
+ done
+
+ unset pkgbase pkgname provides
+done
+
+lastsync ${LASTSYNCFILE}