diff options
author | Joshua I. Haase H. (xihh) <hahj87@gmail.com> | 2012-12-04 21:19:22 -0600 |
---|---|---|
committer | Joshua I. Haase H. (xihh) <hahj87@gmail.com> | 2012-12-04 21:19:22 -0600 |
commit | acc2c792c423c5aa81aa95f0516de7724dba3ab9 (patch) | |
tree | 73cacea8eff5cdfd23f42b740597b5498d152509 /src/toru/toru-path | |
parent | d11741d73bbf6940c45ee0f2cadea980e9e40785 (diff) | |
parent | 098d7430e6447c4658704c3bcf88ea1ed7a5206b (diff) |
Merge branch 'master' of gitpar:libretools
Conflicts:
librechroot
libremakepkg
Diffstat (limited to 'src/toru/toru-path')
-rwxr-xr-x | src/toru/toru-path | 50 |
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} |