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

Florian Festi ffesti at
Mon Nov 23 10:26:09 UTC 2009

On 11/18/2009 09:52 PM, Fulko Hew wrote:
> 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:
> %post
> VER=`rpm -q other_package --queryformat'%{VERSION}'
> if VER>  1.2 then
>     do something
> else
>     do something different
> fi
Isn't there a file or directory like /usr/share/PKGNAME-VERSION you can 
test against?

Also be aware that the version comparison is a bit tricky in RPM. If you 
control the package you are testing against you might be fine.


More information about the Rpm-list mailing list