Closed rinigus closed 2 years ago
Does anyone know good pointers to libzypp API? https://doc.opensuse.org/projects/libzypp/HEAD/index.html is a touch overwhelming, but if needed to be can be used probably. Looked a bit into zypper code as well, can continue there. I guess we don't need much, so most of libzypp is not needed in our case. In principle, we need to get list of packages and their metadata.
Install/removal would be via PackageKit, I presume.
I have been experimenting with libzypp for Storeman. I can try to implement package listing this weekend
Excellent! Then we will work on other aspects with piggz. maybe prepare some kind of framework where you could replace with libzypp implementation. Let's see how far we will get taking into account that the weekend is just few days away
I can write a wrapper class for libzypp and packagekit like OrnPm which then can be used in list models
Hard to comment, as I don't really know enough. If you think it is useful, please do. Ideally, we want to reuse as much code as possible.
@mentaljam: just to let you know that I am working on restructuring the code a bit and Chum class in particular. This is to make easier to support the crawlers and list data better. So, if you work on libzypp and integration to Chum class we may clash. But I am sure we will find the way to merge it all
I find it kind of strange that PackageKit can't show installed packages since other packagekit UIs do show installed packages.
You can filter to only search for installed packages like this: https://www.freedesktop.org/software/PackageKit/gtk-doc/Transaction.html#Transaction.SearchNames
Using libzypp has the side effect of blocking Jolla store possibly.
The installed package can be retrieved by using Transaction.SearchNames as show above: https://www.freedesktop.org/software/PackageKit/gtk-doc/Transaction.html#Transaction.SearchNames
Then get use PackageKit::Daemon::packageVersion() with the packageId retrieved.
For example see Discover here: https://github.com/KDE/discover/blob/0cd9956adb0086c3587569ece14a1384c1ee23fd/libdiscover/backends/PackageKitBackend/PackageKitResource.cpp#L113
A side note regarding Jolla Store is something I have never thought about - not sure it is realistic, but I never looked into requirements that are needed for such application (PackageKit, installing of packages).
In short, there should be a way to use PackageKit. It is just requires processing of all installed packages and querying them for the source. When we list all packages, we get packageId that is a string with fields delimited by ;
. One of them is the name of a repo from which package is available. For installed packages, repo name is replaced by installed
. Examples:
harbour-advanced-camera;0.9.5+metadata.20211207214553.9.gfab468d-1.5.1.jolla;aarch64;sailfishos-chum-testing
this is for not installed (yet) and below for the installed one:
timed-qt5;3.6.13-1.7.1.jolla;aarch64;installed
However, there is a packagekit function whatProvides
which should actually allow us to learn the source.
I will look into it.
I have fixed issue with listing installed packages in 162cb0f29d17d888fa07b26e1e8f22f51aec7726. I guess, we don't need libzypp for it anymore and can stay on PackageKit
As package listing seems to be working with PackageKit now, let's stay on the working solution. It may have some other advantages, as pointed out by @Thaodan above.
Closing for now, feel free to reopen or continue in discussion in closed form if needed.
As described in #6, PackageKit does not show installed packages. So, either some hack is needed or we should switch to libzypp. From description by @mentaljam, seems like libzypp would allow us to filter packages by repo, maybe by vendor. Should we switch?