Right. So here's a foolish plan: I want to publish some OpenSolaris packages to the world. They are not ready for SourceJuicer (submissions there are slightly complicated, and the forest of KDE packages I'm producing is tedious and time-consuming to import there). Last time I tried that publishing thing, I did it on a package server on an OSOL machine at the end of my own DSL line, which pretty much immediately spanked my bandwidth completely. So I want to do it on a machine with better connections.

It may surprise some that all the real servers I have run FreeBSD. I use OSOL as my main desktop operating system. There must be historical reasons for this. In any case, that means building the OpenSolaris IPS package server pkg.depotd on FreeBSD. It turns out to be relatively straightforward, as most of the actual server is written in Python (yay!) and there's only a few bits of C in there. So my approach was:

  • Fetch the sources for pkg as documented on the pkg project page (thank you Alan Coopersmith),
  • Install necessary development tools on my FreeBSD machine:
    portinstall py-openssl py-cherrypy intltool gnome-doc
    portinstall py25-mako py25-simplejson
  • Run gmake. At this point I realised that the makefile has some bugs leading to No rule to make target `help/C/package-manager.xml' -- there is some semi-complicated implicit target stuff going on in there. I built the needed files by hand with
    cd gui
    msgfmt -o help/C/C.mo help/C/C.po
    xml2po -t help/C/C.mo -o help/C/package-manager.xml help/C/package-manager.xml.in

    and stripped out the locales that I didn't need.
  • Build extract_hostid by hand with
    cd util/misc
    cc extract_hostid.c -o extract_hostid -L/usr/local/lib -R/usr/local/lib -lintl

    This is needed because gettext lives in /usr/local on FreeBSD and the Makefile (obviously) assumes the OSOL setup.
  • Fix the top-level makefile to use python from /usr/local/bin and run gmake again.
  • Patch setup.py to support FreeBSD -- there looks to be support for sunos, linux, windows and darwin already (!?). This takes a patch at lines 102 and 194. Run gmake again.
  • Run gmake install
  • Finally,
    cd gate/proto/root_freebsd_amd64
    PYTHONPATH=`pwd`/usr/lib/python2.4/vendor-packages:
    sh usr/lib/pkg.depotd -d ~/pkg/ips -p 10000

And there you have it. FreeBSD machines serving up OpenSolaris packages. For the purposes of KDE4 on Solaris, this means that pkg.bionicmutton will soon be returning and you will be able to install IPS packages instead of having to compile everything from source yourself. YMMV, contains rabid weasels, etc.

[[ And, as an addendum, let me congratulate the pkg / IPS team on the enormous improvement in the packaging system between OSOL 2008.11 and 2009.6; it used to be "ugh" and has reached, for me at least, a level of "hey, that's pretty neat." ]]