开发者

Can I remove an RPM from within .spec scripts sections?

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 rebui开发者_如何学Cld 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜