Changeset 98574


Ignore:
Timestamp:
Oct 9, 2012, 6:03:38 AM (12 years ago)
Author:
blair@…
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 "/".

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portfetch.tcl

    r98109 r98574  
    280280# Perform a bzr fetch
    281281proc portfetch::bzrfetch {args} {
    282     global patchfiles
    283     if {[catch {command_exec bzr "" "2>&1"} result]} {
    284         return -code error [msgcat::mc "Bazaar checkout failed"]
     282    global env patchfiles
     283
     284    # Behind a proxy bzr will fail with the following error if proxies
     285    # listed in macports.conf appear in the environment in their
     286    # unmodified form:
     287    #   bzr: ERROR: Invalid url supplied to transport:
     288    #   "proxy.example.com:8080": No host component
     289    # Set the "http_proxy" and "HTTPS_PROXY" environmental variables
     290    # to valid URLs by prepending "http://" and appending "/".
     291    if {   [info exists env(http_proxy)]
     292        && [string compare -length 7 {http://} $env(http_proxy)] != 0} {
     293        set orig_http_proxy $env(http_proxy)
     294        set env(http_proxy) http://${orig_http_proxy}/
     295    }
     296
     297    if {   [info exists env(HTTPS_PROXY)]
     298        && [string compare -length 7 {http://} $env(HTTPS_PROXY)] != 0} {
     299        set orig_https_proxy $env(HTTPS_PROXY)
     300        set env(HTTPS_PROXY) http://${orig_https_proxy}/
     301    }
     302
     303    try {
     304        if {[catch {command_exec bzr "" "2>&1"} result]} {
     305            return -code error [msgcat::mc "Bazaar checkout failed"]
     306        }
     307    } finally {
     308        if ([info exists orig_http_proxy]) {
     309            set env(http_proxy) ${orig_http_proxy}
     310        }
     311        if ([info exists orig_https_proxy]) {
     312            set env(HTTPS_PROXY) ${orig_https_proxy}
     313        }
    285314    }
    286315
Note: See TracChangeset for help on using the changeset viewer.