Peter's Solaris Zone

SPRATE: SVR4 Packaging Code

6 March 2011: version 0.10. Download

SPRATE is a fork of the OpenSolaris SVR4 packaging source code.

It is based on Nevada build 117, just after the SVR4 packaging source was moved into ON and thus available after an extended absence, but before Casper's turbo changes.

The reasons for forking at that point are several: I had a personal code tree that was based on a much earlier version, and the turbo changes were too large to merge; I needed to build a modified version to fix up a Solaris 10 system that didn't have the turbo update; and, while the turbo code gives some speedup in some cases it stands squarely in the way of other changes I was looking for; and the turbo code was too difficult to understand in the time I had available.

I had a specific aim to begin with when doing this: I had some Solaris 10 systems that had some packages that were in the deadly embrace of webstart. If you tried to remove them with prodreg, it said "oh no, you must use pkgrm", yet when you tried to use pkgrm it said "oh no, you must use prodreg". So one of the changes here is to eradicate the pesky call to the webstart registry.

Once I had done that, I decided to put some of the performance enhancements I knew of into the code. For example, pkgchk -l -p goes from 0.37s to 0.01s, and pkginfo -l goes from 0.52s to 0.26s. Even a straight pkginfo on a single package goes from 0.006s to 0.002s. The speed of pkgadd hasn't changed; pkgrm is a bit quicker because the webstart registry isn't queried. These are just a start, there's an awful lot of low-hanging fruit that could be picked off quite easily. (Note that much of the slowness of common packaging operations on an SVR4-packaged system has zip to do with the tools themselves.)

I then got bored one evening and started hacking out code that isn't used. There's an awful lot of that - the source hasn't had much love recently. (Let's be frank: it's a mess.) That takes about 10% of the total source out. Lots more could go. (When was the last time you installed a package from multiple floppies?)

I've since, in idle moments, started hacking around in a more brutal fashion. There's a spectacular amount of cruft here. For instance, I've now taken out all the package signing and http retrieval code: likely use cases see this code as the low-level bit-shifters, with all the fancy smarts provided by a higher-level framework. (With that higher-level framework probably written in a modern scripting language rather than C.)

The latest change is to strip out spooling support (you can do it by hand) and datastream support (which is now only understood by pkgtrans). I had actually broken datastream support anyway, so removing it doesn't make things worse. This doesn't actually change much - instead of pkgadd unpacking a datastream under the covers, you need to do it manually, but in practice I would expect higher-level tools to do that in any event - one aim here is to simplify the underlying tools, and then add a level of genuine smarts above them.

This code isn't safe. It's barely tested. It's unlikely to cooperate well with other consumers. It could easily hose your system. Don't use it unless you're absolutely sure you understand what it's doing underneath and are prepared to recover by hand.

Version History

0.00
Initial release, enough to make it compile
0.01
Initial cleanup, wiping out the most obvious cruft
0.02
More systematic removal of dead code
0.03
More dead code removal, in particular old abi stuff
0.04
More dead code removal, libadm on a diet
0.05
More dead code removal, multivolume and device support
0.06
More radical surgery - all digital signature and web support gone
0.07
More unused code removed, courtesy of lint
0.08
More unwanted code removed, mostly debug
0.09
More unwanted code removed, mostly debug. No more zones support. No patch handling.
0.10
Many lint fixes, device handling cleanups. Datastream support removed globally, and localized to pkgtrans.

Peter's Home | Zone Home