Changeset 98109


Ignore:
Timestamp:
Sep 25, 2012, 7:57:51 AM (12 years ago)
Author:
blair@…
Message:

portfetch.tcl: pass to svn cmd line arguments to use HTTP or HTTPS proxies.

File:
1 edited

Legend:

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

    r95616 r98109  
    338338}
    339339
     340# Given a URL to a Subversion repository, if the URL is http:// or
     341# https:// and MacPorts has been configured with a proxy for that URL
     342# type, then return command line options that should be passed to the
     343# svn command line client to enable use of that proxy.  There are no
     344# proxies for Subversion's native protocol, identified by svn:// URLs.
     345proc portfetch::svn_proxy_args {url} {
     346    global env
     347
     348    if {   [string compare -length 7 {http://} ${url}] == 0
     349        && [info exists env(http_proxy)]} {
     350        set proxy_parts [split $env(http_proxy) :]
     351        set proxy_host [lindex $proxy_parts 0]
     352        set proxy_port [lindex $proxy_parts 1]
     353        return "--config-option servers:global:http-proxy-host=${proxy_host} --config-option servers:global:http-proxy-port=${proxy_port}"
     354    } elseif {   [string compare -length 8 {https://} ${url}] == 0
     355              && [info exists env(HTTPS_PROXY)]} {
     356        set proxy_parts [split $env(HTTPS_PROXY) :]
     357        set proxy_host [lindex $proxy_parts 0]
     358        set proxy_port [lindex $proxy_parts 1]
     359        return "--config-option servers:global:http-proxy-host=${proxy_host} --config-option servers:global:http-proxy-port=${proxy_port}"
     360    } else {
     361        return ""
     362    }
     363}
     364
    340365# Perform an svn fetch
    341366proc portfetch::svnfetch {args} {
     
    349374        append svn.url "@${svn.revision}"
    350375    }
    351     set svn.args "${svn.method} ${svn.args} ${svn.url}"
     376
     377    set proxy_args [svn_proxy_args ${svn.url}]
     378
     379    set svn.args "${svn.method} ${svn.args} ${proxy_args} ${svn.url}"
    352380
    353381    if {[catch {command_exec svn "" "2>&1"} result]} {
Note: See TracChangeset for help on using the changeset viewer.