5

I am creating a Debian package foo which needs to replace an existing package bar on systems on which it is installed.

I've read:

https://www.debian.org/doc/debian-policy/ch-relationships.html

And concluded that the correct clauses in the DEBIAN/control should look like:

Provides: foo
Conflicts: bar
Replaces: bar

However, when I try to install the foo package on a system that already has bar installed, the system balks because foo conflicts with bar.

If I remove the Conflicts: bar entry then dpkg allows both packages to be installed side-by-side, which is a problem since foo must replace bar.

What are the proper control file clauses to achieve this?

I've tried Breaks instead of Conflicts:

dpkg: regarding foo_DEV-22._i386.deb containing foo:
 foo breaks bar
  bar (version 3.2.2.1-x86NX4.4-x86) is present and installed.
  bar provides bar and is present and installed.
dpkg: error processing foo_DEV-22._i386.deb (--install):
 installing foo would break existing software
Errors were encountered while processing:
 foo_DEV-22._i386.deb
spierepf
  • 51
  • 1
  • 3
  • Possibly instead of `Conflicts` you should use `Breaks` – Dani_l Oct 08 '15 at 12:51
  • I tried 'Replaces', and that seems to fix the broken pipe error on its own that'd be caused by two packages installing the same file, as long as the one to replace the other is the later version, otherwise, the package with the latest version will be the one that controls the files installed. – Dominic Hayes Jul 05 '17 at 16:41

2 Answers2

3

dpkg is a low level tool. To get the desired effect the package should be put into a repo and added to sources.list(5) then apt install foo will do the right thing.

cstamas
  • 6,707
  • 25
  • 42
1

Why not to rename it the existent package beforehand and later replace it with the one you want?

To this end you have to methods/ways as per Debian official wiki page below:

https://wiki.debian.org/Renaming_a_Package
ostendali
  • 403
  • 2
  • 4
  • Well, method 1 (provides/replaces/conflicts) is the one that I have tried, that doesn't work. dpkg just refuses to install foo because it conflicts with bar. I haven't got a clue about what method 2 is asking me to do. If you can explain it more clearly, that would be greatly appreciated. – spierepf Oct 08 '15 at 14:35