summaryrefslogtreecommitdiff
path: root/src/toru
diff options
context:
space:
mode:
Diffstat (limited to 'src/toru')
-rwxr-xr-xsrc/toru/toru-info22
-rwxr-xr-xsrc/toru/toru-path41
2 files changed, 33 insertions, 30 deletions
diff --git a/src/toru/toru-info b/src/toru/toru-info
index 0c961b9..a7081cb 100755
--- a/src/toru/toru-info
+++ b/src/toru/toru-info
@@ -21,23 +21,23 @@
. libremessages
. "$(librelib conf)"
-for _pkg in $@; do
+for _pkg in "$@"; do
_pkgbuild="$(toru-where $_pkg)"
if [ -f "$_pkgbuild/PKGBUILD" ]; then
- load_PKGBUILD "$_pkgbuild/PKGBUILD" 2>/dev/null || {
- warning "Errors on %s" $_pkg
+ if ! load_PKGBUILD "$_pkgbuild/PKGBUILD" 2>/dev/null; then
+ warning "Errors on %s" "$_pkg"
continue
- }
+ fi
- deps="${depends[@]} ${makedepends[@]} ${checkdepends[@]}"
- repo="$(basename $(dirname "$_pkgbuild"))"
+ deps=("${depends[@]}" "${makedepends[@]}" "${checkdepends[@]}")
+ repo="$(basename -- "$(dirname -- "$_pkgbuild")")"
- msg "%s/%s %s-%s" $repo $_pkg $pkgver $pkgrel
- msg2 "$pkgdesc"
- msg2 "$url"
- msg2 "Depends: ${deps}"
+ msg "%s/%s %s-%s" "$repo" "$_pkg" "$pkgver" "$pkgrel"
+ msg2 '%s' "$pkgdesc"
+ msg2 '%s' "$url"
+ msg2 'Depends: %s' "${deps[*]}"
else
- warning "%s doesn't exist" $_pkg
+ warning "%s doesn't exist" "$_pkg"
fi
done
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}"