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:

  ... distribution archives ...

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:

  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:// [default,nosync]

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) {

set portfetch::mirror_sites::sites(macports_distfiles) {

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