wiki:howto/SyncingWithSVN

<- Back to the HOWTO section

How to sync your ports tree using Subversion over HTTPS

Note MacPorts has migrated to Git, the Subversion repositories are no longer updated. Please follow the how-to on syncing with Git now.

  • Audience: end users who cannot use rsync (873/tcp) due to firewalls, proxies, policy, etc.
  • Requires: MacPorts
  • Requires: Subversion

Introduction

Some people live and work behind a firewall or proxy that blocks or otherwise breaks rsync, which is the primary means of getting updated Portfiles in MacPorts. The following steps will switch your tree over to using Subversion over HTTPS for syncing.

Note: if you are using a custom prefix, you will have to replace the default of /opt/local with the location of your MacPorts install in the instructions below.

Installation

Step 0: Install Subversion

Mac OS X Leopard 10.5 and later comes with Subversion already installed, but in OS X Lion 10.7 and later, it does not trust any SSL certificates by default, which requires you to manually approve the SSL certificate. To avoid that extra setup, and to ensure you have the latest Subversion, we recommend you install the MacPorts subversion port. If you have a copy of the ports tree already, just run:

sudo port install subversion

If you do not have a copy of the ports tree, you can download the daily tarball by following the tarball howto.

Step 1: Checkout Initial Copy

cd /opt/local/var/macports/sources
mkdir -p svn.macports.org/trunk/dports
cd svn.macports.org/trunk/dports 
svn co https://svn.macports.org/repository/macports/trunk/dports/ .

Configuration

Step 2: Configure MacPorts

Edit /opt/local/etc/macports/sources.conf to comment out the rsync:// entry and add the file:/// entry:

Note: if you need to replace /opt/local with your custom prefix, make sure the initial "file:///..." contains three slashes.

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

Step 3: Configure Subversion

First, tell Subversion to use your proxy to connect to the server. This should not be necessary if your initial Subversion checkout worked, so most people should not have to do this. If initial checkout failed, you will need this. If you needed to configure your own ~/.subversion/servers file to be able to do the initial checkout, then you *do* need this step.

  1. If the /opt/local/var/macports/home/.subversion/servers file doesn't exist, create it by copying the corresponding ~/.subversion/servers file from another user to that location. (Subversion automatically creates this file if it doesn't exist, so you probably already have one.)
  2. Edit the file and set a proxy for hosts at *.macports.org. Different proxy configurations require different sets of options here, but the file is pretty well commented, so it should be easy to figure out what you need. At a minimum you'll need settings for http-proxy-host and http-proxy-port.

Finally, if you're using the copy of svn that comes bundled with OS X 10.7 or later, you'll need to tell Subversion to trust the MacPorts signature. (Apple's svn doesn't trust any SSL certificates, and port sync below invokes svn up with the --non-interactive flag, so you won't have the opportunity to accept the certificate then.)

  1. mkdir -p /opt/local/var/macports/home/.subversion/auth/svn.ssl.server
  2. As a normal user, run svn ls https://svn.macports.org/repository/macports/trunk/dports/. When prompted, accept the certificate permanently.
  3. Subversion will store the certificate in a file in the directory $HOME/.subversion/auth/svn.ssl.server. In that directory, find the file that contains the string "https://svn.macports.org" and copy it into /opt/local/var/macports/home/.subversion/auth/svn.ssl.server.

Step 4: Sync

On running your first sync you will have wait for the PortIndex to be generated, which will take some time. Subsequent runs will be faster, as only changed Portfiles need to be indexed again. Use the -v flag for verbose mode which will show you the progress of this operation.

sudo port -v sync

After this has finished, you are now receiving your Portfiles using Subversion instead of rsync.

See also

Additional topics related to MacPorts and Subversion:

<- Back to the HOWTO section

Last modified 7 years ago Last modified on Nov 1, 2016, 5:36:01 PM