[CentOS] [YUM] - Issue on package removal order on CentOS 5

Sat Nov 5 13:22:40 UTC 2011
Olivier BONHOMME <obonhomme at nerim.net>

Hello,

I post here because I have an embarassing issue considering the yum 
version provided with CentOS 5.

I am trying to package an application for CentOS. So I wrote my own 
specfile which is composed of declaration of various packages (main 
application and plugins for this applications).

In that the configuration, the plugins RPM depends on the main 
application RPM because. Moreover, in all %postun blocks I execute a 
script which is provided my the main app RPM.

My issue is that when I try to remove the packages with the yum remove 
command, the main app RPM is erased before the plugin RPM and in that 
case the postun scriptlets for the plugin fails because my script is not 
available anymore.

As I read on the RPM and YUM doc, I used in the SPEC file the following 
instructions :

Requires(post):         mainapp >= %{version}
Requires(postun):               mainapp >= %{version}

But even with this declaration, yum removes the RPM in bad order :

Erasing        : mainapp 1/2
Erasing        : mainapp-plugin 2/2

/var/tmp/rpm-tmp.48257: line 1: /usr/sbin/mainapp-setup: No such file or 
directory

As a note, I say that I use a unique specfile for all my application.

So is there a bug with yum or do I something wrong ?

For now, I use an ugly workaround which tests the availability of the 
script in the postun block but I don't like it.

Thanks in advance for your answers.

Regards,
Olivier BONHOMME