On Wed, Oct 21, 2009 at 6:59 PM, Allan McRae <[email protected]> wrote: > Xavier wrote: >> >> On Wed, Oct 21, 2009 at 10:40 PM, Cedric Staniewski <[email protected]> wrote: >> >>> >>> >From e809e3182f94fd4144cdb816d0af90587bf04ea2 Mon Sep 17 00:00:00 2001 >>> From: Cedric Staniewski <[email protected]> >>> Date: Wed, 21 Oct 2009 19:13:36 +0200 >>> -- 8< -- >>> Subject: [PATCH] makepkg: remove empty .part files after a failed >>> download >>> >>> Signed-off-by: Cedric Staniewski <[email protected]> >>> --- >>> scripts/makepkg.sh.in | 7 ++++++- >>> 1 files changed, 6 insertions(+), 1 deletions(-) >>> >>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in >>> index 40367ae..78b6904 100644 >>> --- a/scripts/makepkg.sh.in >>> +++ b/scripts/makepkg.sh.in >>> @@ -336,7 +336,12 @@ download_file() { >>> dlcmd="$dlcmd \"$url\"" >>> fi >>> >>> - eval $dlcmd || return $? >>> + local ret=0 >>> + eval "$dlcmd || ret=\$?" >>> + if [ $ret -gt 0 ]; then >>> + [ ! -s "$dlfile" ] && rm -f -- "$dlfile" >>> + return $ret >>> + fi >>> >>> # rename the temporary download file to the final destination >>> if [ "$dlfile" != "$file" ]; then >>> -- >>> 1.6.5.1 >>> >>> >>> >>> >> >> This one works for me now, applied to my working branch. >> > > This looks a really nice feature. I end up having a lot of empty .part > files in my build tree.
I had no idea this was happening, so thanks for finding it: $ ll /home/makepkg/sources/*.part -rw-r--r-- 1 dmcgee wheel 0 2009-08-17 19:18 /home/makepkg/sources/libfetch-2.24.tar.gz.part -rw-r--r-- 1 dmcgee wheel 0 2009-04-12 21:05 /home/makepkg/sources/libstdc++-man-20080118.tar.bz2.part -rw-r--r-- 1 dmcgee wheel 0 2009-09-22 21:49 /home/makepkg/sources/pacman-3.3.1.tar.gz.part -rw-r--r-- 1 dmcgee wheel 0 2009-10-07 18:46 /home/makepkg/sources/pacman-3.3.2.tar.gz.part -rw-r--r-- 1 dmcgee wheel 1.8M 2009-01-29 23:21 /home/makepkg/sources/vpnclient-linux-x86_64-4.8.01.0640-k9.tar.gz.part -rw-r--r-- 1 dmcgee wheel 0 2009-08-16 16:27 /home/makepkg/sources/wine-1.1.27-1-i686.pkg.tar.gz.part
