On the application page, the text displayed in both the "Sources" dropdown and the "Distributed by" metadata field is non-deterministically. On my Fedora system, for different apps, it will display any of the following values: "fedora" "updates" "installed" "installed:"fedora This happens because PackageKitResource has no override for displayOrigin(), causing it to fall back to origin(), which gets its data from availablePackageId(), which has the following code: QString PackageKitResource::availablePackageId() const { // First we check if it's upgradeable and use this version to display const QSet<QString> pkgids = backend()->upgradeablePackageId(this); if (!pkgids.isEmpty()) return *pkgids.constBegin(); const auto it = m_packages.constFind(PackageKit::Transaction::InfoAvailable); if (it != m_packages.constEnd()) return it->first(); return installedPackageId(); } In two cases, it blindly returns the first result of an unsorted multi-item container. Thus, the seemingly random text. It *is* random! We should either fix this logic to return a deterministic result (if it wouldn't disrupt any non-display code using it), or else override displayOrigin() to return a nice user-facing string; something like "<distro name> (<repo name> repository)"
Isn't part of the problem here that the source is ever "updates" or "installed"? Even if it was deterministic, it would not be offering a useful value.
Right, none of those make sense to show to the user; it's backend stuff. But we expose that backend stuff to the user because we use it to generate the display string in the way I mentioned.
Basically what we want is to show the pretty distro name if the app comes from a 1st-party distro repo (obscuring those ugly repo names), but do show the repo name if it comes from a 3rd-party repo. Had a call with Aleix and it turns out this isn't really possible to do with PackageKit's current API. I've filed a ticket upstream: https://github.com/PackageKit/PackageKit/issues/607 In the meantime we can substitute the current distro name for apps from PackageKit and point people to that if they get mad at us for only showing the distro name.
A possibly relevant merge request was started @ https://invent.kde.org/plasma/discover/-/merge_requests/474
Git commit 5b23cca9813d51bddac2b99aeab14d919c083787 by Nate Graham. Committed on 22/02/2023 at 00:32. Pushed by ngraham into branch 'master'. Always show distro name for PackageKit apps Discover tries to show the name of the repo that an app comes from. This string is generally human-readable for Snap, Flatpak, KNS, and even apps from 3rd-party PackageKit repos. But it is usually not human-readable for apps that come from distro repos, because it's common for distros to ship multiple repos that serve different purposes. When we try to show the name of these repos in the UI, it's nonsense; we end up with text like "Distributed by: xenial-security universe" and Distributed by: updates". This text doesn't make any sense to the user and can even be scary; imagine "Distributed by: Restricted" which is what you can see on Ubuntu-based distros! The user does not care about which specific distro repo the app comes from; what they care about is that it came from their distro. What would be ideal is if PackageKit could tell us whether a particular PackageKit repo was 1st-party or 3rd-party. Then for 3rd-party repos we could show the actual name (which usually ends up looking reasonably human-readable, like "Packman" or "rpmfusion-free"), and for 1st-party repos, we could instead substitute the distro name. Unfortunately PackageKit doesn't have that functionality right now. See https://github.com/PackageKit/PackageKit/issues/607. So for now, just show the distro name for all PackageKit apps. This fixes the nonsense strings issues, and while it does result in inaccuracy for users who have installed 3rd-party package repos, those users are generally technically knowledgeable enough to understand. FIXED-IN: 5.27.2 M +9 -2 libdiscover/backends/PackageKitBackend/PackageKitResource.cpp https://invent.kde.org/plasma/discover/commit/5b23cca9813d51bddac2b99aeab14d919c083787
Git commit e6c03350a4fcd393814154f10f82f67b9d63d018 by Nate Graham. Committed on 22/02/2023 at 00:37. Pushed by ngraham into branch 'Plasma/5.27'. Always show distro name for PackageKit apps Discover tries to show the name of the repo that an app comes from. This string is generally human-readable for Snap, Flatpak, KNS, and even apps from 3rd-party PackageKit repos. But it is usually not human-readable for apps that come from distro repos, because it's common for distros to ship multiple repos that serve different purposes. When we try to show the name of these repos in the UI, it's nonsense; we end up with text like "Distributed by: xenial-security universe" and Distributed by: updates". This text doesn't make any sense to the user and can even be scary; imagine "Distributed by: Restricted" which is what you can see on Ubuntu-based distros! The user does not care about which specific distro repo the app comes from; what they care about is that it came from their distro. What would be ideal is if PackageKit could tell us whether a particular PackageKit repo was 1st-party or 3rd-party. Then for 3rd-party repos we could show the actual name (which usually ends up looking reasonably human-readable, like "Packman" or "rpmfusion-free"), and for 1st-party repos, we could instead substitute the distro name. Unfortunately PackageKit doesn't have that functionality right now. See https://github.com/PackageKit/PackageKit/issues/607. So for now, just show the distro name for all PackageKit apps. This fixes the nonsense strings issues, and while it does result in inaccuracy for users who have installed 3rd-party package repos, those users are generally technically knowledgeable enough to understand. FIXED-IN: 5.27.2 (cherry picked from commit 5b23cca9813d51bddac2b99aeab14d919c083787) M +9 -2 libdiscover/backends/PackageKitBackend/PackageKitResource.cpp https://invent.kde.org/plasma/discover/commit/e6c03350a4fcd393814154f10f82f67b9d63d018