Another problem is that in x86-64 environments both 32-bit and 64-bit versions of some packages are required.
Within my consultancy business I also have a requirement when generating documentation for a list of required packages and a list of actual packages. These lists are tedious to type in and consequently very error prone.
So I decided to do something about it.
My first approach was to develop an RPM and use the in-built RPM dependency checking algorithm to check versions. It took a while to figure out how to create a spec file for the rpmbuild utility, but eventually I managed to create a package. However, when I tried to extend the package to handle both 32-bit and 64-bit architectures I discovered that there is a fundamental flaw in RPM - it only appears to work for the architecture on which it is created - I could not find a way to specify packages of another architecture (i386 etc) in the requires directive of the spec file. Getting RPM enhanced might be possible, but I have better things to do with my life and there would still be an issue with compatibility on legacy systems.
However, I did manage to find the source files for RPM and discovered that it uses a library function called rpmvercmp to compare first versions and then releases for packages. A quicker option was to convert the C code into Perl. I like Perl because it is usually available on any Unix-based Oracle environment. My Perl skills are not great, but I managed to develop a working comparison algorithm within a few hours.
The next problem was to provide the Perl script with a list of required packages together with their architectures and minimum versions. XML was an obvious choice but I needed to confirm it would work with Perl. In fact there are several XML options with Perl - I originally implemented the utility using the XML::Simple package. However, this meant it was necessary to install the perl-XML-Simple package in order to run the checker, requiring a change control at some sites. I decided this would be an unnecessary restriction, so I rewrote the XML parser components in Perl.
The rpmcheck utility is supplied with a set of XML definition files. Each file is based on:
I think this provides sufficient granularity. At present I have only prepared XML files for a handful of releases - I will expand these as I revisit Linux customers.
If you wish to try these scripts they can be downloaded from my website. Instructions to run the Perl script are included.
The basic procedure is:
perl rpmcheck.pl GridInfrastructure-11_2_0_2-RHEL5-x86-64.xml
The script will report if all packages are valid; if not it provide details of expected and actual (if any) versions of the packages.
Further details and sample output can be found here.
The script and XML files can be downloaded directly from here
I would definitely like some feedback on this - hopefully it can be extended to a comprehensive list of environments.