RPM Community Forums

Mailing List Message of <rpm-users>

Re: Conflicts vs Obsoletes

From: Eric MSP Veith <eveith@wwweb-library.net>
Date: Mon 16 Nov 2009 - 02:09:35 CET
Message-Id: <200911160209.36520.eveith@wwweb-library.net>
Hash: SHA1

On Monday 16 November 2009, Marc MERLIN <marc_rpm@merlins.org> wrote:
> This is against an old rpm (4.0.2) but I think this behaviour hasn't
>  changed in a while.
> If I have a directory with bash.rpm
> and someone builds newbash.rpm with Obsoletes: bash.rpm
> things works as expected:
> rpm -U newbash.rpm
> removes bash.rpm
> Now, unless something very wonoky happened, I think I think I saw
> rpm -U bash.rpm succeeding (the files don't conflict).
> Is that possible/normal?

Yes. The pourpose of the "Obsoletes" tag is to mark an obsoletion if the 
package name differs. For example, if you habe bash-2.05-1.i386.rpm and 
bash-3.0-1.i386.rpm, the latter will cause and upgrade as it is newer than 
bash-2.05 -- quite naturally. However, consider the case where you are 
forced to change the package names for whatever reason. For example, the 
"foo" project begins to develop the "foo2" package in parallel to the old 
"foo", and you want to packge both. "foo2" will of couse supersede "foo", 
but RPM cannot guess. So you put an "Obsoletes: foo" into your "foo2.spec", 
and the upgrade will work.

As for conflicts, it does what it's named after: It marks a conflict. 
"Conflicts" will cause the install/upgrade to fail and therefore forbids an 
installation/upgrade. In contrast, "Obsoletes" forces an upgrade.

> In that case, I put both Conflicts: bash.rpm / Obsoletes: bash.rpm
> in newbash.rpm?

Depdends on what you express. Normally, "Obsoletes" suffices.

> But if I do that, rpm -U newbash.rpm should still work, however, if
>  someone tries rpm -U bash.rpm, should it just be a no-op that won't
>  cause an error, or would it try to install bash and then fail due to the
>  conflict?

If you put "Obsoletes: bash" into "newbash.rpm", it will cause an "rpm -Uvh 
bash.rpm" to fail with the message that a newer version is already 

As a real-life example, I commonly use "Obsoletes" when I find that some 
library package's soversion is becoming important. I have a package called 
"libvuurmuur". When I found that packages linked against libvuurmuur.so.0 
explicitly and some others needed a newer version of libvuurmuur, I decided 
to change the package's name to "libvuurmuur0". To not cause confusion, I 
put an "Obsoletes: libvuurmuur < %{version}-%{release}" into the specfile, 
thereby causing the old "libvuurmuur" to be removed and smoothly replaced by 
"libvuurmuur0". If I get to install "libvuurmuur1" some day, I won't have 
and problems.

In contrast, I had for some time both KDE 3 and KDE 4 packages but didn't 
want users to installed both "kdegraphics" version 3 AND 4, so I put a 
"Conflicts: kdegraphics < 4.0" into the specfile for kdegraphics-4. It made 
more sense because I couldn't just force an upgrade.


		-- Eric
Version: GnuPG v1.4.9 (GNU/Linux)

Received on Mon Nov 16 02:09:57 2009
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.