Search code examples
proxyrvmmacports

Macports/rvm/svn connection issue behind a proxy and firewall


I am behind a corporate firewall that won't let me rsync out, and requires a proxy for HTTP/HTTPS. I'm having trouble with rvm breaking at the macports step in this environment.

To summarise:

  • I am trying to do rvm install ruby-1.9.3-p286

  • rvm wants to use macports.

  • macports wants to update using rsync, but I can't rsync out.

  • I set up a local macports source repo, but it doesn't seem to help - macports still wants to use rsync.

  • A suggestion on a similar question suggested changing port selfupdate to port sync in rvm's scripts. But that didn't help - macports then dies trying to do an svn update

  • But I can do the svn update manually fine, so I don't understand where the problem is.


Here are the details:

I followed this guide for using macports behind a firewall, by checking out the repo locally, and setting the following in /opt/local/etc/macports/sources.conf.

    #rsync://rsync.macports.org/release/tarballs/ports.tar [default]
    file:///opt/local/var/macports/sources/svn.macports.org/trunk/dports/ [default]

The only place I differed from the guide was I installed macports for 10.8 rather than 10.5.

However, rvm's macports seems to still use rsync for some reason:

$ rvm install ruby-1.9.3-p286
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p286.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Password:
DEBUG: Copying /Users/tim/Library/Preferences/com.apple.dt.Xcode.plist to 
    /opt/local/var/macports/home/Library/Preferences
DEBUG: MacPorts sources location: 
/opt/local/var/macports/sources/rsync.macports.org/release/tarballs --->  Updating MacPorts base sources using rsync
rsync: failed to connect to rsync.macports.org: Connection refused (61)
rsync error: error in socket IO (code 10) at /SourceCache/rsync/rsync-42/rsync/clientserver.c(105) [receiver=2.6.9]
Command failed: /usr/bin/rsync -rtzv --delete-after     rsync://rsync.macports.org/release/tarballs/base.tar     /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
Exit code: 10
DEBUG: Error synchronizing MacPorts sources: command execution failed
while executing
"macports::selfupdate [array get global_options] base_updated"
Error: /opt/local/bin/port: port selfupdate failed: Error synchronizing MacPorts sources: command execution failed

This is very similar to this question, where the answer suggested the following change:

$ diff -u .rvm/scripts/functions/requirements/osx_port.org .rvm/scripts/functions/requirements/osx_port
--- .rvm/scripts/functions/requirements/osx_port.org    2013-05-28 16:58:37.000000000 +0900
+++ .rvm/scripts/functions/requirements/osx_port    2013-05-28 16:58:50.000000000 +0900
@@ -82,7 +82,7 @@

 requirements_osx_port_update_system()
 {
-  __rvm_try_sudo port -dv selfupdate || return $?
+  __rvm_try_sudo port -dv sync || return $?
 }

 requirements_osx_port_define()

Unfortunately, that results in the following:

$ rvm install ruby-1.9.3-p286
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p286.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Password:
DEBUG: Copying /Users/tim/Library/Preferences/com.apple.dt.Xcode.plist to /opt/local/var/macports/home/Library/Preferences
--->  Updating the ports tree
Synchronizing local ports tree from file:///opt/local/var/macports/sources/svn.macports.org/trunk/dports/
DEBUG: /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
DEBUG: changing euid/egid - current euid: 0 - current egid: 0
svn: OPTIONS of 'http://svn.macports.org/repository/macports/trunk/dports': could not connect to server (http://svn.macports.org)
Command failed: /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
Exit code: 1
DEBUG: command execution failed
    while executing
"system $svn_commandline"
Error: Synchronization of the local ports tree failed doing an svn update
DEBUG: Synchronization of 1 source(s) failed
    while executing
"mportsync [array get global_options]"
port sync failed: Synchronization of 1 source(s) failed

Trying directly with macports:

$ port -d sync
--->  Updating the ports tree
Synchronizing local ports tree from file:///opt/local/var/macports/sources/svn.macports.org/trunk/dports/
DEBUG: /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
svn: OPTIONS of 'http://svn.macports.org/repository/macports/trunk/dports': could not connect to server (http://svn.macports.org)
Command failed: /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
Exit code: 1
DEBUG: command execution failed
    while executing
"system $svn_commandline"
Error: Synchronization of the local ports tree failed doing an svn update
DEBUG: Synchronization of 1 source(s) failed
    while executing
"mportsync [array get global_options]"
port sync failed: Synchronization of 1 source(s) failed

This is strange, because I can run that svn command fine:

 $ /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
 At revision 107532.

It's not a user permissions/profile issue, because root can run that svn command fine too:

 $ sudo /usr/bin/svn update --non-interactive /opt/local/var/macports/sources/svn.macports.org/trunk/dports
 At revision 107532.

I assume something in the chain isn't seeing the proxy correctly. However:

  • My proxy is correctly set in the http_proxy and https_proxy environment variables
  • It is also set in ~/.subversion/servers (as the variables http-proxy-host and http-proxy-port in the [global] section)
  • And it is also set in /opt/local/etc/macports/macports.conf (as the variables proxy_http and proxy_https)

Other information:

  • ruby 1.8.7
  • rvm 1.21.4
  • OSX 10.8.3
  • MacPorts 2.1.3

Let me know if there's any other information that could be useful.

My question is How can I get port sync to work in this environment? (Which I am hoping will also fix rvm)


Solution

  • As a workaround to get you going try:

    rvm autolbs read-fail
    

    It will not install packages automatically - it will fail in case any packages are missing and will let you know names of this packages, just install them manually with macports and it should be fine.


    Other solution would be switching to:

    rvm autolibs homebrew
    

    to use homebrew instead of macports, or:

    rvm autolibs rvm_pkg
    

    to detect what is already installed with pkg-config and try to install rest with the old rvm pkg install ....


    More details on autolibs: http://rvm.io/rvm/autolibs