[CentOS] RPM/YUM on CentOS 5.4 issue - multiple versions of the same package installed

Thu Nov 11 13:47:02 UTC 2010
Gabriel Tabares <gabriel.tabares at roboreus.com>

Hi all,

We currently have an issue with multiple versions of a custom package 
being installed. The RPM contains a liquibase script (a Java-based DB 
change management tool) and a %post script to run liquibase.

We are installing with scripts that run "yum update liquibase-script".

If the %post script runs correctly, it returns 0 and the application 
gets installed correctly but, if the %post script fails, it returns -1 
and the application does get installed, but the old one does not get 
unistalled, so if I run "rpm -qa | grep liquibase-script" I get a list 
of all the versions that have been installed.

I know that the files have been installed correctly, as the RPM contents 
have the same name but different content and I have checked it.

Why is this happening?

I thought that %post scripts failing do not prevent the application to 
installing and that RPM installation is atomic, so installing one 
package will remove the previous verison. Is there any way to prevent 
this issue?

We're using CentOS 5.4 on x86_64

Thanks

Gabriel