Monday, August 30, 2010

New SolView

I've just released a new version of SolView. This version cleans up the code used to display SVR4 packaging, and makes a couple of improvements to the Jumpstart profile builder.

Nothing earth-shattering, but I made the list of packages and clusters sorted, which makes it a lot easier to find things. And, to make that less necessary, I implemented recursive removal of packages: if you remove a package, it removes anything that depends on that package as well, keeping the package dependency graph self-consistent.

There are various ways to make sorting work, and I had put together a couple of Comparator classes before doing it properly. The proper way is just to implement Comparable in the classes that need sorting. And in most cases the actual comparison is trivial - we're just comparing the name, which is just a String. (For patches it's a 2-stage numerical comparison of the patch id and revision, but still simple.)

Once Comparable is implemented, then all I need to do is replace Set with TreeSet and everything sorts. Simple, obvious, and something I should have done much earlier.

Of course, there's no point in learning something like this and then only using it the once. So there's a new version of JKstat in which the Kstat class implements Comparable, which immediately gets the output from some of the JKstat demos sorted. (And sorted correctly - there is a specific Comparator in use here, to sort names like sd0 which contain numbers correctly: the numerical part is sorted separately and as a number, so that sd2 comes before sd10.)

2 comments:

Anonymous said...

is SolView supported only on Solaris 10, or what about Opensolaris / Illumos?

There is a general revolt in progress against IPS...

Peter Tribble said...

Most of SolView doesn't care, but the packaging stuff is SVR4-only, it doesn't handle IPS at all. So the packaging stuff isn't applicable to the OpenSolaris distro - as illumos is packaging neutral, whether we undertsand packaging depends on what downstream distros choose. For example, nexenta is debian based, so we don't understand packaging there either.