gnome-software/0001-flatpak-Set-the-correct-origin-when-installing-a-fla.patch
2017-10-10 12:20:09 +02:00

45 lines
1.9 KiB
Diff

From 1a4c98b4ffa089985806a76a73d741465f3cff83 Mon Sep 17 00:00:00 2001
From: Joaquim Rocha <jrocha@endlessm.com>
Date: Sat, 1 Jul 2017 01:33:00 +0200
Subject: [PATCH] flatpak: Set the correct origin when installing a flatpakref
When installing a flatpakref, part of the process is to install its
ref file, and the code was assuming that this installation always
results in a new remote (named as app_name-origin). However, if there
is already a remote with the same URI as the one coming from the ref
file, it will not add the new one in order to avoid redudancy.
Since the GsApp representing the one in the flatpakref was being
assigned the "app_name-origin" as its origin, it would fail to install
later because this expected origin may not exist (as explained above).
To fix this, once the ref file is installed, we get the resulting
remote's name (i.e. a new one or the existing one) and override the
app's origin with it, which will allow the installation to succeed.
---
plugins/flatpak/gs-flatpak.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index af6834fb..a33aa060 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -2779,6 +2779,14 @@ gs_flatpak_app_install (GsFlatpak *self,
return FALSE;
}
+ /* the installation of the ref file above will not create a new remote for
+ * the app if its URL is already configured as another remote, thus we
+ * need to update the app origin to match that or it may end up with
+ * an nonexistent origin; and we first need to set the origin to NULL to
+ * circumvent the safety check... */
+ gs_app_set_origin (app, NULL);
+ gs_app_set_origin (app, flatpak_remote_ref_get_remote_name (xref2));
+
/* update search tokens for new remote */
if (!gs_flatpak_refresh_appstream (self, G_MAXUINT, 0, cancellable, error)) {
gs_app_set_state_recover (app);
--
2.14.1