setting up a local macports repository

Many OSes have port systems, Mac OS X has too. Macports provides a lot of useful software, but not all. If a software can't be in the macports for some reason (for example, the software isn't intended for public), one has to setup a local macports repository.

Private Portfiles

For one-computer use, there is no need for a complete setup. There is enough to say something like "sudo port install -d -v" in the directory with a Portfile.

For details, see the official documentation. For introduction, read the book "Mac OS X Tiger for Unix Geeks", the chapter "Creating and Installing Packages", section "Creating DarwinPorts packages".

What is required

1) I use the following structure for the local repository:


files/
  ... distribution archives ...
ports/
  PortIndex
  myorg/
    port1
    ...
    portN
  _resources/
    port1.0/
      fetch/
        mirror_sites.tcl
      group/
        syspython25-1.0.tcl
        syspython26-1.0.tcl

2) Access to the local ports server is available only through rsync (01.02.2010: probably things changed). A possible content of /etc/rsyncd.conf:


[orgmacports]
  path = ....../ports
  comment = My Organization MacPorts, the port files
  exclude = .** **~

To check: "rsync rsync://myhost.mydomain/orgmacports/". This lists the content of the directory "ports".

3) Unfortunately, macports system can't download files through rsync (01.02.2010: maybe already able to). Therefore, share the content of "files" through FTP or HTTP.

4) Define the repository in "/opt/local/etc/macports/sources.conf":


rsync://rsync.macports.org/release/ports/ [default,nosync]
rsync://myhost.mydomain/orgmacports/

Note that I've added "nosync" to the main macports reposotory: playing with the local repository, one says "sync" often, and no-sync for the main repo safes time.

To check, execute "$ sudo port -v sync". The output should contain a note about synchronitzation with the local repository.

Inside _resources

I do not remember exactly why I had to add the file "mirror_sites.tcl" (nothing worked without this file). Also, I removed a lot of code, so the current version looks so:


# $Id$
namespace eval portfetch::mirror_sites { }

set portfetch::mirror_sites::sites(macports) {
    http://svn.macports.org/repository/macports/distfiles/
    http://svn.macports.org/repository/macports/distfiles/general/:nosubdir
    http://svn.macports.org/repository/macports/downloads/
}

set portfetch::mirror_sites::sites(macports_distfiles) {
    http://distfiles.macports.org/:mirror
    http://trd.no.distfiles.macports.org/:mirror
    http://arn.se.distfiles.macports.org/:mirror
}

The files "syspython25-1.0.tcl" and "syspython26-1.0.tcl" are my private groups, which define the settings to compile modules for the system python.

Categories: Mac

Updated: