From 842e7bdf8a1cb08673c11bc6f9b87d2d4ad4f6ef Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Wed, 12 Jun 2019 10:22:14 +0200 Subject: [PATCH] Backport an upstream patch to fix gnome-software CI --- ...back-support-for-file-uris-in-Runtim.patch | 68 +++++++++++++++++++ flatpak.spec | 8 ++- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 0001-transaction-Add-back-support-for-file-uris-in-Runtim.patch diff --git a/0001-transaction-Add-back-support-for-file-uris-in-Runtim.patch b/0001-transaction-Add-back-support-for-file-uris-in-Runtim.patch new file mode 100644 index 0000000..454003b --- /dev/null +++ b/0001-transaction-Add-back-support-for-file-uris-in-Runtim.patch @@ -0,0 +1,68 @@ +From 1029f2b1d05bf96eb6083b5879c31997fd1d53be Mon Sep 17 00:00:00 2001 +From: Alexander Larsson +Date: Wed, 12 Jun 2019 08:15:37 +0200 +Subject: [PATCH] transaction: Add back support for file: uris in RuntimeRepo + keys + +This used to work, and the gnome-software test suite relies on it, +so add it back. I believe it regressed in + https://github.com/flatpak/flatpak/pull/2740 + +This fixes https://github.com/flatpak/flatpak/issues/2955 + +Closes: #2956 +Approved by: alexlarsson +--- + common/flatpak-transaction.c | 34 +++++++++++++++++++++++++++------- + 1 file changed, 27 insertions(+), 7 deletions(-) + +diff --git a/common/flatpak-transaction.c b/common/flatpak-transaction.c +index 849455ca..e4a42dfc 100644 +--- a/common/flatpak-transaction.c ++++ b/common/flatpak-transaction.c +@@ -2618,15 +2618,35 @@ handle_runtime_repo_deps (FlatpakTransaction *self, + if (priv->disable_deps) + return TRUE; + +- if (!g_str_has_prefix (dep_url, "http:") && !g_str_has_prefix (dep_url, "https:")) +- return flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("Flatpakrepo URL %s not HTTP or HTTPS"), dep_url); + +- soup_session = flatpak_create_soup_session (PACKAGE_STRING); +- dep_data = flatpak_load_http_uri (soup_session, dep_url, 0, NULL, NULL, cancellable, error); +- if (dep_data == NULL) ++ if (g_str_has_prefix (dep_url, "file:")) + { +- g_prefix_error (error, "Can't load dependent file %s", dep_url); +- return FALSE; ++ g_autoptr(GFile) file = NULL; ++ g_autofree char *data = NULL; ++ gsize data_len; ++ ++ file = g_file_new_for_uri (dep_url); ++ ++ if (!g_file_load_contents (file, cancellable, &data, &data_len, NULL, error)) ++ { ++ g_prefix_error (error, "Can't load dependent file %s", dep_url); ++ return FALSE; ++ } ++ ++ dep_data = g_bytes_new_take (g_steal_pointer (&data), data_len); ++ } ++ else ++ { ++ if (!g_str_has_prefix (dep_url, "http:") && !g_str_has_prefix (dep_url, "https:")) ++ return flatpak_fail_error (error, FLATPAK_ERROR_INVALID_DATA, _("Flatpakrepo URL %s not HTTP or HTTPS"), dep_url); ++ ++ soup_session = flatpak_create_soup_session (PACKAGE_STRING); ++ dep_data = flatpak_load_http_uri (soup_session, dep_url, 0, NULL, NULL, cancellable, error); ++ if (dep_data == NULL) ++ { ++ g_prefix_error (error, "Can't load dependent file %s", dep_url); ++ return FALSE; ++ } + } + + if (!g_key_file_load_from_data (dep_keyfile, +-- +2.21.0 + diff --git a/flatpak.spec b/flatpak.spec index ec89fa8..5f905b0 100644 --- a/flatpak.spec +++ b/flatpak.spec @@ -3,7 +3,7 @@ Name: flatpak Version: 1.4.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Application deployment framework for desktop apps License: LGPLv2+ @@ -12,6 +12,9 @@ Source0: https://github.com/flatpak/flatpak/releases/download/%{version}/ # Add Fedora flatpak repositories Source1: flatpak-add-fedora-repos.service +# Backported from upstream +Patch0: 0001-transaction-Add-back-support-for-file-uris-in-Runtim.patch + BuildRequires: pkgconfig(appstream-glib) BuildRequires: pkgconfig(dconf) BuildRequires: pkgconfig(fuse) @@ -246,6 +249,9 @@ fi %changelog +* Wed Jun 12 2019 Kalev Lember - 1.4.0-2 +- Backport an upstream patch to fix gnome-software CI + * Tue May 28 2019 Kalev Lember - 1.4.0-1 - Update to 1.4.0