Question:
What do I put in the foo.spec file so that the RPMs will remove the previous RPM before installing?
Description:
I have created a spec file that creates rpm's for a few packages that use the same source and provide the same service, each with a slightly different configuration. E.g. they each provide the same "capability"
Here's an example of the essentials that my .spec file looks like:
%define version 1234
%define name foo
%define release 1
%define pkgname %{name}-%{version}-%{release}
Name: %{name}
Version: %{version}
Release: %{release}
Provides: %{name}
%package one
Summary: Summary for foo-one
Group: %{group}
Obsoletes: %{name} <= %{version}
Provides: %{name} = %{version}
%description one
Blah blah blah
%package two
Summary: Summary for foo-two
Group: %{group}
Obsoletes: %{name} <= %{version}
Provides: %{name} = %{version}
%description two
Blah blah blah
# %prep, %install, %build and %clean are pretty simple
# and omitted here for brevity sake
%files one
%defattr(-,root,root,-)
%{_prefix}/%{pkgname}
%files two
%defattr(-,root,root,-)
%{_prefix}/%{pkgname}
When I install the first one, it installs ok. I then remove the first one, and then install the second one, that works fine too.
I then install the first one, followed immediately by installing the second one, and they both install, one over the other, but, I was expecting that the second one would be removed before installing the second.
Example session:
# rpmbuild foo and copy rpms to yum repo
$ yum install foo-one
...
$ yum list installed|grep foo
foo-one.noarch 1234-1 @myrepo
$ yum install foo-two
...[Should say that it is removing foo-one, but does not]...
$ yum list installed|grep foo
foo-one.noarch 1234-1 @myrepo
foo-two.noarch 1234-1 @myrepo
$ rpm -q --provides foo-one
foo = 1234
foo-one = 1234-1
$ rpm -q --provides foo-two
foo = 1234
foo-two = 1234-1
What do I put in the foo.spec file so that the RPMs will remove the previous RPM before installing?
Thank you,
.dave.