support/download: convert bzr to use the wrapper
This drastically simplifies the bzr 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> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
parent
b5a9470bdf
commit
c48d45e342
@ -112,7 +112,11 @@ endef
|
|||||||
|
|
||||||
define DOWNLOAD_BZR
|
define DOWNLOAD_BZR
|
||||||
test -e $(DL_DIR)/$($(PKG)_SOURCE) || \
|
test -e $(DL_DIR)/$($(PKG)_SOURCE) || \
|
||||||
$(EXTRA_ENV) support/download/bzr $($(PKG)_SITE) $($(PKG)_DL_VERSION) $(DL_DIR)/$($(PKG)_SOURCE)
|
$(EXTRA_ENV) support/download/wrapper bzr \
|
||||||
|
$(DL_DIR)/$($(PKG)_SOURCE) \
|
||||||
|
$($(PKG)_SITE) \
|
||||||
|
$($(PKG)_DL_VERSION) \
|
||||||
|
$($(PKG)_BASE_NAME)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define SOURCE_CHECK_BZR
|
define SOURCE_CHECK_BZR
|
||||||
|
@ -1,38 +1,20 @@
|
|||||||
#!/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 bzr
|
# Download helper for bzr, to be called from the download wrapper script
|
||||||
# Call it with:
|
# Expected arguments:
|
||||||
# $1: bzr repo
|
# $1: output file
|
||||||
# $2: bzr revision
|
# $2: bzr repo
|
||||||
# $3: output file
|
# $3: bzr revision
|
||||||
|
# $4: basename
|
||||||
# And this environment:
|
# And this environment:
|
||||||
# BZR : the bzr command to call
|
# BZR : the bzr command to call
|
||||||
# BUILD_DIR: path to Buildroot's build dir
|
|
||||||
|
|
||||||
repo="${1}"
|
output="${1}"
|
||||||
rev="${2}"
|
repo="${2}"
|
||||||
output="${3}"
|
rev="${3}"
|
||||||
|
basename="${4}"
|
||||||
|
|
||||||
tmp_dl="$( mktemp "${BUILD_DIR}/.XXXXXX" )"
|
${BZR} export --root="${basename}/" --format=tgz "${output}" "${repo}" -r "${rev}"
|
||||||
tmp_output="$( mktemp "${output}.XXXXXX" )"
|
|
||||||
|
|
||||||
# Play tic-tac-toe with temp files
|
|
||||||
# - first, we download to a trashable location (the build-dir)
|
|
||||||
# - the we move to a temp file in the final location, so it is
|
|
||||||
# on the same filesystem as the final file
|
|
||||||
# - finally, we atomically rename to the final file
|
|
||||||
|
|
||||||
ret=1
|
|
||||||
if ${BZR} export --format=tgz "${tmp_dl}" "${repo}" -r "${rev}"; then
|
|
||||||
if mv "${tmp_dl}" "${tmp_output}"; then
|
|
||||||
mv "${tmp_output}" "${output}"
|
|
||||||
ret=0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Cleanup
|
|
||||||
rm -f "${tmp_dl}" "${tmp_output}"
|
|
||||||
exit ${ret}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user