Playing with IPS and SFE

5:55 pm OpenSolaris

Decided to spend some time playing around with IPS and SFE on Friday afternoon, to figure how easy it would be to contribute a package to our contributor package repository.

Set up an IPS repository

First things first, I set up a package repository locally. This was a piece of cake –

 
gman@rampage:~/# svccfg -s pkg/server "setprop pkg/inst_root=/var/repo" 
gman@rampage:~/# svcadm refresh pkg/server 
gman@rampage:~/# svcadm enable pkg/server 
gman@rampage:~/# svcadm restart pkg/server

I tweaked the default configuration through SMF, changing the install root for the repository to be /var/repo.

Install the desktop CBE

Next, I set about installing the very useful desktop CBE, version 1.7 rc1, a test version which has support for OpenSolaris, multiple compilers, and new interactive goodness in the installer.

gman@rampage:~/desktop-cbe-1.7.0-rc1# cbe-install

The CBE tools install into /opt/dtbld and mostly consist of a bunch of GNU utilities whose versions are a little bit newer than what’s on pkg.opensolaris.org.

Download SFE

Next up, was grabbing a copy of the SFE repository. SFE, or spec-files-extra, is a repository full of build recipes for various open source component, which the pkgbuild tool uses to build into a SVr4 package (native IPS packages are coming soon). SFE has just over 800 recipes at the moment – it used to be 1000+, but as packages get added to pkg.opensolaris.org, they get removed from the repository.

gman@rampage:~/# svn co https://pkgbuild.svn.sourceforge.net/svnroot/pkgbuild/spec-files-extra/trunk SFE

Build a package

I figured I’d start off building monkey-bubble, using the SFEmonkey-bubble.spec build recipe. A simple command started off the build

gman@rampage:~/SFE# pkgtool build --interactive --download SFEmonkey-bubble.spec

As it turns out, I had issues with the current version of GNU m4 on the system, and had to quickly install CBEm4 from the desktop CBE. Once it did that, I had some shiny monkey-bubble packages in ~/packages/PKGS/.

Import this package into IPS

This was by far the most tricky step, though not ridiculously so. There are a number of ways to import a package into IPS, including the pkgsend(1) command-line utility (Volker gives a good tutorial here). I decided to cheat somewhat, and use the solaris.py utility that we’ve used to import packages from the old Nevada dock. To get the gate, a simple hg(1) command is used –

gman@rampage:~/# hg clone ssh://anon@hg.opensolaris.org/hg/pkg/gate pkg

Creating the import files

While a little overkill for this purpose, I created a cluster import file, and import files for both SFEmonkey-bubble and SFEmonkey-bubble-root –

gman@rampage:~/ cat cluster.all
include SFEmonkey-bubble
gman@rampage:~/ cat SFEmonkey-bubble
package SFEmonkey-bubble
import SFEmonkey-bubble
import SFEmonkey-bubble-root
version 0.4.0
end package
gman@rampage:~/ cat SFEmonkey-bubble-root
package SFEmonkey-bubble-root
depend SFEmonkey-bubble
end package

With IPS we’ve taken the decision to merge multiple packages into a single one, and use filtering if want want to separate them eg. documentation, developer headers, licenses, etc.. I’ve decided to create a single SFEmonkey-bubble package in the IPS repository.

Run the import script

Now we’ve got everything ready, it’s a simple command to run (so long as you remember the locations of where things are!) –

gman@rampage:~/ pkg/src/util/distro-import/solaris.py -b 0.4 -w ~/packages/PKGS/ cluster.all

The command will output a bunch of stuff, but by the end of it, you’ll be able to go to http://localhost:10000 in a browser and see the SFEmonkey-bubble package in the repository.

Install the package

Now that you’ve created a repository, and seeded it with a package, it’s time to add it to your system. You’ll need to add the new repository to the list that IPS should search through, and refresh the catalog before you can install it –

gman@rampage:~/ pfexec pkg set-authority -O http://localhost:10000/ localrepo
gman@rampage:~/ pfexec pkg refresh --full
gman@rampage:~/ pfexec pkg install SFEmonkey-bubble

Refresh the desktop cache

After successfully installing it, you’ll need to do a temporary step to ensure the GConf schemas are properly installed – this is because we now have a new SMF service to update the various desktop caches, but unfortunately IPS does not yet start this service when it installs a new package yet.

gman@rampage:~/ pfexec svcadm restart desktop-cache/gconf-cache

Pull my package

The final step is to send my IPS repository URL to the maintainers of pkg.opensolaris.org/contrib, so they can run a simple command to pull in the package –

admin@pkgserver:~/ pfexec pkgrecv -s http://myrepo.com:10000/ SFEmonkey-bubble

Final thoughts

Setting up an IPS repository isn’t the hardest thing in the world, though it does show that we’ve still got a little way to go to simplify the procedure. More and more packages are continuously getting added (ARC mail archives), and over time I expect this to be much, much easier to do. With Petr’s work to make pkgbuild output native IPS packages, I’m very hopeful to see OpenSolaris really starting to provide the common packages that people are using. If you are keen to help, join the pkgbuild team and start packaging for OpenSolaris today!

Update: Petr has published a first beta release of the pkgbuild IPS conversion – go check it out!

2 Responses

  1. gman Says:

    Played with Petr’s IPS stuff for a short while – looks very, very promising (nice work Petr!), though unfortunately while it manages to pkgsend things to the local repository, I don’t seem to be able to install that package. No doubt an obvious fix, so will have a check through the code tomorrow.

  2. gman Says:

    A simple fix to Petr’s tarball fixes the problem – http://www.gnome.org/~gman/pkgbuild-ips-owner-fix.diff