From f56f7ff39102dab754573b0bc40dbceb5a8ec301 Mon Sep 17 00:00:00 2001 From: Roman Kyrylych Date: Sun, 10 Feb 2008 18:56:47 +0200 Subject: makepkg: Support for resuming source downloads Download to *.part and remove the suffix if successful, thus md5sums will be checked only for complete files, and next time makepkg will resume downloading of partial file instead of complaining about invalid md5sums. Old DLAGENTS format is still supported. Late fix: Do not try to download %u first The output of grep was not suppressed, thus the output of get_downloadcmd was wrong because of extra line at the beginning that contained an unsubstituted (with %o and %u) entry from DLAGENTS. Signed-off-by: Roman Kyrylych Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 79c3fd17..f2f7109b 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -299,6 +299,20 @@ get_downloadclient() { echo "$agent" } +get_downloadcmd() { + local dlagent=$1 + local netfile=$2 + local file=$3 + + if echo "$dlagent" | grep -q "%u" ; then + local dlcmd=$(echo "$dlagent" | sed "s|%o|$file.part|" | sed "s|%u|$netfile|") + else + local dlcmd="$dlagent $netfile" + fi + + echo "$dlcmd" +} + check_deps() { [ $# -gt 0 ] || return @@ -471,17 +485,20 @@ download_sources() { fi # find the client we should use for this URL - local dlclient=$(get_downloadclient $netfile) || exit $? + local dlclient=$(get_downloadclient "$netfile") || exit $? msg2 "$(gettext "Downloading %s...")" "$file" # fix flyspray bug #3289 local ret=0 - $dlclient "$netfile" || ret=$? + $(get_downloadcmd "$dlclient" "$netfile" "$file") || ret=$? if [ $ret -gt 0 ]; then error "$(gettext "Failure while downloading %s")" "$file" plain "$(gettext "Aborting...")" exit 1 fi + if echo "$dlclient" | grep -q "%o" ; then + mv -f "$SRCDEST/$file.part" "$SRCDEST/$file" + fi cp -s --remove-destination "$SRCDEST/$file" "$srcdir/" done -- cgit v1.2.3-24-g4f1b