From 254a76916247a7f5758d7eff8c640916c0953c93 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Tue, 10 Oct 2017 12:20:09 +0200 Subject: [PATCH] Backport a flatpakref installation fix --- ...correct-origin-when-installing-a-fla.patch | 44 +++++++++++++++++++ gnome-software.spec | 8 +++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 0001-flatpak-Set-the-correct-origin-when-installing-a-fla.patch diff --git a/0001-flatpak-Set-the-correct-origin-when-installing-a-fla.patch b/0001-flatpak-Set-the-correct-origin-when-installing-a-fla.patch new file mode 100644 index 0000000..36b771b --- /dev/null +++ b/0001-flatpak-Set-the-correct-origin-when-installing-a-fla.patch @@ -0,0 +1,44 @@ +From 1a4c98b4ffa089985806a76a73d741465f3cff83 Mon Sep 17 00:00:00 2001 +From: Joaquim Rocha +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 + diff --git a/gnome-software.spec b/gnome-software.spec index 45f0a25..62c44f8 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -14,13 +14,16 @@ Name: gnome-software Version: 3.26.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A software center for GNOME License: GPLv2+ URL: https://wiki.gnome.org/Apps/Software Source0: https://download.gnome.org/sources/gnome-software/3.26/%{name}-%{version}.tar.xz +# Backported from upstream +Patch0: 0001-flatpak-Set-the-correct-origin-when-installing-a-fla.patch + BuildRequires: gettext BuildRequires: libxslt BuildRequires: docbook-style-xsl @@ -240,6 +243,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || : %{_mandir}/man1/gnome-software-editor.1* %changelog +* Tue Oct 10 2017 Kalev Lember - 3.26.1-3 +- Backport a flatpakref installation fix + * Mon Oct 09 2017 Richard Hughes - 3.26.1-2 - Disable fwupd support until we get a 3.27.1 tarball