On Wed, Oct 21, 2009 at 10:40:25PM +0200, Cedric Staniewski wrote:
Cedric Staniewski wrote:
Xavier wrote:
The issue reminded me of the following patch : http://projects.archlinux.org/?p=pacman.git;a=commitdiff;h=545eac145d77c6671...
But it seems errexit is only enabled for build and package functions, so this should not affect sources download.
Already found the responsible change. It's 'set -E' from the patch you mentioned.
There are three possible solutions I see: - remove set -E - add some code to dlcmd to handle the error code in the subshell - try to get rid of eval so that the code is not executed in a subshell anymore
I added set -E in that patch globally because there already was an error trap lying around accumulating dust. Maybe the fact that there is always an error trap active should be documented somewhere. I am not sure where, maybe at the top of makepkg?
eval is needed, so I added some code to dlcmd. This patch finally works, even with latest git. ;) Thanks Xavier and Ray; I should really take a look in the Makefiles to find a way to only "build" makepkg.
From e809e3182f94fd4144cdb816d0af90587bf04ea2 Mon Sep 17 00:00:00 2001 From: Cedric Staniewski <cedric@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@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=\$?"
eval $dlcmd || ret=$? seems to work as well.
+ 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