Issue
I'm building a new version of an existing .spec/rpm and I want to remove a dependency that was required by that is not anymore (previous .spec had "Requires: rpm-xyz).
So on top of removing the Requires: rpm-xyz, I added the following in the "%post" section of the .spec file:
rpm -e rpm-xyz.
When I install the generated rpm with yum, after downloading it and asked me the confirmation to processed, I get this line and it stuck there forever:
warning: waiting for transaction lock on /var/lib/rpm/__db.000
So it looks like a deadlock to me (yum calls rpm, then calls rpm from within). So I have __db.oox file in the /var/lib/rpm and I need to rebuild the rom database to removed them.
So the question is: Am I allow to call the rpm command from within a spec file? I've read on the Obsolete tags, but it does not remove rpm. What would be the best way to remove the rpm?
Thanks,
-Martin
P.S. Extra info: Yes, I need to remove old dependencies and no, no others rpm depend on it.
Solution
No, you cannot run rpm from within a scriptlet in your .spec file (whether %post, or something else). What you can do is put a line like
Obsoletes: rpm-xyv <= VERSION
in your .spec file. Yum will then proceed to remove the other package.
See http://yum.baseurl.org/wiki/YumPackageUpdates for more advice on what to do on package renames, etc.
Answered By - Stijn Hoop Answer Checked By - Terry (WPSolving Volunteer)