Can I remove RPMs from .spec script sections?

I am creating a new version of the existing .spec / rpm and I want to remove the dependency that is required for this no longer (the previous .spec had "Requires: rpm-xyz").

So, instead of removing 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 to process, I get this line and stuck there forever:

warning: waiting for transaction lock / var / lib / rpm / __ db.000

This way it looks like a dead end to me (yum calls rpm and then calls rpm from the inside). So I have the __db.oox file in / var / lib / rpm and I need to rebuild the rom database to delete them.

So the question is: do you allow the rpm command to be invoked from a special file? I read about obsolete tags, but it does not remove rpm. What would be the best way to remove rpm?

Thanks,

-Martin

PS Additional information: Yes, I need to remove the old dependencies, and no, no other rpm depend on it.

+6
source share
1 answer

No, you cannot run rpm from a script set in your .spec file (both in% post and in another). What you can do is put a string like

Obsoletes: rpm-xyv <= VERSION 

in your .spec file. Then, Yum will continue removing another package.

See http://yum.baseurl.org/wiki/YumPackageUpdates for more on what to do when renaming packages, etc.

+12
source

Source: https://habr.com/ru/post/894849/