Skip to content

flatpak: Ignore FLATPAK_ERROR_ALREADY_INSTALLED when installing apps

Somehow, sometimes, it might be possible for the state in gnome-software to be out of date, and hence for g-s to start installing an app which is actually already installed.

If that happens for an app, libflatpak will return FLATPAK_ERROR_ALREADY_INSTALLED from flatpak_transaction_add_install(). If it happens for a flatpakref or a bundle, libflatpak will return the error from flatpak_transaction_run() instead (since it needs to resolve the flatpakrefs and bundles to refs before it can determine whether they’re already installed).

Handle both of those cases in the flatpak plugin, marking the app as installed if libflatpak returns that error code. The handling of it is not especially pretty, since it needs to still fall through and refresh the GsApp after marking it as installed.

Based on a downstream commit by Joaquim Rocha jrocha@endlessm.com.

Signed-off-by: Philip Withnall withnall@endlessm.com

Merge request reports