Description of problem: The following rpm post scriptlets is not run when I tried to upgrade 'mpich2' packages with 'rpm -Uvh', although it runs successfully when installing (either the former or the latter version). ... %post /usr/sbin/alternatives \ --install %{_bindir}/mpirun mpi-run %{_bindir}/mpiexec.py 41 \ --slave %{_bindir}/mpiexec mpi-exec %{_bindir}/mpiexec.py \ --slave %{_mandir}/man1/mpiexec.1.gz mpi-exec-man \ %{_mandir}/man1/mp-mpiexec.1.gz \ --slave %{_mandir}/man1/mpif90.1.gz mpif90-man \ %{_mandir}/man1/mp-mpif90.1.gz \ --slave %{_mandir}/man1/mpif77.1.gz mpif77-man \ %{_mandir}/man1/mp-mpif77.1.gz \ --slave %{_mandir}/man1/mpicc.1.gz mpicc-man \ %{_mandir}/man1/mp-mpicc.1.gz \ --slave %{_mandir}/man1/mpic++.1.gz mpic++-man \ %{_mandir}/man1/mp-mpicxx.1.gz ... and ... %post devel /usr/sbin/alternatives \ --install %{_bindir}/mpicc mpicc \ %{_bindir}/mp%{mode}-mpicc %{priority} \ --slave %{_bindir}/mpicxx mpicxx %{_bindir}/mp%{mode}-mpicxx \ --slave %{_bindir}/mpif90 mpif90 %{_bindir}/mp%{mode}-mpif90 \ --slave %{_bindir}/mpif77 mpif77 %{_bindir}/mp%{mode}-mpif77 Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. Try to install the mpich2-1.0.8-1 binaries (mpich2, mpich2-libs, mpich2-devel) from http://deji.fedorapeople.org/ 2. Upgrade to mpich2-1.0.8-3 binaries from http://koji.fedoraproject.org/koji/buildinfo?buildID=93591 3. Actual results: /usr/bin/{mpiexec,mpirun,mpif90,mpicc,mpif77,mpicxx} doesn't exist after upgrade (linnks not setup by alternatives) Expected results: /usr/bin/{mpiexec,mpirun,mpif90,mpicc,mpif77,mpicxx} links setup by alternatives. Additional info: I've tried to add conditional to the post script (if [$1 -gt 0 ]), but I still ran into the issue. However, running 'rpm -Uvh --force' after the initially running 'rpm -Uvh' causes the scriptlets to run, and the alternatives link properly set up.
See https://fedoraproject.org/wiki/Packaging/ScriptletSnippets, the order of scriptlets is not what you might expect and you need to detect upgrade in all %post, %preun etc. This thread might be helpful too: http://lists.rpm.org/pipermail/rpm-maint/2009-March/002384.html