diff mbox

[3,of,6,resend] pkg-download.mk: support detection of URI schemes in DOWNLOAD

Message ID 8cbde66c4041f84f6c45.1340343756@beantl019720
State Accepted
Headers show

Commit Message

Thomas De Schampheleire June 22, 2012, 5:42 a.m. UTC
When using one of the package infrastructures, the DOWNLOAD function
uses $(PKG)_SITE_METHOD to determine the appropriate download method,
which is autodetected based on the URI if none was explicitly set.

When the DOWNLOAD function is called directly, for example when
downloading a toolchain, or from a package that does not use one of
the package infrastructures, the SITE_METHOD is not autodetected,
and thus the download defaults to wget.

This patch adds URI scheme detection directly to the DOWNLOAD method,
in case no SITE_METHOD was detected yet.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

---
 package/pkg-download.mk |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Comments

Arnout Vandecappelle July 15, 2012, 11:28 a.m. UTC | #1
On 06/22/12 07:42, Thomas De Schampheleire wrote:
> When using one of the package infrastructures, the DOWNLOAD function
> uses $(PKG)_SITE_METHOD to determine the appropriate download method,
> which is autodetected based on the URI if none was explicitly set.
>
> When the DOWNLOAD function is called directly, for example when
> downloading a toolchain, or from a package that does not use one of
> the package infrastructures, the SITE_METHOD is not autodetected,
> and thus the download defaults to wget.
>
> This patch adds URI scheme detection directly to the DOWNLOAD method,
> in case no SITE_METHOD was detected yet.
>
> Signed-off-by: Thomas De Schampheleire<thomas.de.schampheleire@gmail.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

  Maybe the default definition of PKG_SITE_METHOD can be removed then?

  Regards,
  Arnout
diff mbox

Patch

diff --git a/package/pkg-download.mk b/package/pkg-download.mk
--- a/package/pkg-download.mk
+++ b/package/pkg-download.mk
@@ -211,7 +211,12 @@  define DOWNLOAD_INNER
 		esac ; \
 	fi ; \
 	if test -n "$(1)" ; then \
-		case "$($(PKG)_SITE_METHOD)" in \
+		if test -z "$($(PKG)_SITE_METHOD)" ; then \
+			scheme="$(call geturischeme,$(1))" ; \
+		else \
+			scheme="$($(PKG)_SITE_METHOD)" ; \
+		fi ; \
+		case "$$scheme" in \
 			git) $($(DL_MODE)_GIT) && exit ;; \
 			svn) $($(DL_MODE)_SVN) && exit ;; \
 			bzr) $($(DL_MODE)_BZR) && exit ;; \