Numeric Illustration

Fixing SV4 Package dependency resolution?

Posted in Solaris by elevatorboy on June 30, 2010

If you’re using or considering using Solaris then you know that for all of its wonderful features, its antiquated package management system can be a cause for dismay & headache. Especially if you’re used to (or ever heard of ) Debian’s Apt, Red Hat’s Yum, Mandriva’s urpmi tools, or any other modern package management tool, you’re wishing that you had something similar to alleviate the dependency problems.

Of course, you may have heard of the Sun Freeware site, installed the pkg-get script and off you went installing from a third party repository of packages (not that there’s anything necessarily wrong with that). But of course Sun’s service contracts aren’t going to cover the non-Sun issue stuff you get there. And perhaps you’re just a bit paranoid about 3rd party stuff ever since you read a transcript of Ken Thompson’s Turing Award speech. Maybe you even work somewhere that has a policy which doesn’t allow this sort of thing. Maybe you just want to be a Sun purist and only use what they distribute. Whatever the reason for your need for working with the Solaris 10 distro packages, what can you do to sort them all out?  I know that pkg is coming someday.  I use it with opensolaris and so far I like it.  But for Solaris 10 its not available.  And you might even want to keep using pkgadd and friends on opensolaris.  So what now?

Glenn Brunette’s contribution to taking away some of the difficulty of this is something I consider a God-send and you (if you’re one of the rest of the over 4500 who already downloaded the SPC) may too. It lets you see what packages are in which of Sun’s install levels (Metaclusters), has some advanced dependency querying, and then some.  I found it to be really useful.  I had a project where I needed to build as minimal a system as I could, but have particular utilities for some of the tasks our servers do. It got painful trying to do this by hand, and even with Glen’s cool tool I still had to keep track of which packages I had already run down the dependencies on, aggregate my lists hopefully in the right order, and then make attempt after attempt at snapshotting, installing the packages, and fixing the order, which got messy.  So I went ahead and wrote a wrapper for Glen’s script that took the fuss out of all that.  I made it a wrapper since SPC gave me a good tool to work with, but I wanted even more. Between what the Solaris Package Companion provides natively and what the wrapper extends it to do, you can now:

  • find out given a particular install level, what you will need to add to it to support package X
  • Given an install level and a seed list of other packages that you know will be installed, what do you need to satisfy dependencies for package Y
  • outputs this list in an ordering that should fulfill all the dependencies as it goes so you can just feed this list to pkgadd and watch the magic unfold.
  • lets you resolve dependencies for packages from the Companion disk (those SFWblah packages that have a lot of the GNU goodness you are used to)
  • turn on verbosity and watch ascii text scroll by voluminously (ooohhh, text…)

The script is in all likelihood not perfect, but I tried to do a good job, I had fun (its recursive), discovered a bug with particular Solaris packages, and increased in my understanding of Bash scripting and Unix tempfile-fu in the process. I’m publishing the script here so that anyone who wants something like this can take it for a spin and see if it helps out. I’d also appreciate any feedback you care to offer. I of course offer it with no warranty or implied liability for what you do with it, or what it does to you. Thanks for checking it out and may your SVR4 package management be less of a headache.

To Use it you will have to follow the instructions on the SPC page to initialize your repo (I believe my script expects that you did a repo based on the packages on the distribution, not just what you happened to have installed), and set up the variables in the beginning that tell the script were you put the solaris package companion script, where the repo is for it, and if you want to check SFW packages, where the sfw distribution cd is mounted with a path to the packages directory for your architecture.  Then run it with no options to see the usage statement, and experiment and hopefully use it to your advantage to generate minimal system package lists, or figure out what packages you need to install Oracle 11G R2 on that swanky new Solaris 10 install you just set up…

Where can you find it?  I put it up over at Google code.  Version 0.1.2 is available for download, and also in a mercurial repo.  Linked here pkgrez.  Enjoy!

Future plans:

  • add capability to create a repo for spc to use so that you can just drop in this and spc, mount your iso or insert it in the drive, and go
  • add ability to switch between various releases of Solaris 10.  Thus far I’ve only used it with u7 and u8

Mike

Advertisements
Tagged with: , ,