Already installed local packages not showing as installed when opened
When an already installed local deb/rpm package is opened using GNOME Software, it always shows "Install" instead of the correct "Remove" option. Clicking the "Install" button again returns an error that the package is already installed.
Steps to reproduce:
- Open and install any local deb/rpm file using GNOME Software.
- Close the GNOME Software window.
- Open the local package file again in GNOME Software.
It happens on both the latest Ubuntu 20.04 with GNOME Software 3.36 and Fedora 31 with GNOME Software 3.34.2.
(In most cases, it is not possible at all to remove such packages using GNOME Software because they don't show on the Installed tab if they have no AppStream metadata which is considered to be an expected behaviour, see #966 (closed).)
I have provided two possible solutions of this issue.
edit: This issue is now fixed on regular systems (using PackageKit), but still present on immutable systems (using rpm-ostree). I have created a separate issue for such systems.