[PATCH 3 of 4] scripts: in case of failed download,=D=A remove partial files

Yann E. MORIN yann.morin.1998@anciens.enib.fr
Wed Aug 11 18:09:00 GMT 2010


# HG changeset patch
# User "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
# Date 1281550038 -7200
# Node ID 66bf263037c1043ebe2a9fd81dea763e630131c7
# Parent  a8fefc20b67fff9603cfcafe9c633759379ff29d
scripts: in case of failed download, remove partial files

It happens from time to time that the server mis-behaves, and breaks the
connection right in the middle of nowhere, for no good reason, leaving us
with a partial file, on which the extract pass would choke.

Remove partial downloads, to fail early.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>

diff --git a/scripts/functions b/scripts/functions
--- a/scripts/functions
+++ b/scripts/functions
@@ -363,7 +363,7 @@
     # connecting, so force a global ${CT_CONNECT_TIMEOUT}-second timeout.
     CT_DoExecLog ALL wget -T ${CT_CONNECT_TIMEOUT} -nc --progress=dot:binary --tries=3 --passive-ftp "$1"    \
     || CT_DoExecLog ALL wget -T ${CT_CONNECT_TIMEOUT} -nc --progress=dot:binary --tries=3 "$1"               \
-    || true
+    || rm -f "${1##*/}"
 }
 
 # Download an URL using curl
@@ -374,7 +374,7 @@
     #       so, be silent.
     CT_DoExecLog ALL curl -s --ftp-pasv -O --retry 3 "$1" --connect-timeout ${CT_CONNECT_TIMEOUT} -L -f  \
     || CT_DoExecLog ALL curl -s -O --retry 3 "$1" --connect-timeout ${CT_CONNECT_TIMEOUT} -L -f          \
-    || true
+    || rm -f "${1##*/}"
 }
 
 # Download using aria2

--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list