how to get version of package 'x' when installing package 'y'

Fulko Hew fulko.hew at
Wed Nov 18 20:52:59 UTC 2009

Here's my dilemma (maybe I'm taking the wrong approach)...

In the spec file for 'mypackage', I want to have a shell script as part of
the %post
that does something based on the version of _another_ of my (already
installed) packages

in pseudo code:


VER=`rpm -q other_package --queryformat'%{VERSION}'
if VER > 1.2 then
   do something
   do something different

The trouble is that the RPM (or the version on my target (V4.0)) doesn't
allow me to run rpm when rpm is already running (trying to install my

It complains about the database, etc. (I'm omitting the actual error
because I don't think it will help.

Its probably rpm protecting itself.  In my case the 2nd running is
read-only, but rpm doesn't care about that.

I can't really make it a 'dependency' on a version because I'd like the
%post to make an intelligent decision.

Am I doing this wrong?  Is there a better way? Do I need a newer 'rpm'?
Am I out of luck?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Rpm-list mailing list