Bug 7843

Summary: rpm2debpkg should likely use Breaks rather than Conflicts
Product: ThinLinc Reporter: Pierre Ossman <ossman>
Component: Build systemAssignee: Pierre Ossman <ossman>
Status: NEW ---    
Severity: Normal Keywords: prosaic
Priority: P2    
Version: trunk   
Target Milestone: LowPrio   
Hardware: PC   
OS: Unknown   
Acceptance Criteria:
* The control file in our .debs should have a Replaces:/Breaks: combo for obsoleted packages * Obsolete should still have the same effect: * New package is allowed to overwrite files * Old package is removed to a "config-files" state * install-server correctly identifies packages being obsoleted (see log)

Description Pierre Ossman cendio 2022-02-23 15:34:14 CET
(discovered whilst doing bug 4885)

I'm not sure our current conversion of RPM's "Obsoletes" is entirely correct. We currently translate this to a "Replaces"/"Conflicts" pair, which seems to be what Debian suggests here:

https://www.debian.org/doc/debian-policy/ch-relationships.html#replacing-whole-packages-forcing-their-removal

We noticed this on bug 7279 comment 19. We also noticed that something wasn't entirely correct and added an extra "Provides" to work around the issue.

However when I look at this again, I notice more details in Debian's "Conflicts" chapter:

https://www.debian.org/doc/debian-policy/ch-relationships.html#conflicting-binary-packages-conflicts

And in Debian's guide for renaming a package:

https://wiki.debian.org/RenamingPackages

What they state is that "Breaks" should be used in this case, not "Conflicts". 

So far we haven't seen any practical differences between the two, but it might be safer to go with what Debian recommends.
Comment 1 Pierre Ossman cendio 2022-02-23 15:34:39 CET
We could see if we can find examples similar to what we've done in Debian's official packages.
Comment 2 Pierre Ossman cendio 2022-02-23 15:35:03 CET
Also note that the installer currently doesn't have any support for "Breaks", so that needs to be added.
Comment 3 Pierre Ossman cendio 2022-03-08 10:39:13 CET
(In reply to Pierre Ossman from comment #1)
> We could see if we can find examples similar to what we've done in Debian's
> official packages.

I had a look at wireshark and how they dealt with the rename from ethereal, and found this:

> Breaks: ethereal (<< 1.0.0-3),
>         wireshark (<< 2.0.0~),
>         wireshark-qt (<< 2.0.0~rc3+g841d5e1)
> Replaces: ethereal (<< 1.0.0-3),
>         wireshark (<< 2.0.0~),
>         wireshark-qt (<< 2.0.0~rc3+g841d5e1)

So Breaks/Replaces seem to indeed be the right combo.
Comment 4 Pierre Ossman cendio 2022-03-08 14:36:33 CET
Unfortunately this doesn't seem to work in practice.

apt is fine with either "Breaks" or "Conflicts". In both cases it realises that the old packages should be removed before the new one is added.

However dpkg prints this when using Conflicts:

> dpkg: considering removing thinlinc-tladm in favour of thinlinc-server ...
> ...

But with Breaks it just bails:

> dpkg: regarding .../thinlinc-server_4.14.0post-0.unknown_amd64.deb containing thinlinc-server:
>  thinlinc-server breaks thinlinc-tladm (<< 4.15.0)
>   thinlinc-tladm (version 4.6.0-5144) is present and installed.
> 
> dpkg: error processing archive ./thinlinc-server_4.14.0post-0.unknown_amd64.deb (--install):
>  installing thinlinc-server would break thinlinc-tladm, and
>  deconfiguration is not permitted (--auto-deconfigure might help)
> Errors were encountered while processing:
>  ./thinlinc-server_4.14.0post-0.unknown_amd64.deb

So unfortunately Conflicts seems to be the more practical option, even if it isn't the recommended one.