[pacman-dev] [PATCH] makepkg: remove .part file after a failed download

Allan McRae allan at archlinux.org
Wed Oct 21 19:59:53 EDT 2009


Xavier wrote:
> On Wed, Oct 21, 2009 at 10:40 PM, Cedric Staniewski <cedric at gmx.ca> wrote:
>   
>> >From e809e3182f94fd4144cdb816d0af90587bf04ea2 Mon Sep 17 00:00:00 2001
>> From: Cedric Staniewski <cedric at gmx.ca>
>> 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 <cedric at gmx.ca>
>> ---
>>  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.

Allan



More information about the pacman-dev mailing list