How to build a Package archive for Darktable

It occurred to me that while I’ve got a package manifest for Solaris 11 builds of Darktable included in the git repo, I haven’t provided any details on how to actually turn what you install into $PREFIX into an installable package.

At the widest, least-focused view, you create a repo, spin up a pkg.depotd over that repo and then pkgsend to it. Simple!

So having built the bits, you’re given this message:

Darktable finished building, to actually install darktable you need to type:
# cd build; sudo make install

Following those instructions (noting that on Solaris you need to use gmake), you’ll find yourself with built objects under /opt/darktable. Now you need to create the repo:

# /usr/bin/pkgrepo create /scratch/src/REPO
# /usr/bin/pkgrepo add-publisher -s /scratch/src/REPO JMCP

This creates a repo rooted at /scratch/src/REPO, and gives it a publisher attribute of JMCP. You can some information about this repo by using the info subcommand to pkgrepo:

root@build:~# /usr/bin/pkgrepo info -s /scratch/src/REPO
PUBLISHER PACKAGES STATUS           UPDATED
JMCP      9        online           2012-03-14T22:39:46.655791Z
root@build:~# /usr/bin/pkgrepo info -s http://localhost:24601
PUBLISHER PACKAGES STATUS           UPDATED
JMCP      9        online           2012-03-14T22:39:46.655791Z
#
root@build:~# /usr/bin/pkgrecv -s http://localhost:24601 --newest
pkg://JMCP/darktable/darktable@1.0,1.0.0:20120314T223944Z
pkg://JMCP/darktable/darktable-git@0.9.3,1.0.0:20120305T134755Z
pkg://JMCP/darktable/library/OpenEXR@1.7.0,1.0.0:20120130T161629Z
pkg://JMCP/darktable/library/exiv2@0.22,1.0.0:20120130T161616Z
pkg://JMCP/darktable/library/flickcurl@1.22,1.0.0:20120130T161619Z
pkg://JMCP/darktable/library/ilmbase@1.0.2,1.0.0:20120130T162615Z
pkg://JMCP/darktable/library/lcms2@2.3,1.0.0:20120130T161623Z
pkg://JMCP/darktable/library/lensfun@0.2.5,1.0.0:20120130T161625Z
pkg://JMCP/darktable/library/tiff4@4.0.0,1.0.0:20120130T161632Z

(See what I did there? :>)

Now you can spin up the pkg.depotd:

# /usr/lib/pkg.depotd -p 24601 -d /scratch/src/REPO  > /tmp/pkg.depotd.$$ 2>&1 &

I told the daemon to use port 24601, with a repo that’s rooted at /scratch/src/REPO, to send the output to a file named /tmp/pkg.depotd.$$ (where $$ is the PID of this shell), and to background itself.

After this, you need to publish the package to the repo. You’ll notice that I have several packages in my repo; these are the dependencies that I’ve built for Darktable – you can get them here.

$ sudo pkgsend publish  -s http://localhost:24601 --fmri-in-manifest -d / /scratch/src/photostuff/darktable/fromgit/1.0/packaging/Solaris_11/darktable-manifest.pkg5
Password:
PUBLISHED
pkg://JMCP/darktable/darktable@1.0,1.0.0:20120314T223944Z

This pkgsend command publishes the package with a manifest found in /scratch/src/photostuff/darktable/fromgit/1.0/packaging/Solaris_11/darktable-manifest.pkg5 (which includes the pkg fmri) to the depot operating at http://localhost:24601, and looks for the files specified in the manifest starting at the root of my filesystem. When successful, the result is as you see above: the fully-specified pkg fmri.

On my client system I can then (after enabling the JMCP publisher), utter

# pkg install pkg://JMCP/darktable/darktable

and I’ll get the latest version of the package installed.

The tedious part is turning the output from sudo gmake install > install.log 2>&1 into a manifest. However, once you’ve got a basic version figured out, you can make use of /usr/bin/pkgfmt and /usr/bin/pkglint to help you iron out the bugs.

Version 1.0 of Darktable is just around the corner, so I expect to be making a new version of the package available at the usual location within a day of the announcement.