@@ -8,7 +8,7 @@
################################################################################
# Download method commands
-WGET := $(call qstrip,$(BR2_WGET)) $(QUIET)
+export WGET := $(call qstrip,$(BR2_WGET)) $(QUIET)
export SVN := $(call qstrip,$(BR2_SVN))
export CVS := $(call qstrip,$(BR2_CVS))
BZR := $(call qstrip,$(BR2_BZR))
@@ -183,9 +183,7 @@ endef
# the next time the download is tried.
define DOWNLOAD_WGET
test -e $(DL_DIR)/$(2) || \
- ($(WGET) -O $(DL_DIR)/$(2).tmp '$(call qstrip,$(1))' && \
- mv $(DL_DIR)/$(2).tmp $(DL_DIR)/$(2)) || \
- (rm -f $(DL_DIR)/$(2).tmp ; exit 1)
+ $(EXTRA_ENV) support/download/wget '$(call qstrip,$(1))' $(DL_DIR)/$(2)
endef
define SOURCE_CHECK_WGET
new file mode 100755
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# We want to catch any command failure, and exit immediately
+set -e
+
+# Download helper for wget
+# Call it with:
+# $1: URL
+# $2: output file
+# And this environment:
+# WGET : the wget command to call
+
+url="${1}"
+output="${2}"
+
+if ${WGET} -O "${output}.tmp" "${url}"; then
+ mv "${output}.tmp" "${output}"
+else
+ rm -f "${output}.tmp"
+ exit 1
+fi