How to make an existing rpm obsolete a new rpm wit

2019-08-25 02:18发布

问题:

My team is going to add a new RPM, Y, to the user land. There has been an RPM, X, which has to be mutually exclusive with Y. In other words, X and Y must not coexist.

Thus, in the spec file of Y, there is a line saying "Obsolete: X."

The thing is that we cannot modify the spec file of X. When it was written, there was no such package named Y. Thus, it neither "Obsoletes" nor "Conflicts" Y.

We may add more fake/virtual/meta packages to the user land. Is there anyway that the existing package X also effectively obsoletes the new package Y?

yum install X

must remove Y if it is installed.

回答1:

See the Fedora Guidelines for obsoleting packages: https://fedoraproject.org/wiki/Packaging:Guidelines#Renaming.2FReplacing_Existing_Packages It provides a comprehensive description.

But according your description you do not want to use 'obsoletes'. This is used when you replace one package with another one. E.g., when the project change the name and therefore the package change the name and you want to replace old-name-2.0 with new-name-3.0 or even new-name-1.0.

You want to use Conflicts and it is enough to put this tag into one of this packages. When Y spec will have:

Conflicts: X

then you do not need to alter X and you cannot install X and Y at the same time.



回答2:

I have no knowledge of making that possible, but you can add

Conflicts: X

inside your spec file for Y. That way they can't be both installed together.



标签: rpm rpm-spec