local macports (darwinports) repository, granting a network access

It's quite easy to create a local MacPorts repository. Unfortunately, the documentation doesn't say how to share the repository with others. After trials, errors and reading the source code, I've found the answer: the only way is rsync.

My first optimistic attempt was to use the http protocol. In /opt/local/etc/macports/sources.conf I added:

http://myserver.localdomain/myports

The synchronization command (port sync) run successfully. But installing a port raised a mysterious error message:

$ sudo port install myportname
Error: Unable to open port: Port extract failed: 
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors

The real reason of the problem is that the port file was missed on the file system. In theory, the port files are downloaded during the synchronization process. In practice, when the protocol is http, the system downloads only the file PortIndex and doesn't recursively get other files.

According to the sources, the only protocol when the whole ports tree is downloaded is rsync.

Categories: Mac

Updated: