-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
$(QUIET) \
-- \
- $($(PKG)_SITE) \
- $($(PKG)_DL_VERSION) \
- $($(PKG)_BASENAME_RAW) \
+ -u $($(PKG)_SITE) \
+ -c $($(PKG)_DL_VERSION) \
+ -n $($(PKG)_BASENAME_RAW) \
$($(PKG)_DL_OPTS)
endef
-o $(DL_DIR)/$($(PKG)_SOURCE) \
$(QUIET) \
-- \
- $($(PKG)_SITE) \
- $($(PKG)_DL_VERSION) \
- $($(PKG)_BASENAME_RAW) \
+ -u $($(PKG)_SITE) \
+ -c $($(PKG)_DL_VERSION) \
+ -n $($(PKG)_BASENAME_RAW) \
$($(PKG)_DL_OPTS)
endef
-o $(DL_DIR)/$($(PKG)_SOURCE) \
$(QUIET) \
-- \
- $(call stripurischeme,$(call qstrip,$($(PKG)_SITE))) \
- $($(PKG)_DL_VERSION) \
- $($(PKG)_RAWNAME) \
- $($(PKG)_BASENAME_RAW) \
+ -u $(call stripurischeme,$(call qstrip,$($(PKG)_SITE))) \
+ -c $($(PKG)_DL_VERSION) \
+ -N $($(PKG)_RAWNAME) \
+ -n $($(PKG)_BASENAME_RAW) \
$($(PKG)_DL_OPTS)
endef
-o $(DL_DIR)/$($(PKG)_SOURCE) \
$(QUIET) \
-- \
- $($(PKG)_SITE) \
- $($(PKG)_DL_VERSION) \
- $($(PKG)_BASENAME_RAW) \
+ -u $($(PKG)_SITE) \
+ -c $($(PKG)_DL_VERSION) \
+ -n $($(PKG)_BASENAME_RAW) \
$($(PKG)_DL_OPTS)
endef
-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
$(QUIET) \
-- \
- '$(call stripurischeme,$(call qstrip,$(1)))' \
+ -u '$(call stripurischeme,$(call qstrip,$(1)))' \
$($(PKG)_DL_OPTS)
endef
-o $(DL_DIR)/$($(PKG)_SOURCE) \
$(QUIET) \
-- \
- $($(PKG)_SITE) \
- $($(PKG)_DL_VERSION) \
- $($(PKG)_BASENAME_RAW) \
+ -u $($(PKG)_SITE) \
+ -c $($(PKG)_DL_VERSION) \
+ -n $($(PKG)_BASENAME_RAW) \
$($(PKG)_DL_OPTS)
endef
-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
$(QUIET) \
-- \
- '$(call qstrip,$(1))' \
+ -u '$(call qstrip,$(1))' \
$($(PKG)_DL_OPTS)
endef
-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
$(QUIET) \
-- \
- $(call stripurischeme,$(call qstrip,$(1))) \
+ -u $(call stripurischeme,$(call qstrip,$(1))) \
$($(PKG)_DL_OPTS)
endef
# Download helper for bzr, to be called from the download wrapper script
#
-# Call it as:
-# .../bzr [-q] OUT_FILE REPO_URL REV BASENAME
+# Options:
+# -q Be quiet
+# -o FILE Generate archive in FILE.
+# -u URI Clone from repository at URI.
+# -c CSET Use changeset (or revision) CSET.
+# -n NAME Use basename NAME.
#
# Environment:
# BZR : the bzr command to call
verbose=
-while getopts :q OPT; do
+while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do
case "${OPT}" in
q) verbose=-q;;
+ o) output="${OPTARG}";;
+ u) uri="${OPTARG}";;
+ c) cset="${OPTARG}";;
+ n) basename="${OPTARG}";;
+ :) printf "option '%s' expects a mandatory argument\n" "${OPTARG}"; exit 1;;
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
esac
done
-shift $((OPTIND-1))
-output="${1}"
-repo="${2}"
-rev="${3}"
-basename="${4}"
-
-shift 4 # Get rid of our options
+shift $((OPTIND-1)) # Get rid of our options
# Caller needs to single-quote its arguments to prevent them from
# being expanded a second time (in case there are spaces in them)
fi
_bzr export ${verbose} --root="'${basename}/'" --format=tgz \
- ${timestamp_opt} - "${@}" "'${repo}'" -r "'${rev}'" \
+ ${timestamp_opt} - "${@}" "'${uri}'" -r "'${cset}'" \
>"${output}"
# Download helper for cp, to be called from the download wrapper script
#
-# Call it as:
-# .../cp [-q] OUT_FILE SRC_FILE
+# Options:
+# -q Be quiet.
+# -o FILE Copy to file FILE.
+# -u FILE Copy from file FILE.
#
# Environment:
# LOCALFILES: the cp command to call
# Make 'cp' verbose by default, so it behaves a bit like the others.
verbose=-v
-while getopts :q OPT; do
+while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do
case "${OPT}" in
q) verbose=;;
+ o) output="${OPTARG}";;
+ u) source="${OPTARG}";;
+ :) printf "option '%s' expects a mandatory argument\n" "${OPTARG}"; exit 1;;
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
esac
done
-shift $((OPTIND-1))
-output="${1}"
-source="${2}"
-
-shift 2 # Get rid of our options
+shift $((OPTIND-1)) # Get rid of our options
# Caller needs to single-quote its arguments to prevent them from
# being expanded a second time (in case there are spaces in them)
# Download helper for cvs, to be called from the download wrapper script
#
-# Call it as:
-# .../cvs [-q] OUT_FILE CVS_URL REV PKG_NAME BASENAME
+# Options:
+# -q Be quiet
+# -o FILE Generate archive in FILE.
+# -u URI Checkout from repository at URI.
+# -c REV Use revision REV.
+# -N RAWNAME Use rawname (aka module name) RAWNAME.
+# -n NAME Use basename NAME.
#
# Environment:
# CVS : the cvs command to call
verbose=
-while getopts :q OPT; do
+while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do
case "${OPT}" in
q) verbose=-Q;;
+ o) output="${OPTARG}";;
+ u) uri="${OPTARG}";;
+ c) rev="${OPTARG}";;
+ N) rawname="${OPTARG}";;
+ n) basename="${OPTARG}";;
+ :) printf "option '%s' expects a mandatory argument\n" "${OPTARG}"; exit 1;;
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
esac
done
-shift $((OPTIND-1))
-output="${1}"
-repo="${2}"
-rev="${3}"
-rawname="${4}"
-basename="${5}"
-
-shift 5 # Get rid of our options
+shift $((OPTIND-1)) # Get rid of our options
# Caller needs to single-quote its arguments to prevent them from
# being expanded a second time (in case there are spaces in them)
select="-r"
fi
-# The absence of an initial : on ${repo} means access method undefined
-if [[ ! "${repo}" =~ ^: ]]; then
+# The absence of an initial : on ${uri} means access method undefined
+if [[ ! "${uri}" =~ ^: ]]; then
# defaults to anonymous pserver
- repo=":pserver:anonymous@${repo}"
+ uri=":pserver:anonymous@${uri}"
fi
export TZ=UTC
-_cvs ${verbose} -z3 -d"'${repo}'" \
+_cvs ${verbose} -z3 -d"'${uri}'" \
co "${@}" -d "'${basename}'" ${select} "'${rev}'" -P "'${rawname}'"
tar czf "${output}" "${basename}"
# We want to catch any unexpected failure, and exit immediately.
set -e
+export BR_BACKEND_DL_GETOPTS=":hc:o:n:N:H:ru:q"
+
main() {
local OPT OPTARG
local backend output hfile recurse quiet rc
# If the backend fails, we can just remove the temporary directory to
# remove all the cruft it may have left behind. Then we just exit in
# error too.
- if ! "${OLDPWD}/support/download/${backend}" ${quiet} ${recurse} "${tmpf}" "${@}"; then
+ if ! "${OLDPWD}/support/download/${backend}" \
+ ${quiet} ${recurse} \
+ -o "${tmpf}" "${@}"
+ then
rm -rf "${tmpd}"
exit 1
fi
# Download helper for git, to be called from the download wrapper script
#
-# Call it as:
-# .../git [-q] [-r] OUT_FILE REPO_URL CSET BASENAME
-#
-# -q Be quiet.
-# -r Clone and archive sub-modules.
+# Options:
+# -q Be quiet.
+# -r Clone and archive sub-modules.
+# -o FILE Generate archive in FILE.
+# -u URI Clone from repository at URI.
+# -c CSET Use changeset CSET.
+# -n NAME Use basename NAME.
#
# Environment:
# GIT : the git command to call
verbose=
recurse=0
-while getopts :qr OPT; do
+while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do
case "${OPT}" in
q) verbose=-q; exec >/dev/null;;
r) recurse=1;;
+ o) output="${OPTARG}";;
+ u) uri="${OPTARG}";;
+ c) cset="${OPTARG}";;
+ n) basename="${OPTARG}";;
+ :) printf "option '%s' expects a mandatory argument\n" "${OPTARG}"; exit 1;;
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
esac
done
-shift $((OPTIND-1))
-
-output="${1}"
-repo="${2}"
-cset="${3}"
-basename="${4}"
-shift 4 # Get rid of our options
+shift $((OPTIND-1)) # Get rid of our options
# Caller needs to single-quote its arguments to prevent them from
# being expanded a second time (in case there are spaces in them)
# Messages for the type of clone used are provided to ease debugging in case of
# problems
git_done=0
-if [ -n "$(_git ls-remote "'${repo}'" "'${cset}'" 2>&1)" ]; then
+if [ -n "$(_git ls-remote "'${uri}'" "'${cset}'" 2>&1)" ]; then
printf "Doing shallow clone\n"
- if _git clone ${verbose} "${@}" --depth 1 -b "'${cset}'" "'${repo}'" "'${basename}'"; then
+ if _git clone ${verbose} "${@}" --depth 1 -b "'${cset}'" "'${uri}'" "'${basename}'"; then
git_done=1
else
printf "Shallow clone failed, falling back to doing a full clone\n"
fi
if [ ${git_done} -eq 0 ]; then
printf "Doing full clone\n"
- _git clone ${verbose} "${@}" "'${repo}'" "'${basename}'"
+ _git clone ${verbose} "${@}" "'${uri}'" "'${basename}'"
fi
pushd "${basename}" >/dev/null
# Download helper for hg, to be called from the download wrapper script
#
-# Call it as:
-# .../hg [-q] OUT_FILE REPO_URL CSET BASENAME
+# Options:
+# -q Be quiet.
+# -o FILE Generate archive in FILE.
+# -u URI Clone from repository at URI.
+# -c CSET Use changeset (or revision) CSET.
+# -n NAME Use basename NAME.
#
# Environment:
# HG : the hg command to call
verbose=
-while getopts :q OPT; do
+while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do
case "${OPT}" in
q) verbose=-q;;
+ o) output="${OPTARG}";;
+ u) uri="${OPTARG}";;
+ c) cset="${OPTARG}";;
+ n) basename="${OPTARG}";;
+ :) printf "option '%s' expects a mandatory argument\n" "${OPTARG}"; exit 1;;
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
esac
done
-shift $((OPTIND-1))
-output="${1}"
-repo="${2}"
-cset="${3}"
-basename="${4}"
-
-shift 4 # Get rid of our options
+shift $((OPTIND-1)) # Get rid of our options
# Caller needs to single-quote its arguments to prevent them from
# being expanded a second time (in case there are spaces in them)
eval ${HG} "${@}"
}
-_hg clone ${verbose} "${@}" --noupdate "'${repo}'" "'${basename}'"
+_hg clone ${verbose} "${@}" --noupdate "'${uri}'" "'${basename}'"
_hg archive ${verbose} --repository "'${basename}'" --type tgz \
--prefix "'${basename}'" --rev "'${cset}'" \
# Download helper for scp, to be called from the download wrapper script
#
-# Call it as:
-# .../scp [-q] OUT_FILE SRC_URL
+# Options:
+# -q Be quiet.
+# -o FILE Copy to local file FILE.
+# -u FILE Copy from remote file FILE.
#
# Environment:
# SCP : the scp command to call
verbose=
-while getopts :q OPT; do
+while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do
case "${OPT}" in
q) verbose=-q;;
+ o) output="${OPTARG}";;
+ u) uri="${OPTARG}";;
+ :) printf "option '%s' expects a mandatory argument\n" "${OPTARG}"; exit 1;;
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
esac
done
-shift $((OPTIND-1))
-output="${1}"
-url="${2}"
-
-shift 2 # Get rid of our options
+shift $((OPTIND-1)) # Get rid of our options
# Caller needs to single-quote its arguments to prevent them from
# being expanded a second time (in case there are spaces in them)
eval ${SCP} "${@}"
}
-_scp ${verbose} "${@}" "'${url}'" "'${output}'"
+_scp ${verbose} "${@}" "'${uri}'" "'${output}'"
# Download helper for svn, to be called from the download wrapper script
#
-# Call it as:
-# .../svn [-q] OUT_FILE REPO_URL REV BASNAME
+# Options:
+# -q Be quiet.
+# -o FILE Generate archive in FILE.
+# -u URI Checkout from repository at URI.
+# -c REV Use revision REV.
+# -n NAME Use basename NAME.
#
# Environment:
# SVN : the svn command to call
verbose=
-while getopts :q OPT; do
+while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do
case "${OPT}" in
q) verbose=-q;;
+ o) output="${OPTARG}";;
+ u) uri="${OPTARG}";;
+ c) rev="${OPTARG}";;
+ n) basename="${OPTARG}";;
+ :) printf "option '%s' expects a mandatory argument\n" "${OPTARG}"; exit 1;;
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
esac
done
-shift $((OPTIND-1))
-output="${1}"
-repo="${2}"
-rev="${3}"
-basename="${4}"
-
-shift 4 # Get rid of our options
+shift $((OPTIND-1)) # Get rid of our options
# Caller needs to single-quote its arguments to prevent them from
# being expanded a second time (in case there are spaces in them)
eval ${SVN} "${@}"
}
-_svn export ${verbose} "${@}" "'${repo}@${rev}'" "'${basename}'"
+_svn export ${verbose} "${@}" "'${uri}@${rev}'" "'${basename}'"
tar czf "${output}" "${basename}"
# Download helper for wget, to be called from the download wrapper script
#
-# Call it as:
-# .../wget [-q] OUT_FILE URL
+# Options:
+# -q Be quiet.
+# -o FILE Save into file FILE.
+# -u URL Download file at URL.
#
# Environment:
# WGET : the wget command to call
verbose=
-while getopts :q OPT; do
+while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do
case "${OPT}" in
q) verbose=-q;;
+ o) output="${OPTARG}";;
+ u) url="${OPTARG}";;
+ :) printf "option '%s' expects a mandatory argument\n" "${OPTARG}"; exit 1;;
\?) printf "unknown option '%s'\n" "${OPTARG}" >&2; exit 1;;
esac
done
-shift $((OPTIND-1))
-output="${1}"
-url="${2}"
-
-shift 2 # Get rid of our options
+shift $((OPTIND-1)) # Get rid of our options
# Caller needs to single-quote its arguments to prevent them from
# being expanded a second time (in case there are spaces in them)