Wednesday, April 20, 2022

[SOLVED] How do we rename a rpm build?

Issue

I wanted to change the name of my rpm file from oldname-7.x86_64.rpm to newname-8.x86_64.rpm. I created the new rpm with the new name but when I try to execute

rpm -Uvh newname-8.x86_64.rpm

it throws the following error:

file XXXXX from install of oldname-7.x86_64 conflicts with file from package newname-8.x86_64.

rpm upgrade removes the package and install the new package. But in my case package name is different so it is not removing the package. Should I remove the oldname project using rpm -e oldname in the %pre section? Is there any way to set the old name in the %pre section?


Solution

You should use the Obsoletes and/or Provides tags in your spec file of newname.spec:

Obsoletes: oldname

and optionally even:

Provides: oldname = %{version}-%{release}

You can read http://rpm.org/user_doc/dependencies.html for further reference.



Answered By - Chris Maes
Answer Checked By - Willingham (WPSolving Volunteer)