[98574] trunk/base/src/port1.0/portfetch.tcl
blair at macports.org
blair at macports.org
Mon Oct 8 23:03:38 PDT 2012
Revision: 98574
http://trac.macports.org//changeset/98574
Author: blair at macports.org
Date: 2012-10-08 23:03:38 -0700 (Mon, 08 Oct 2012)
Log Message:
-----------
portfetch.tcl: support bzr checkout behind a proxy.
Behind a proxy bzr will fail with the following error if proxies
listed in macports.conf appear in the environment in their unmodified
form:
bzr: ERROR: Invalid url supplied to transport:
"proxy.example.com:8080": No host component
Set the "http_proxy" and "HTTPS_PROXY" environmental variables to
valid URLs by prepending "http://" and appending "/".
Modified Paths:
--------------
trunk/base/src/port1.0/portfetch.tcl
Modified: trunk/base/src/port1.0/portfetch.tcl
===================================================================
--- trunk/base/src/port1.0/portfetch.tcl 2012-10-09 02:20:36 UTC (rev 98573)
+++ trunk/base/src/port1.0/portfetch.tcl 2012-10-09 06:03:38 UTC (rev 98574)
@@ -279,11 +279,40 @@
# Perform a bzr fetch
proc portfetch::bzrfetch {args} {
- global patchfiles
- if {[catch {command_exec bzr "" "2>&1"} result]} {
- return -code error [msgcat::mc "Bazaar checkout failed"]
+ global env patchfiles
+
+ # Behind a proxy bzr will fail with the following error if proxies
+ # listed in macports.conf appear in the environment in their
+ # unmodified form:
+ # bzr: ERROR: Invalid url supplied to transport:
+ # "proxy.example.com:8080": No host component
+ # Set the "http_proxy" and "HTTPS_PROXY" environmental variables
+ # to valid URLs by prepending "http://" and appending "/".
+ if { [info exists env(http_proxy)]
+ && [string compare -length 7 {http://} $env(http_proxy)] != 0} {
+ set orig_http_proxy $env(http_proxy)
+ set env(http_proxy) http://${orig_http_proxy}/
}
+ if { [info exists env(HTTPS_PROXY)]
+ && [string compare -length 7 {http://} $env(HTTPS_PROXY)] != 0} {
+ set orig_https_proxy $env(HTTPS_PROXY)
+ set env(HTTPS_PROXY) http://${orig_https_proxy}/
+ }
+
+ try {
+ if {[catch {command_exec bzr "" "2>&1"} result]} {
+ return -code error [msgcat::mc "Bazaar checkout failed"]
+ }
+ } finally {
+ if ([info exists orig_http_proxy]) {
+ set env(http_proxy) ${orig_http_proxy}
+ }
+ if ([info exists orig_https_proxy]) {
+ set env(HTTPS_PROXY) ${orig_https_proxy}
+ }
+ }
+
if {[info exists patchfiles]} {
return [portfetch::fetchfiles]
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20121008/5e2fc4ad/attachment-0001.html>
More information about the macports-changes
mailing list