Monday, January 12, 2009

Submitting packages to pending/

The OpenSolaris pending/ and contrib/ repos are open.

As a result, I was asked to document the procedure for turning a bunch of useless source in to a useful package. After wading through a bunch of occasionally outdated information, here's what I came up with.

Step 1:
Install the JDS cbe from http://dlc.sun.com/osol/jds/downloads/cbe/
update: and run cbe-install ( thanks Luca )

$ cd /opt
$ wget http://dlc.sun.com/osol/jds/downloads/cbe/jds-cbe-1.6.2-i386.tar.bz2 -O /tmp/jdscbe.tar.bz2
$ bzcat /tmp/jdscbe.tar.bz2 | tar -xf -
$ cd jdscbe-1.6.2; ./cbe-install
Step 2:
Make your spec file.

The Fedora project publishes a collection of them, props to them for that. I didn't find much utility in them simply because OpenSolaris and Fedora are quite different, but I'd just as soon chalk that up to a personal failing. I found the spec-files-extra repository to be a much more useful resource for templates.

You will need to strip out plenty of %include directives, since they're not really relevant to not-sfe files. The sections should be pretty self-explanatory, and the people on the mailing lists and irc channels are helpful if you don't understand something.

Just for posterity, the spec file I submitted is here. It just copies some files in to apache's wwwroot.

Step 3:
Set up your environment, and build with pkgtool ( Let's use Drupal as an example)

$ . /opt/jdsbld/bin/env.sh
$ pkgtool build --download drupal.spec

TEST

then uninstall the SysVR4 package

$ pfexec pkgrm drupal


Step 4:

make a local package repo:

$ pfexec svccfg -s pkg/server "setprop pkg/port=10000"
$ pfexec svcadm refresh pkg/server
$ pfexec svcadm enable pkg/server
$ pfexec svcadm restart pkg/server


and add your local repo as a pkg(5) authority

$ pfexec pkg set-authority -O http://localhost:10000 localhost

Step 5:

add your package to your local repo.

$ eval `pkgsend open drupal@6.8`
$ pkgsend import /export/home/johns/packages/PKGS/drupal/
$ pkgsend close

and install your package with pkg(1) and test again.

$ pfexec pkg install drupal

Step 6:

Everything work? License in the .spec file is kosher? Excellent.

You're ready to submit your .spec file to sw-porters-discuss@opensolaris.org (you'll need to subscribe first as it is set to auto-reject nonsubscribers). Send a friendly email including your .spec file and they'll take it from there.