GNOME Bugzilla – Bug 782340
[PK on Ubuntu] Duplicate apps shown when there are updates
Last modified: 2017-06-09 14:01:45 UTC
Created attachment 351357 [details] duplicate chromiums master, 6be1218ea1d19ed6a5f25b2cc9d2170741277903 I'm just getting started with looking at using PackageKit on Ubuntu instead of our downstream aptdaemon plugin. On my system currently there is an update to Chromium available. The same update is available from the "security" and "updates" repositories. I can see three entries for chromium when I search for it in gnome-software corresponding to these three GsApps. 16:13:46:0951 Gs GsApp: [0x7f2ca00aa3f0] kind: desktop state: updatable quirk: provenance id: chromium-browser.desktop unique-id: system/package/ubuntu-zesty-updates-universe/desktop/chromium-browser.desktop/* scope: system bundle-kind: package kudos: has-keywords|popular kudo-percentage: 50 name: Chromium Web Browser pixbuf: 0x7f2cb010c180 icon-kind: cached icon-pixbuf: 0x7f2cb010c180 icon-name: chromium-browser_chromium-browser.png icon-prefix: /var/lib/app-info/icons/ubuntu-zesty-updates-universe icon-kind: cached icon-pixbuf: (nil) icon-name: chromium-browser_chromium-browser.png icon-prefix: /var/lib/app-info/icons/ubuntu-zesty-updates-universe match-value: 00040 version: 57.0.2987.98-0ubuntu1.1348 version-ui: 57.0.2987.98 summary: Access the Internet description: An open-source browser project that aims to build a safer, faster, and more stable way for all Internet users to experience the web. source-00: chromium-browser source-id-00: chromium-browser;57.0.2987.98-0ubuntu1.1348;amd64;installed:ubuntu-zesty-universe source-id-01: chromium-browser;58.0.3029.81-0ubuntu2.17.04.1350;amd64;ubuntu-zesty-updates-universe url{homepage}: https://chromium.googlesource.com/chromium/src/ license: unknown license-is-free: no management-plugin: packagekit menu-path: Communication & News → Web Browsers origin: ubuntu-zesty-updates-universe rating: 87 review-rating: [0:0] review-rating: [1:94] review-rating: [2:65] review-rating: [3:84] review-rating: [4:245] review-rating: [5:1006] reviews: 30 provides: 0 install-date: 1 size-installed: 306.3 MB size-download: unknowable category: Network category: WebBrowser keyword: ubuntu-zesty-updates-universe {GnomeSoftware::Creator}: appstream {appstream::source-file}: /usr/share/applications/chromium-browser.desktop 16:14:05:0324 Gs GsApp: [0x7f2ca807b610] kind: desktop state: updatable quirk: provenance id: chromium-browser.desktop unique-id: system/package/ubuntu-zesty-universe/desktop/chromium-browser.desktop/* scope: system bundle-kind: package kudos: popular kudo-percentage: 50 name: Chromium Web Browser pixbuf: 0x7f2cb0124240 icon-kind: cached icon-pixbuf: 0x561be5bcd240 icon-name: chromium-browser_chromium-browser.png icon-prefix: /var/lib/app-info/icons/ubuntu-zesty-universe icon-kind: cached icon-pixbuf: (nil) icon-name: chromium-browser_chromium-browser.png icon-prefix: /var/lib/app-info/icons/ubuntu-zesty-universe match-value: 00040 version: 57.0.2987.98-0ubuntu1.1348 version-ui: 57.0.2987.98 summary: Access the Internet description: An open-source browser project that aims to build a safer, faster, and more stable way for all Internet users to experience the web. source-00: chromium-browser source-id-00: chromium-browser;57.0.2987.98-0ubuntu1.1348;amd64;installed:ubuntu-zesty-universe source-id-01: chromium-browser;58.0.3029.81-0ubuntu2.17.04.1350;amd64;ubuntu-zesty-updates-universe url{homepage}: https://chromium.googlesource.com/chromium/src/ license: unknown license-is-free: no management-plugin: packagekit menu-path: Communication & News → Web Browsers origin: ubuntu-zesty-universe rating: 87 review-rating: [0:0] review-rating: [1:94] review-rating: [2:65] review-rating: [3:84] review-rating: [4:245] review-rating: [5:1006] reviews: 30 provides: 0 install-date: 1 size-installed: 306.3 MB size-download: unknowable category: Network category: WebBrowser {GnomeSoftware::Creator}: appstream 16:14:28:0507 Gs GsApp: [0x561be31ded90] kind: desktop state: updatable quirk: provenance id: chromium-browser.desktop unique-id: system/package/ubuntu-zesty-security-universe/desktop/chromium-browser.desktop/* scope: system bundle-kind: package kudos: has-keywords|popular kudo-percentage: 50 name: Chromium Web Browser pixbuf: 0x7f2cb010ec60 icon-kind: cached icon-pixbuf: 0x7f2cb010ec60 icon-name: chromium-browser_chromium-browser.png icon-prefix: /var/lib/app-info/icons/ubuntu-zesty-security-universe icon-kind: cached icon-pixbuf: (nil) icon-name: chromium-browser_chromium-browser.png icon-prefix: /var/lib/app-info/icons/ubuntu-zesty-security-universe match-value: 00040 version: 57.0.2987.98-0ubuntu1.1348 version-ui: 57.0.2987.98 summary: Access the Internet description: An open-source browser project that aims to build a safer, faster, and more stable way for all Internet users to experience the web. source-00: chromium-browser source-id-00: chromium-browser;57.0.2987.98-0ubuntu1.1348;amd64;installed:ubuntu-zesty-universe source-id-01: chromium-browser;58.0.3029.81-0ubuntu2.17.04.1350;amd64;ubuntu-zesty-updates-universe url{homepage}: https://chromium.googlesource.com/chromium/src/ license: unknown license-is-free: no management-plugin: packagekit menu-path: Communication & News → Web Browsers origin: ubuntu-zesty-security-universe rating: 87 review-rating: [0:0] review-rating: [1:94] review-rating: [2:65] review-rating: [3:84] review-rating: [4:245] review-rating: [5:1006] reviews: 30 provides: 0 install-date: 1 size-installed: 306.3 MB size-download: unknowable category: Network category: WebBrowser keyword: ubuntu-zesty-security-universe {GnomeSoftware::Creator}: appstream I think they should have been merged. But how? Is having the same source enough?
Created attachment 351359 [details] [review] Maybe like this? There's a comment that implies this should be the case. search: Deduplicate the results with priority If there are several results with the same ID available we should only show one of them (the highest priority). This brings the code back in line with the comment.
So, GS_APP_LIST_FILTER_FLAG_PRIORITY is a big hammer. It basically means "only show one thing with the same desktop-id" -- this means if Fedora has org.mozilla.Firefox, and flathub has has the same thing then we'd only show one thing rather than let the user choose between the distro package and the flatpak version. Whilst the priority should affect the sorting of the results, hiding all but the "best" entry might not be what the user expects. I think in this case you just want to filter using the priority when the pkgname+version matches, i.e. the deduplicate key becomes "chromium-browser.desktop:chromium-browser:57.0.2987.98-0ubuntu1.1348" which I think would do what you want. What about something like GS_APP_LIST_FILTER_FLAG_PRIORITY | GS_APP_LIST_FILTER_FLAG_KEY_SOURCE | GS_APP_LIST_FILTER_FLAG_KEY_VERSION which would then construct a dedupe key using the ID, the default source and the version?
Created attachment 351390 [details] [review] search: Try to deduplicate the same logical app Cheers Richard! This I think implements what you suggested and it seems to work for me. Not sure if I need the defensive programming of checking whether the source & version are set, seemed pragmatic at the time. -- If there are several results for the same app from the 'same place' - for example a distro package has an update the user hasn't yet installed - only show one result in the search results list. Do this by filtering on id/source/version, which should be stable across updates ('version' is the installed version if the app is installed [regardless of available updates] or the candidate version if not).
https://git.gnome.org/browse/gnome-software/commit/?id=2e87612c163b36309beb8103196c616c1b46efd6