Getting information about updates

Richard Hughes hughsient at gmail.com
Thu Oct 20 15:59:31 UTC 2016


GNOME Software uses flatpak like this:

Once per day:

* flatpak_installation_drop_caches
* flatpak_installation_update_appstream_sync
* flatpak_installation_list_installed_refs_for_update()
* for each result:
*     flatpak_installation_update(FLATPAK_UPDATE_FLAGS_NO_DEPLOY)

Then we get the list of pre-downloaded updates in the updates panel using:

* flatpak_installation_list_installed_refs
* for each result:
*    if flatpak_ref_get_commit !=
flatpak_installed_ref_get_latest_commit then show the application as
there is an undeployed, downloaded update
* when clicked, just do
flatpak_installation_update(FLATPAK_UPDATE_FLAGS_NO_PULL) on the
component

This works well.

What endless wants is a slightly different use-case. They want a mode
where we show un-pulled updates straight away, and when clicking
"update" on the app we download and then deploy the app. This makes
sense when you're on limited bandwidth, or where you might pay for
bandwidth at one time of the day and get it free at other times.

So, we add a GSetting, and support both modes. Now in the endless case
alternate-mode we do once per day:

* flatpak_installation_drop_caches
* flatpak_installation_update_appstream_sync

and then we get the list of updates using:

* flatpak_installation_list_installed_refs

If i understand correctly, flatpak_ref_get_commit() returns the app
ref installed right now, and flatpak_installed_ref_get_latest_commit()
gets the latest commit as found in the remote cache. But, we don't
actually know if get_latest_commit() is returning a commit that's
already downloaded or not. This is important as we need to report to
the UI if there will be network access required. I guess I could call
list_installed_refs_for_update *and* list_installed_refs(), comparing
one against the other, but that's non-awesome. Ideally I want some
kind of API that tells me if a commit is downloaded or not. I guess
flatpak_installation_fetch_remote_size_sync() also works, but that's
going to be super slow as it's doing network IO. Ideas?

Richard.



More information about the xdg-app mailing list