diff options
Diffstat (limited to 'src/toru/toru-path')
-rwxr-xr-x | src/toru/toru-path | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/toru/toru-path b/src/toru/toru-path index a81ee53..7fc6dfe 100755 --- a/src/toru/toru-path +++ b/src/toru/toru-path @@ -28,39 +28,42 @@ if [ ! -w "$TORUPATH" ]; then exit 1 fi -LASTSYNCFILE=${TORUPATH}/lastsync.paths -PATHFILE=${TORUPATH}/paths.tch +lastsyncfile=${TORUPATH}/lastsync.paths +pathfile=${TORUPATH}/paths.tch -if [ ! -e "${PATHFILE}" ]; then - tcamgr create "${PATHFILE}" +if [ ! -e "${pathfile}" ]; then + tcamgr create "${pathfile}" fi # TODO pass other paths via flags # ABSROOT has trailing slash fullrepos=() +# This loop is complicated because it goes over REPOS backward for (( i = ${#REPOS[@]}-1 ; i >= 0 ; i-- )); do - ${VERBOSE} && msg "Processing [%s]" ${REPOS[$i]} + ${VERBOSE} && msg "Processing [%s]" "${REPOS[$i]}" - [ -d "${ABSROOT}${REPOS[$i]}" ] && \ - fullrepos+=("${ABSROOT}${REPOS[$i]}") + if [ -d "${ABSROOT}${REPOS[$i]}" ]; then + fullrepos+=("${ABSROOT}${REPOS[$i]}") + fi done -pkgbuilds=($(get_pkgbuilds "${LASTSYNCFILE}" "${fullrepos[@]}")) +IFS=$'\n' +pkgbuilds=($(get_pkgbuilds "${lastsyncfile}" "${fullrepos[@]}")) msg "Updating path cache" -msg2 "${#pkgbuilds[@]} PKGBUILDs to update" -for _pkgbuild in ${pkgbuilds[@]}; do - # plain "$_pkgbuild" - load_PKGBUILD "${_pkgbuild}" >/dev/null 2>&1 || { - error "${_pkgbuild} contains errors, skipping" +msg2 "%d PKGBUILDs to update" ${#pkgbuilds[@]} +for _pkgbuild in "${pkgbuilds[@]}"; do + # plain "$_pkgbuild" + if ! load_PKGBUILD "${_pkgbuild}" >/dev/null 2>&1; then + error "%q contains errors, skipping" "${_pkgbuild}" continue - } + fi - fullpath=$(dirname ${_pkgbuild}) + fullpath="$(dirname -- "${_pkgbuild}")" - for _pkg in ${pkgbase} ${pkgname[@]} ${provides[@]}; do - $VERBOSE && msg2 "${_pkg} -> ${fullpath}" - tcamgr put ${PATHFILE} ${_pkg/[<>=]*} ${fullpath} + for _pkg in "${pkgbase}" "${pkgname[@]}" "${provides[@]}"; do + $VERBOSE && msg2 '%s -> %s' "${_pkg}" "${fullpath}" + tcamgr put "${pathfile}" "${_pkg%%[<>=]*}" "${fullpath}" done done -lastsync ${LASTSYNCFILE} +lastsync "${lastsyncfile}" |