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.
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?
can we extract the package name from the package file before it gets installed? Or is that the information that's not available.
I don't think we can do it in a distro agnostic way.
Darn. Comparing local files might be okay then.
A possibly relevant merge request was started @ https://invent.kde.org/plasma/discover/-/merge_requests/194
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
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