Commit fdf7468d authored by Jan Grulich's avatar Jan Grulich

Install related ref instead attempting to upgrade it

When upgrading an app, we attempt to also upgrade related refs, but we
fail if some of the listed refs is not installed. We should check whether
we are trying to upgrade installed ref and if not, then just install it.

Reviewers: apol

Reviewed By: apol

Subscribers: plasma-devel

Tags: #plasma

Differential Revision:
parent 8ce81b2a
......@@ -69,7 +69,23 @@ void FlatpakTransactionJob::run()
const uint kind = m_relatedRef.isEmpty() ? (uint)m_app->type() : m_relatedRefKind;
if (m_role == Transaction::Role::InstallRole) {
if (m_app->state() == AbstractResource::Upgradeable) {
bool installRelatedRef = false;
// Before we attempt to upgrade related refs we should verify whether they are installed in first place
if (m_app->state() == AbstractResource::Upgradeable && !m_relatedRef.isEmpty()) {
g_autoptr(GError) installedRefError = nullptr;
FlatpakInstalledRef *installedRef = flatpak_installation_get_installed_ref(m_app->installation(),
kind == FlatpakResource::DesktopApp ? FLATPAK_REF_KIND_APP : FLATPAK_REF_KIND_RUNTIME,
m_cancellable, &installedRefError);
if (installedRefError) {
qWarning() << "Failed to check whether related ref is installed: " << installedRefError;
installRelatedRef = installedRef == nullptr;
if (m_app->state() == AbstractResource::Upgradeable && !installRelatedRef) {
ref = flatpak_installation_update(m_app->installation(),
kind == FlatpakResource::DesktopApp ? FLATPAK_REF_KIND_APP : FLATPAK_REF_KIND_RUNTIME,
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