Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v4 1/7] support/download: Add support to pass options directly to downloaders
Date: Fri, 5 Aug 2016 17:54:40 +0200	[thread overview]
Message-ID: <20160805155440.GA6074@free.fr> (raw)
In-Reply-To: <1470408840-1509-2-git-send-email-romain.perier@free-electrons.com>

Romain, All,

On 2016-08-05 16:53 +0200, Romain Perier spake thusly:
> 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>

Regards,
Yann E. MORIN.

> ---
> 
> Changes in v4:
>  - Rebased onto master
>  - Pass "${@}" to "git clone --depth 1" too.
> 
> Changes in v3:
>  - Don't use the variable ${dl_opts} to catch extra arguments
>  - We prefer to use shift and "${@}", it does not introduce
>    empty string when there are no extra parameters.
> 
> Changes in v2:
>  - Replaced the variable $(PKG)_DL_REFERER by $(PKG)_DL_OPTS
>  - Add modification to all downloaders
> 
>  support/download/bzr  | 4 +++-
>  support/download/cp   | 4 +++-
>  support/download/cvs  | 4 +++-
>  support/download/git  | 6 ++++--
>  support/download/hg   | 4 +++-
>  support/download/scp  | 4 +++-
>  support/download/svn  | 4 +++-
>  support/download/wget | 4 +++-
>  8 files changed, 25 insertions(+), 9 deletions(-)
> 
> diff --git a/support/download/bzr b/support/download/bzr
> index e18b01f..75b7b41 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 09ce3d1..0ee1f3b 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 7980389..50050ab 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 416cd1b..281db61 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 25cb4e9..3af0169 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 95cf502..825fd41 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 4dcdd06..77abf3d 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 0fc7ffa..768de90 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}'"
> -- 
> 2.8.1
> 

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2016-08-05 15:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-05 14:53 [Buildroot] [PATCH v4 0/7] Add support for AMD Catalyst graphics driver Romain Perier
2016-08-05 14:53 ` [Buildroot] [PATCH v4 1/7] support/download: Add support to pass options directly to downloaders Romain Perier
2016-08-05 15:54   ` Yann E. MORIN [this message]
2016-08-05 14:53 ` [Buildroot] [PATCH v4 2/7] pkg-download: Allow packages to pass generic options to download methods Romain Perier
2016-08-05 14:53 ` [Buildroot] [PATCH v4 3/7] docs/manual: Document the variable $(PKG)_DL_OPTS Romain Perier
2016-08-05 14:53 ` [Buildroot] [PATCH v4 4/7] package/amd-catalyst: Add AMD proprietary graphic stack support Romain Perier
2016-08-05 22:00   ` Yann E. MORIN
2016-08-05 14:53 ` [Buildroot] [PATCH v4 5/7] package/amd-catalyst: Add AMD cmdline tools Romain Perier
2016-08-05 22:20   ` Yann E. MORIN
2016-08-05 22:32   ` Yann E. MORIN
2016-08-05 14:53 ` [Buildroot] [PATCH v4 6/7] package/amd-catalyst: Add support AMD CCCLE Romain Perier
2016-08-05 22:28   ` Yann E. MORIN
2016-08-05 14:54 ` [Buildroot] [PATCH v4 7/7] package/amd-catalyst: Add support for OpenCL Romain Perier
2016-08-05 22:47   ` Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160805155440.GA6074@free.fr \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox