Commit 87b8de86 authored by Matthew Leeds's avatar Matthew Leeds Committed by Richard Hughes

flatpak: Set apps to installed upon missing runtime install

This commit is a rework of
!373

The idea is that when an app's runtime is missing, or one of its
should-download related refs is missing, the app will be returned as
updatable by flatpak_installation_list_installed_refs_for_update(), and
will be subsequently added to a transaction by gnome-software. Progress
updates on the app are calculated using the progress of the related
operations. However if the app itself doesn't need an update,
_transaction_operation_done() will never be called for it and so its
state never gets set to AS_APP_STATE_INSTALLED. Fix this by setting the
app to installed when the related thing is, if the app is being skipped
and the related thing is the last operation in the transaction needed
for the app.

It would be great to add a unit test for this, but there's no way
through the flatpak plugin's API to uninstall an app's runtime without
uninstalling the app, so we'd have to do something tricky like call out
to "flatpak uninstall --force-remove ..."
parent dd100c88
Pipeline #200002 passed with stage
in 4 minutes and 50 seconds
......@@ -613,6 +613,10 @@ _transaction_operation_done (FlatpakTransaction *transaction,
case FLATPAK_TRANSACTION_OPERATION_INSTALL:
case FLATPAK_TRANSACTION_OPERATION_INSTALL_BUNDLE:
gs_app_set_state (app, AS_APP_STATE_INSTALLED);
#if FLATPAK_CHECK_VERSION(1,7,3)
set_skipped_related_apps_to_installed (self, transaction, operation);
#endif
break;
case FLATPAK_TRANSACTION_OPERATION_UPDATE:
gs_app_set_version (app, gs_app_get_update_version (app));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment