How do we rename a rpm build?

2019-08-02 03:11发布

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?

标签: rpm rpmbuild
1条回答
地球回转人心会变
2楼-- · 2019-08-02 03:33

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.

查看更多
登录 后发表回答