Bug 443612 - Discover can't detect that an already-installed local package is already installed
Summary: Discover can't detect that an already-installed local package is already inst...
Status: RESOLVED FIXED
Alias: None
Product: Discover
Classification: Applications
Component: discover (show other bugs)
Version: 5.23.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dan Leinir Turthra Jensen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-11 21:41 UTC by Nate Graham
Modified: 2021-10-20 18:25 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2021-10-11 21:41:15 UTC
STEPS TO REPRODUCE
1. Download the distro-appropriate TeamViewer package from https://www.teamviewer.com/en-us/download/linux/
2. Click on it to open it in Discover
3. Install it with Discover
4. Quit Discover
5. Open it with Discover again


OBSERVED RESULT
Discover doesn't notice that it's already installed, and offers to install it again. Doing so causes it to try and then fail at the end with an unhelpful passive notification that says, "Internal error". `pkmon` is more helpful, and reveals the truth:

** (pkmon:51930): WARNING **: 15:32:06.008: failed to adopt: Error running transaction: package teamviewer-15.22.3-0.x86_64 is already installed
Transactions:
 [none]


EXPECTED RESULT
When launched with a local package, Discover should attempt to discover whether or not the package is already installed, and if so not even offer the option to install it, instead showing only a "Remove" button.
Comment 1 Aleix Pol 2021-10-19 17:44:50 UTC
Agreed, I don't think there's API for it though...

https://www.freedesktop.org/software/PackageKit/gtk-doc/Transaction.html#Transaction.GetFilesLocal

Maybe we can check what files it installs and try to find them in our FS?
Comment 2 Nate Graham 2021-10-19 18:58:28 UTC
can we extract the package name from the package file before it gets installed? Or is that the information that's not available.
Comment 3 Aleix Pol 2021-10-19 20:48:08 UTC
I don't think we can do it in a distro agnostic way.
Comment 4 Nate Graham 2021-10-19 20:55:22 UTC
Darn. Comparing local files might be okay then.
Comment 5 Bug Janitor Service 2021-10-19 22:47:19 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/discover/-/merge_requests/194
Comment 6 Aleix Pol 2021-10-20 18:24:59 UTC
Git commit 4bcb047e977c5daffb751617f0595f602a730053 by Aleix Pol.
Committed on 20/10/2021 at 18:24.
Pushed by apol into branch 'master'.

pk: Try to detect if a local file we are trying to install already is installed

So that maybe it can be marked as such when the file gets opened

M  +42   -27   libdiscover/backends/PackageKitBackend/LocalFilePKResource.cpp
M  +2    -2    libdiscover/backends/PackageKitBackend/LocalFilePKResource.h
M  +1    -1    libdiscover/backends/PackageKitBackend/PKTransaction.cpp

https://invent.kde.org/plasma/discover/commit/4bcb047e977c5daffb751617f0595f602a730053
Comment 7 Aleix Pol 2021-10-20 18:25:20 UTC
Git commit 0914a944d315492401b3bb1ef890822e4c7c9600 by Aleix Pol Gonzalez, on behalf of Aleix Pol.
Committed on 20/10/2021 at 18:25.
Pushed by apol into branch 'Plasma/5.23'.

pk: Try to detect if a local file we are trying to install already is installed

So that maybe it can be marked as such when the file gets opened


(cherry picked from commit 4bcb047e977c5daffb751617f0595f602a730053)

M  +42   -27   libdiscover/backends/PackageKitBackend/LocalFilePKResource.cpp
M  +2    -2    libdiscover/backends/PackageKitBackend/LocalFilePKResource.h
M  +1    -1    libdiscover/backends/PackageKitBackend/PKTransaction.cpp

https://invent.kde.org/plasma/discover/commit/0914a944d315492401b3bb1ef890822e4c7c9600