# HG changeset patch # User Antoine Bodin # Date 1298601494 -3600 # Node ID df5c6e3fb2cd3e1d09782abd2ace8aec999c264a # Parent 8cff0e3c661eedb45c321156de2627bf96a08bdb Make recharge) able to handle only one specified repository; Check for repository's ID (a verry little file containing md5sum of packages.md5) and recharge only if it changed (or doesnt exists) when recharging. (4.3) diff -r 8cff0e3c661e -r df5c6e3fb2cd tazpkg --- a/tazpkg Thu Feb 24 23:51:02 2011 +0100 +++ b/tazpkg Fri Feb 25 03:38:14 2011 +0100 @@ -2226,14 +2226,42 @@ # Recharge packages.list from a mirror. # check_root - - for path in $LOCALSTATE $LOCALSTATE/undigest/*; do + if [ "$2" = main ]; then + repository_to_recharge=$LOCALSTATE + elif [ "$2" ]; then + if [ -d "$LOCALSTATE/undigest/$2" ]; then + repository_to_recharge=$LOCALSTATE/undigest/$2 + else + echo "\$LOCALSTATE/undigest/$2 `gettext \"doesn't exists.\"`" >&2 + exit 1 + fi + else + repository_to_recharge="$LOCALSTATE $LOCALSTATE/undigest/*" + fi + for path in $repository_to_recharge; do [ -f $path/mirror ] || continue + cd $path + + # Quietly check if recharging is needed. + [ -f ID ] && mv ID ID.bak + download_from "$(cat mirror)" ID >/dev/null 2>&1 + if [ -f ID ] && fgrep -q `cat ID.bak` ID; then + if [ "$path" = "$LOCALSTATE" ]; then + repository_name=Main + else + repository_name="`gettext \"Undigest\"` $(basename $path)" + fi + echo "$repository_name `gettext \"is up to date.\"`" + rm ID.bak + continue + fi + [ -f ID ] && rm -f ID.bak + echo "" if [ "$path" != "$LOCALSTATE" ]; then echo -e "`gettext \"Recharging undigest\"` $(basename $path):" fi - cd $path + if [ -f "packages.list" ]; then gettext "Creating backup of the last packages list..." mv -f packages.desc packages.desc.bak 2>/dev/null