Browse Source

pkg-download: Allow packages to pass generic options to download methods

Introduce a new package variable $(PKG)_DL_OPTS. When this variable
is defined, its value is passed to the downloader as options to
the underlying command. Packages can now retrieve archives from server
expecting logins and passwords, use referer url, proxy or specific
options for cloning a repository.

Signed-off-by: Romain Perier <romain.perier@free-electrons.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Romain Perier 9 years ago
parent
commit
91b34e0abc
1 changed files with 16 additions and 8 deletions
  1. 16 8
      package/pkg-download.mk

+ 16 - 8
package/pkg-download.mk

@@ -81,7 +81,8 @@ define DOWNLOAD_GIT
 		-- \
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
 		$($(PKG)_DL_VERSION) \
-		$($(PKG)_BASE_NAME)
+		$($(PKG)_BASE_NAME) \
+		$($(PKG)_DL_OPTS)
 endef
 endef
 
 
 # TODO: improve to check that the given PKG_DL_VERSION exists on the remote
 # TODO: improve to check that the given PKG_DL_VERSION exists on the remote
@@ -97,7 +98,8 @@ define DOWNLOAD_BZR
 		-- \
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
 		$($(PKG)_DL_VERSION) \
-		$($(PKG)_BASE_NAME)
+		$($(PKG)_BASE_NAME) \
+		$($(PKG)_DL_OPTS)
 endef
 endef
 
 
 define SOURCE_CHECK_BZR
 define SOURCE_CHECK_BZR
@@ -112,7 +114,8 @@ define DOWNLOAD_CVS
 		$(call stripurischeme,$(call qstrip,$($(PKG)_SITE))) \
 		$(call stripurischeme,$(call qstrip,$($(PKG)_SITE))) \
 		$($(PKG)_DL_VERSION) \
 		$($(PKG)_DL_VERSION) \
 		$($(PKG)_RAWNAME) \
 		$($(PKG)_RAWNAME) \
-		$($(PKG)_BASE_NAME)
+		$($(PKG)_BASE_NAME) \
+		$($(PKG)_DL_OPTS)
 endef
 endef
 
 
 # Not all CVS servers support ls/rls, use login to see if we can connect
 # Not all CVS servers support ls/rls, use login to see if we can connect
@@ -127,7 +130,8 @@ define DOWNLOAD_SVN
 		-- \
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
 		$($(PKG)_DL_VERSION) \
-		$($(PKG)_BASE_NAME)
+		$($(PKG)_BASE_NAME) \
+		$($(PKG)_DL_OPTS)
 endef
 endef
 
 
 define SOURCE_CHECK_SVN
 define SOURCE_CHECK_SVN
@@ -143,7 +147,8 @@ define DOWNLOAD_SCP
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
 		$(QUIET) \
 		$(QUIET) \
 		-- \
 		-- \
-		'$(call stripurischeme,$(call qstrip,$(1)))'
+		'$(call stripurischeme,$(call qstrip,$(1)))' \
+		$($(PKG)_DL_OPTS)
 endef
 endef
 
 
 define SOURCE_CHECK_SCP
 define SOURCE_CHECK_SCP
@@ -157,7 +162,8 @@ define DOWNLOAD_HG
 		-- \
 		-- \
 		$($(PKG)_SITE) \
 		$($(PKG)_SITE) \
 		$($(PKG)_DL_VERSION) \
 		$($(PKG)_DL_VERSION) \
-		$($(PKG)_BASE_NAME)
+		$($(PKG)_BASE_NAME) \
+		$($(PKG)_DL_OPTS)
 endef
 endef
 
 
 # TODO: improve to check that the given PKG_DL_VERSION exists on the remote
 # TODO: improve to check that the given PKG_DL_VERSION exists on the remote
@@ -172,7 +178,8 @@ define DOWNLOAD_WGET
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
 		$(QUIET) \
 		$(QUIET) \
 		-- \
 		-- \
-		'$(call qstrip,$(1))'
+		'$(call qstrip,$(1))' \
+		$($(PKG)_DL_OPTS)
 endef
 endef
 
 
 define SOURCE_CHECK_WGET
 define SOURCE_CHECK_WGET
@@ -185,7 +192,8 @@ define DOWNLOAD_LOCALFILES
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
 		-H $(PKGDIR)/$($(PKG)_RAWNAME).hash \
 		$(QUIET) \
 		$(QUIET) \
 		-- \
 		-- \
-		$(call stripurischeme,$(call qstrip,$(1)))
+		$(call stripurischeme,$(call qstrip,$(1))) \
+		$($(PKG)_DL_OPTS)
 endef
 endef
 
 
 define SOURCE_CHECK_LOCALFILES
 define SOURCE_CHECK_LOCALFILES