Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] Add proxy download support
@ 2014-10-21 14:53 Karoly Kasza
  2014-10-21 16:49 ` Yann E. MORIN
  2014-10-24 23:23 ` Yann E. MORIN
  0 siblings, 2 replies; 9+ messages in thread
From: Karoly Kasza @ 2014-10-21 14:53 UTC (permalink / raw)
  To: buildroot

This patch adds support for downloading sources over a http proxy.
Supports wget with http, https & ftp targets, bzr, hg, svn.
Git does work with forcing https instead of git protocol.
Cvs is not supported, but Buildroot does not currently have any
packages relying on cvs repos (plus this would fall back to the
Buildroot mirror over http).

Signed-off-by: Karoly Kasza <kaszak@gmail.com>
---
 Config.in                |   25 +++++++++++++++++++++++++
 Makefile                 |    9 +++++++++
 support/download/wrapper |   26 ++++++++++++++++++++++++++
 3 files changed, 60 insertions(+)

diff --git a/Config.in b/Config.in
index 9cefcbc..2e2b493 100644
--- a/Config.in
+++ b/Config.in
@@ -253,6 +253,31 @@ config BR2_CPAN_MIRROR
 
 endmenu
 
+config BR2_PROXY
+	bool "Use http proxy"
+	help
+	  Use a http proxy when downloading sources with various protocols.
+
+if BR2_PROXY
+
+config BR2_PROXY_URL
+	string "Http proxy URL"
+	help
+	  Http proxy URL in the form of <IP or FQDN>:<port>.
+
+config BR2_PROXY_USER
+	string "Http proxy username"
+	help
+	  Http proxy username (if needed).
+
+config BR2_PROXY_PASS
+	string "Http proxy password"
+	help
+	  Http proxy password (if needed).
+	  PLEASE NOTE! This password will be saved in the .config file!
+
+endif
+
 config BR2_JLEVEL
 	int "Number of jobs to run simultaneously (0 for auto)"
 	default "0"
diff --git a/Makefile b/Makefile
index 907a0fc..5dd40e8 100644
--- a/Makefile
+++ b/Makefile
@@ -338,6 +338,15 @@ TARGET_SKELETON = $(TOPDIR)/system/skeleton
 # should not be used as the root filesystem.
 TARGET_DIR_WARNING_FILE = $(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
 
+ifeq ($(BR2_PROXY),y)
+BR_PROXY_URL = $(call qstrip,$(BR2_PROXY_URL))
+export BR_PROXY_URL
+BR_PROXY_USER = $(call qstrip,$(BR2_PROXY_USER))
+export BR_PROXY_USER
+BR_PROXY_PASS = $(call qstrip,$(BR2_PROXY_PASS))
+export BR_PROXY_PASS
+endif
+
 ifeq ($(BR2_CCACHE),y)
 CCACHE := $(HOST_DIR)/usr/bin/ccache
 BR_CACHE_DIR = $(call qstrip,$(BR2_CCACHE_DIR))
diff --git a/support/download/wrapper b/support/download/wrapper
index 8ae2797..b224474 100755
--- a/support/download/wrapper
+++ b/support/download/wrapper
@@ -44,6 +44,32 @@ tmpf="${tmpd}/output"
 # Doing the 'cd' here rather than in all helpers is easier.
 cd "${tmpd}"
 
+# Set the proxy environment variables.
+# cvs doesn't support proxies OOB, but there is currently no cvs
+# based package in Buildroot. Also, in that case after the download
+# fails, the wget method would be used from sources.buildroot.net.
+if [ -n "${BR_PROXY_URL}" ]; then
+# SVN does not support http_proxy environment variables, so we use
+# it's commandline arguments
+proxy_host=`echo $BR_PROXY_URL | cut -d":" -f1`
+proxy_port=`echo $BR_PROXY_URL | cut -d":" -f2`
+SVN="${SVN} --config-option servers:global:http-proxy-host=${proxy_host} \
+--config-option servers:global:http-proxy-port=${proxy_port}"
+if [ -n "${BR_PROXY_USER}" ] && [ -n "${BR_PROXY_PASS}" ]; then
+SVN="${SVN} --config-option servers:global:http-proxy-username=${BR_PROXY_USER} \
+--config-option servers:global:http-proxy-password=${BR_PROXY_PASS}"
+proxy="http://${BR_PROXY_USER}:${BR_PROXY_PASS}@${BR_PROXY_URL}"
+else
+proxy="http://${BR_PROXY_URL}"
+fi
+export http_proxy=${proxy}
+export https_proxy=${proxy}
+export ftp_proxy=${proxy}
+# While git does support http_proxy environment variables, we need to use
+# the config option below to force proxying over https instead of git
+GIT="${GIT} -c url.https://.insteadOf=git://"
+fi
+
 # If the helper fails, we can just remove the temporary directory to
 # remove all the cruft it may have left behind. Then we just exit in
 # error too.
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-10-26 10:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-21 14:53 [Buildroot] [PATCH 1/1] Add proxy download support Karoly Kasza
2014-10-21 16:49 ` Yann E. MORIN
2014-10-21 18:23   ` Károly Kasza
2014-10-21 20:25     ` Yann E. MORIN
2014-10-21 21:35       ` Arnout Vandecappelle
2014-10-22  9:29       ` Károly Kasza
2014-10-24 23:23 ` Yann E. MORIN
2014-10-25  6:36   ` Károly Kasza
2014-10-26 10:38   ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox