Make .deb and .rpm mime type handling optional at build time
ClosedPublic

Authored by arojas on May 25 2018, 10:32 PM.

Details

Summary

Having discover handle .deb packages is useless in non-Debian based distros. Same for .rpm. Almost all the times someone clicks on a .deb or .rpm file in a distro with a different package format they expect the archive to be opened in an archive extractor. Having it open in discover is annoying -at the very least- and potentially dangerous (if, for some reason, the wrong PK backend is installed, Discover may try to install the package, which could wreck the system).

This patch makes handling of .deb and .rpm optional at build time.

Test Plan

Tested all possible combinations of HANDLE_DEB and HANDLE_RPM, MimeType field in org.kde.discover.desktop contains the expected value every time.

Diff Detail

Repository
R134 Discover Software Store
Lint
Lint Skipped
Unit
Unit Tests Skipped
arojas created this revision.May 25 2018, 10:32 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMay 25 2018, 10:32 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
arojas requested review of this revision.May 25 2018, 10:32 PM
apol added a comment.May 25 2018, 11:11 PM

Good idea!
How about looking for the rpm and dpkg executables?

arojas updated this revision to Diff 34908.May 26 2018, 7:31 AM

Check for the presence of the dpkg and rpm binaries to decide whether to install the mime type handlers

apol accepted this revision.May 27 2018, 10:15 PM
This revision is now accepted and ready to land.May 27 2018, 10:15 PM

5.13 or master?

mak added a subscriber: mak.May 27 2018, 10:28 PM

Checking for the dpkg and rpm binaries isn't really foolproof, because you can install rpm on Debian and dpkg on Fedora & Co. easily.
The only issue proof thing that I can imagine would be checking for the distribution name in /etc/os-release, or maybe checking for the presence of /etc/debian_version.

In D13123#269385, @mak wrote:

Checking for the dpkg and rpm binaries isn't really foolproof, because you can install rpm on Debian and dpkg on Fedora & Co. easily.
The only issue proof thing that I can imagine would be checking for the distribution name in /etc/os-release, or maybe checking for the presence of /etc/debian_version.

Most (all?) distros build packages in some sort of minimal container, so I don't think that will be an issue in practice. Using the distribution name would require maintaining an exhaustive list of distributions using each package management system, not really feasible.

This revision was automatically updated to reflect the committed changes.