summaryrefslogtreecommitdiff
path: root/toru
diff options
context:
space:
mode:
authorNicolas Reynolds <fauno@kiwwwi.com.ar>2011-07-15 01:16:45 -0300
committerNicolas Reynolds <fauno@kiwwwi.com.ar>2011-07-15 01:16:45 -0300
commit28b4957fc3de418938d518067a51c353959226cc (patch)
treea42969390046bd19793f68d2c987fa24d931b947 /toru
parentfbad1405cd0531e737b937291cf46bb4a6423268 (diff)
Toru caches PKGBUILD paths
Diffstat (limited to 'toru')
-rwxr-xr-xtoru21
1 files changed, 14 insertions, 7 deletions
diff --git a/toru b/toru
index f74581d..153d825 100755
--- a/toru
+++ b/toru
@@ -135,12 +135,11 @@ is_repo() {
update() {
local update_sync_file=false
# The PKGBUILDs found
- local pkgbuilds=()
+ local -a pkgbuilds=()
# The list of pkgname-fullpkgver
- local packages_in_abs=()
- local packages_in_sync=()
- local need_update=()
+ local -a packages_in_abs=()
local -a pkg_updates=()
+ local -a package_paths=()
# Traverse all specified repos
for _repo in $@; do
@@ -158,6 +157,7 @@ update() {
else
pkgbuilds=($(find ${_repo} -maxdepth 2 -type f -name 'PKGBUILD' -newer ${lastsyncfile}))
packages_in_abs=($(read_cache ${_repo}))
+ package_paths=($(read_cache paths))
$quiet || msg2 "Getting ${#packages_in_abs[@]} packages from cache"
fi
@@ -190,14 +190,20 @@ update() {
unset package_${_pkg} >/dev/null 2>&1
# Fill the list of packages to find
packages_in_abs+=($_pkg-$(get_full_version ${epoch:-0} $pkgver $pkgrel))
+ package_paths+=($_pkg:$_pkgpath)
done # end pkgnames
unset pkgbase pkgname pkgver pkgrel source epoch
done # end pkgbuilds
-# Sync!
+# Sync! (Only if there was an actual sync)
${update_sync_file} && lastsync ${lastsyncfile}
+ if [ "${lastsyncfile}" -nt "${TORUPATH}/paths.cache" ]; then
+ print_package_array "${package_paths[@]}" > $TMPDIR/paths
+ store_cache 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
@@ -233,18 +239,19 @@ update() {
# FIXME this works all right but it's unset once the while ends
#pkg_updates+=("$_pkg")
+# Fix for the above problem, but it access the file every time instead of
+# puting all packages together once
echo $_pkg >> ${TMPDIR}/updates
fi
done # end need_line
- echo "${pkg_updates[@]}"
unset _pkg _syncver _absver need_line
-
# Save the cache
store_cache ${_repo} ${TMPDIR}/packages_in_abs
+# See above FIXME
# print_package_array "${updates[@]}" > ${TMPDIR}/updates
store_cache ${_repo}.updates ${TMPDIR}/updates