support/download: convert localfiles to use the wrapper
This drastically simplifies the localfiles helper, as it no longer has to deal with atomically saving the downloaded archive. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Tested-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com> (Tested by setting BUSYBOX_SITE = file:///tmp and running 'make busybox-source') Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
parent
c48d45e342
commit
84469226c1
|
@ -209,8 +209,9 @@ endef
|
||||||
|
|
||||||
define DOWNLOAD_LOCALFILES
|
define DOWNLOAD_LOCALFILES
|
||||||
test -e $(DL_DIR)/$(2) || \
|
test -e $(DL_DIR)/$(2) || \
|
||||||
$(EXTRA_ENV) support/download/cp $(call stripurischeme,$(call qstrip,$(1))) \
|
$(EXTRA_ENV) support/download/wrapper cp \
|
||||||
$(DL_DIR)/$(2) && \
|
$(DL_DIR)/$(2) \
|
||||||
|
$(call stripurischeme,$(call qstrip,$(1))) && \
|
||||||
$(call VERIFY_HASH,$(PKGDIR)/$($(PKG)_NAME).hash,$(DL_DIR)/$(2))
|
$(call VERIFY_HASH,$(PKGDIR)/$($(PKG)_NAME).hash,$(DL_DIR)/$(2))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,16 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# We want to catch any command failure, and exit immediately
|
# We want to catch any unexpected failure, and exit immediately
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Download helper for cp
|
# Download helper for cp, to be called from the download wrapper script
|
||||||
# Call it with:
|
# Expected arguments:
|
||||||
# $1: source file
|
# $1: output file
|
||||||
# $2: output file
|
# $2: source file
|
||||||
# And this environment:
|
# And this environment:
|
||||||
# LOCALFILES: the cp command to call
|
# LOCALFILES: the cp command to call
|
||||||
|
|
||||||
source="${1}"
|
output="${1}"
|
||||||
output="${2}"
|
source="${2}"
|
||||||
|
|
||||||
tmp_output="$( mktemp "${output}.XXXXXX" )"
|
${LOCALFILES} "${source}" "${output}"
|
||||||
|
|
||||||
ret=1
|
|
||||||
if ${LOCALFILES} "${source}" "${tmp_output}"; then
|
|
||||||
mv "${tmp_output}" "${output}"
|
|
||||||
ret=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Cleanup
|
|
||||||
rm -f "${tmp_output}"
|
|
||||||
exit ${ret}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user