From 27b946270520befdb810dba04cfa0e7cab9a6bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mas=C5=82owski?= Date: Fri, 9 Mar 2012 21:11:09 +0100 Subject: Rename a variable to avoid having it replaced when sourcing PKGBUILDs. --- toru | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/toru b/toru index 766331b..28f0b8a 100755 --- a/toru +++ b/toru @@ -109,15 +109,15 @@ update() { local -a package_paths=() # Traverse all specified repos - for _repo in $@; do + for __repo in $@; do # Check if the repo is set as such, otherwise skip - is_repo ${_repo} || continue + is_repo ${__repo} || continue # Fullpath of the repo - _repopath=$(readlink -f ${_repo}) + _repopath=$(readlink -f ${__repo}) # This is the syncfile, stores the last date as content and mtime - local lastsyncfile=${TORUPATH}/${_repo}.lastsync + local lastsyncfile=${TORUPATH}/${__repo}.lastsync # Find all the PKGBUILDs newer than the last update # Update newer, otherwise everything @@ -131,13 +131,13 @@ update() { # Only find newer than lastsyncfile and read everything else from cache pkgbuilds=($(find ${_repopath} -maxdepth 2 -type f -name 'PKGBUILD' -newer ${lastsyncfile})) - packages_in_abs=($(read_cache ${_repo})) + packages_in_abs=($(read_cache ${__repo})) $quiet || msg2 "Getting ${#packages_in_abs[@]} packages from cache" fi - package_paths=($(read_cache ${_repo}.paths || true)) + package_paths=($(read_cache ${__repo}.paths || true)) # Inform how many PKGBUILDS were found and quit immediately if none $quiet || msg "Found $((${#pkgbuilds[*]}-1)) PKGBUILDs to update" @@ -177,16 +177,16 @@ update() { # Sync! (Only if there was an actual sync) ${update_sync_file} && lastsync ${lastsyncfile} - if [ "${lastsyncfile}" -nt "${TORUPATH}/${_repo}.paths.cache" ]; then + if [ "${lastsyncfile}" -nt "${TORUPATH}/${__repo}.paths.cache" ]; then print_package_array "${package_paths[@]}" > $TMPDIR/paths - store_cache ${_repo}.paths $TMPDIR/paths + store_cache ${__repo}.paths $TMPDIR/paths fi # If there isn't an update cache or it's older than the last update, we check - if [ "${lastsyncfile}" -nt "${TORUPATH}/${_repo}.updates.cache" ]; then + if [ "${lastsyncfile}" -nt "${TORUPATH}/${__repo}.updates.cache" ]; then # Get repo database contents - packages_in_sync=($(get_db_contents ${_repo})) + packages_in_sync=($(get_db_contents ${__repo})) # Drops arrays into files print_package_array "${packages_in_abs[@]}" > ${TMPDIR}/packages_in_abs print_package_array "${packages_in_sync[@]}" > ${TMPDIR}/packages_in_sync @@ -227,17 +227,17 @@ update() { unset _pkg _syncver _absver need_line # Save the cache - store_cache ${_repo} ${TMPDIR}/packages_in_abs + store_cache ${__repo} ${TMPDIR}/packages_in_abs # See above FIXME # print_package_array "${updates[@]}" > ${TMPDIR}/updates if [ -r ${TMPDIR}/updates ]; then - store_cache ${_repo}.updates ${TMPDIR}/updates + store_cache ${__repo}.updates ${TMPDIR}/updates fi else $quiet || msg "Reading updates from cache..." - read_cache ${_repo}.updates + read_cache ${__repo}.updates fi done # end repos @@ -252,10 +252,10 @@ missing() { ## usage: where_is # Look in all caches but pick the first one where_is() { - local _repo + local __repo local _path - for _repo in ${REPOS[@]}; do - _path=$(grep "^${1}:" "${TORUPATH}/${_repo}.paths.cache" 2>/dev/null | + for __repo in ${REPOS[@]}; do + _path=$(grep "^${1}:" "${TORUPATH}/${__repo}.paths.cache" 2>/dev/null | cut -d: -f2) [ -n "${_path}" ] && break -- cgit v1.2.2