[MacPorts] #13158: Proxy support removed in new Macports 1.5
MacPorts
trac at macosforge.org
Wed Mar 26 21:13:24 PDT 2008
#13158: Proxy support removed in new Macports 1.5
-----------------------------------+----------------------------------------
Reporter: expiation at devils.com | Owner: macports-tickets at lists.macosforge.org
Type: defect | Status: new
Priority: Normal | Milestone: MacPorts base bugs
Component: base | Version: 1.5.0
Resolution: | Keywords:
-----------------------------------+----------------------------------------
Comment (by smith.kennedy at gmail.com):
Follwoing up from my comment yesterday (annoying problems with Trac and
WordPress and my account email having a "+macosforge at gmail.com" suffix
that I just resolved) I tried adding lines to the top of
/opt/local/bin/port like so, and it seems to work in locations with and
without HTTP proxies set (I couldn't put the statements on separate lines
- tclsh seems to get angry and bail out when I format it in a more nice
manner):
{{{
#!/bin/sh
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c
-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4 \
if [ `scutil --proxy | grep HTTPEnable | cut -d : -f 2 | cut -c 2-` -eq 1
]; then http_proxy=`scutil --proxy | grep HTTPProxy | cut -d : -f 2 | cut
-c 2-`:`scutil --proxy | grep HTTPPort | cut -d : -f 2 | cut -c 2-`;
export http_proxy; fi
#\
if [ `scutil --proxy | grep FTPEnable | cut -d : -f 2 | cut -c 2-` -eq 1
]; then http_proxy=`scutil --proxy | grep FTPProxy | cut -d : -f 2 | cut
-c 2-`:`scutil --proxy | grep FTPPort | cut -d : -f 2 | cut -c 2-`; export
FTP_PROXY; fi
#\
exec /usr/bin/tclsh "$0" "$@"
# port.tcl
}}}
It seems to work on Mac OS 10.4 and 10.5 - not sure about earlier versions
but I will check on a test system tomorrow. I tried implementing it in
tcl, but I haven't ever written tcl before, and my efforts to set
environment variables in a tcl script failed. Here is my failed (and
likely very ugly) attempt:
{{{
#Set proxies according to System Configuration Framework settings
set http_proxy ""
set FTP_PROXY ""
set http_proxy_enabled [exec scutil --proxy | grep HTTPEnable | cut -d :
-f 2 | cut -c 2-]
if { $http_proxy_enabled == 1 } {
set http_proxy [exec scutil --proxy | grep HTTPProxy | cut -d : -f 2 |
cut -c 2-]:[exec scutil --proxy | grep HTTPPort | cut -d : -f 2 | cut -c
2-]
set http_proxy
}
set ftp_proxy_enabled [exec scutil --proxy | grep FTPEnable | cut -d : -f
2 | cut -c 2-]
if { $ftp_proxy_enabled == 1 } {
set FTP_PROXY [exec scutil --proxy | grep FTPProxy | cut -d : -f 2 |
cut -c 2-]:[exec scutil --proxy | grep FTPPort | cut -d : -f 2 | cut -c
2-]
}
puts "http_proxy = $http_proxy"
puts "FTP_PROXY = $FTP_PROXY"
set env("http_proxy") {$http_proxy}
set env("FTP_PROXY") {$FTP_PROXY}
}}}
Any patches in this vein would be appreciated, as I prefer to not have to
maintain patched copies of software (if I did, I wouldn't bother reporting
my changes...)
--
Ticket URL: <http://trac.macosforge.org/projects/macports/ticket/13158#comment:12>
MacPorts </projects/macports>
Ports system for Mac OS
More information about the macports-tickets
mailing list