summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorRomain Perier <romain.perier@free-electrons.com>2016-08-23 14:19:44 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-08-23 14:59:01 +0200
commitff559846fdc11f718ef6ed49c25117fab90b8019 (patch)
tree5e1e019d12268862ed941737025f7a0880356c52 /support
parent721e1c1e9ca13f37e3d6aafb0a570fd6fb67fbea (diff)
support/download: Add support to pass options directly to downloaders
This adds support to pass options to the underlying command that is used by downloader. Useful for retrieving data with server-side checking for user login or passwords, use a proxy or use specific options for cloning a repository via git and hg. Signed-off-by: Romain Perier <romain.perier@free-electrons.com> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'support')
-rwxr-xr-xsupport/download/bzr4
-rwxr-xr-xsupport/download/cp4
-rwxr-xr-xsupport/download/cvs4
-rwxr-xr-xsupport/download/git6
-rwxr-xr-xsupport/download/hg4
-rwxr-xr-xsupport/download/scp4
-rwxr-xr-xsupport/download/svn4
-rwxr-xr-xsupport/download/wget4
8 files changed, 25 insertions, 9 deletions
diff --git a/support/download/bzr b/support/download/bzr
index e18b01f39..75b7b415c 100755
--- a/support/download/bzr
+++ b/support/download/bzr
@@ -26,6 +26,8 @@ repo="${2}"
rev="${3}"
basename="${4}"
+shift 4 # 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)
_bzr() {
@@ -49,5 +51,5 @@ if [ ${bzr_version} -ge ${bzr_min_version} ]; then
fi
_bzr export ${verbose} --root="'${basename}/'" --format=tgz \
- ${timestamp_opt} - "'${repo}'" -r "'${rev}'" \
+ ${timestamp_opt} - "${@}" "'${repo}'" -r "'${rev}'" \
>"${output}"
diff --git a/support/download/cp b/support/download/cp
index 09ce3d110..0ee1f3ba8 100755
--- a/support/download/cp
+++ b/support/download/cp
@@ -28,10 +28,12 @@ shift $((OPTIND-1))
output="${1}"
source="${2}"
+shift 2 # 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)
_localfiles() {
eval ${LOCALFILES} "${@}"
}
-_localfiles ${verbose} "'${source}'" "'${output}'"
+_localfiles ${verbose} "${@}""'${source}'" "'${output}'"
diff --git a/support/download/cvs b/support/download/cvs
index 7980389a4..50050ab1c 100755
--- a/support/download/cvs
+++ b/support/download/cvs
@@ -26,6 +26,8 @@ rev="${3}"
rawname="${4}"
basename="${5}"
+shift 5 # 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)
_cvs() {
@@ -48,6 +50,6 @@ fi
export TZ=UTC
_cvs ${verbose} -z3 -d"'${repo}'" \
- co -d "'${basename}'" ${select} "'${rev}'" -P "'${rawname}'"
+ co "${@}" -d "'${basename}'" ${select} "'${rev}'" -P "'${rawname}'"
tar czf "${output}" "${basename}"
diff --git a/support/download/git b/support/download/git
index 416cd1baf..281db61a9 100755
--- a/support/download/git
+++ b/support/download/git
@@ -30,6 +30,8 @@ repo="${2}"
cset="${3}"
basename="${4}"
+shift 4 # 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)
_git() {
@@ -46,7 +48,7 @@ _git() {
git_done=0
if [ -n "$(_git ls-remote "'${repo}'" "'${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}'" "'${repo}'" "'${basename}'"; then
git_done=1
else
printf "Shallow clone failed, falling back to doing a full clone\n"
@@ -54,7 +56,7 @@ if [ -n "$(_git ls-remote "'${repo}'" "'${cset}'" 2>&1)" ]; then
fi
if [ ${git_done} -eq 0 ]; then
printf "Doing full clone\n"
- _git clone ${verbose} "'${repo}'" "'${basename}'"
+ _git clone ${verbose} "${@}" "'${repo}'" "'${basename}'"
fi
pushd "${basename}" >/dev/null
diff --git a/support/download/hg b/support/download/hg
index 25cb4e9d3..3af01690b 100755
--- a/support/download/hg
+++ b/support/download/hg
@@ -25,13 +25,15 @@ repo="${2}"
cset="${3}"
basename="${4}"
+shift 4 # 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)
_hg() {
eval ${HG} "${@}"
}
-_hg clone ${verbose} --noupdate "'${repo}'" "'${basename}'"
+_hg clone ${verbose} "${@}" --noupdate "'${repo}'" "'${basename}'"
_hg archive ${verbose} --repository "'${basename}'" --type tgz \
--prefix "'${basename}'" --rev "'${cset}'" \
diff --git a/support/download/scp b/support/download/scp
index 95cf502be..825fd41c6 100755
--- a/support/download/scp
+++ b/support/download/scp
@@ -23,10 +23,12 @@ shift $((OPTIND-1))
output="${1}"
url="${2}"
+shift 2 # 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)
_scp() {
eval ${SCP} "${@}"
}
-_scp ${verbose} "'${url}'" "'${output}'"
+_scp ${verbose} "${@}" "'${url}'" "'${output}'"
diff --git a/support/download/svn b/support/download/svn
index 4dcdd0623..77abf3d02 100755
--- a/support/download/svn
+++ b/support/download/svn
@@ -25,12 +25,14 @@ repo="${2}"
rev="${3}"
basename="${4}"
+shift 4 # 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)
_svn() {
eval ${SVN} "${@}"
}
-_svn export ${verbose} "'${repo}@${rev}'" "'${basename}'"
+_svn export ${verbose} "${@}" "'${repo}@${rev}'" "'${basename}'"
tar czf "${output}" "${basename}"
diff --git a/support/download/wget b/support/download/wget
index 0fc7ffa94..768de904c 100755
--- a/support/download/wget
+++ b/support/download/wget
@@ -23,10 +23,12 @@ shift $((OPTIND-1))
output="${1}"
url="${2}"
+shift 2 # 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)
_wget() {
eval ${WGET} "${@}"
}
-_wget ${verbose} -O "'${output}'" "'${url}'"
+_wget ${verbose} "${@}" -O "'${output}'" "'${url}'"