From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2] package infra: add mirror support
Date: Tue, 18 Oct 2011 21:05:35 +0200 [thread overview]
Message-ID: <201110182105.35457.arnout@mind.be> (raw)
In-Reply-To: <1318947295-24677-1-git-send-email-gustavo@zacarias.com.ar>
On Tuesday 18 October 2011 16:14:54, Gustavo Zacarias wrote:
> Add FOO_MIRROR support for packages that have different URLs to fetch
> from, for redundancy or when they move to an obsolete/old directory when
> a new version pops up.
> Only implement for WGET methods.
>
> Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
> ---
> package/Makefile.package.in | 26 +++++++++++++++++++++++---
> 1 files changed, 23 insertions(+), 3 deletions(-)
>
> diff --git a/package/Makefile.package.in b/package/Makefile.package.in
> index b5ef57b..b9b5181 100644
> --- a/package/Makefile.package.in
> +++ b/package/Makefile.package.in
> @@ -207,10 +207,12 @@ endef
>
> # DOWNLOAD -- Download helper. Will try to download source from:
> # 1) BR2_PRIMARY_SITE if enabled
> # 2) Download site
>
> -# 3) BR2_BACKUP_SITE if enabled
> +# 3) Download mirror
> +# 4) BR2_BACKUP_SITE if enabled
>
> #
> # Argument 1 is the source location
> # Argument 2 is the source filename
>
> +# Argument 3 is the mirror location
Argument 3 will be $($(PKG)_MIRROR) in all calls, so there is no need to
make it an argument. Just use $($(PKG)_MIRROR) directly, like it is done
for $($(PKG)_SITE_METHOD).
>
> #
> # E.G. use like this:
> # $(call DOWNLOAD,$(FOO_SITE),$(FOO_SOURCE))
> @@ -229,6 +231,15 @@ define DOWNLOAD
> *) $(call $(DL_MODE)_WGET,$(1),$(2)) && exit ;; \
> esac ; \
> fi ; \
> + if test -n "$(3)" ; then \
You can easily support $($(PKG)_MIRRORS) (plural) with
for mirror in $($(PKG)_MIRRORS); do \
... $$mirror ...
done
This will simply skip the loop if $(3) is empty.
> + case "$($(PKG)_SITE_METHOD)" in \
> + git) exit ;; \
> + svn) exit ;; \
> + bzr) exit ;; \
> + file) exit ;; \
> + *) $(call $(DL_MODE)_WGET,$(3),$(2)) && exit ;; \
> + esac ; \
Is there a need to check for $($(PKG)_SITE_METHOD) at all? This is not
done for the BR2_BACKUP_SITE after all.
> + fi ; \
> if test -n "$(call qstrip,$(BR2_BACKUP_SITE))" ; then \
> $(call $(DL_MODE)_WGET,$(BR2_BACKUP_SITE),$(2)) && exit ; \
> fi ; \
> @@ -266,8 +277,8 @@ ifeq ($(DL_MODE),DOWNLOAD)
> (test -z $($(PKG)_PATCH) || test -e $(DL_DIR)$($(PKG)_PATCH))) || \
> $(call MESSAGE,"Downloading")
> endif
> - $(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE),$($(PKG)_SOURCE)))
> - $(if $($(PKG)_PATCH),$(call DOWNLOAD,$($(PKG)_SITE),$($(PKG)_PATCH)))
> + $(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE),$($(PKG)_SOURCE),$($(PKG)_MIRROR)))
> + $(if $($(PKG)_PATCH),$(call DOWNLOAD,$($(PKG)_SITE),$($(PKG)_PATCH),$($(PKG)_MIRROR)))
> $(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
> ifeq ($(DL_MODE),DOWNLOAD)
> $(Q)mkdir -p $(@D)
> @@ -463,6 +474,15 @@ ifndef $(2)_SITE
> endif
> endif
>
> +ifndef $(2)_MIRROR
> + ifdef $(3)_MIRROR
> + $(2)_MIRROR = $($(3)_MIRROR)
> + else
> + $(2)_MIRROR ?= \
> + http://$$(BR2_SOURCEFORGE_MIRROR).dl.sourceforge.net/sourceforge/$(1)
Err... Either it is a sourceforge package and then this will already be the
normal URL, or it is not and then this will just fail. Or am I missing
something?
> + endif
> +endif
> +
> ifndef $(2)_SITE_METHOD
> ifdef $(3)_SITE_METHOD
> $(2)_SITE_METHOD = $($(3)_SITE_METHOD)
>
Regards,
Arnout
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286540
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 31BB CF53 8660 6F88 345D 54CC A836 5879 20D7 CF43
prev parent reply other threads:[~2011-10-18 19:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-18 14:14 [Buildroot] [PATCH 1/2] package infra: add mirror support Gustavo Zacarias
2011-10-18 14:14 ` [Buildroot] [PATCH 2/2] stunnel: add mirror site Gustavo Zacarias
2011-10-18 14:22 ` [Buildroot] [PATCH 1/2] package infra: add mirror support Thomas Petazzoni
2011-10-18 14:32 ` Thomas Petazzoni
2011-10-18 15:55 ` Michael S. Zick
2011-10-18 16:00 ` Gustavo Zacarias
2011-10-18 17:27 ` Thomas Petazzoni
2011-10-18 18:01 ` Gustavo Zacarias
2011-10-18 21:38 ` Arnout Vandecappelle
2011-10-19 8:11 ` [Buildroot] Adding hashes to package recipes Thomas Petazzoni
2011-10-19 8:12 ` [Buildroot] [PATCH 1/2] package infra: add mirror support Sven Neumann
2011-10-19 9:35 ` Arnout Vandecappelle
2011-10-19 12:59 ` Thomas Petazzoni
2011-10-19 16:37 ` Michael S. Zick
2011-10-19 16:59 ` Eric Bénard
2011-10-19 22:10 ` Arnout Vandecappelle
2011-10-18 16:02 ` Yann E. MORIN
2011-10-18 19:05 ` Arnout Vandecappelle [this message]
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=201110182105.35457.arnout@mind.be \
--to=arnout@mind.be \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.