Backport an upstream patch to fix gnome-software CI

This commit is contained in:
Kalev Lember 2019-06-12 10:22:14 +02:00
parent 7895c61f77
commit 842e7bdf8a
2 changed files with 75 additions and 1 deletions

View File

@ -0,0 +1,68 @@
From 1029f2b1d05bf96eb6083b5879c31997fd1d53be Mon Sep 17 00:00:00 2001
From: Alexander Larsson <alexl@redhat.com>
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

View File

@ -3,7 +3,7 @@
Name: flatpak Name: flatpak
Version: 1.4.0 Version: 1.4.0
Release: 1%{?dist} Release: 2%{?dist}
Summary: Application deployment framework for desktop apps Summary: Application deployment framework for desktop apps
License: LGPLv2+ License: LGPLv2+
@ -12,6 +12,9 @@ Source0: https://github.com/flatpak/flatpak/releases/download/%{version}/
# Add Fedora flatpak repositories # Add Fedora flatpak repositories
Source1: flatpak-add-fedora-repos.service 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(appstream-glib)
BuildRequires: pkgconfig(dconf) BuildRequires: pkgconfig(dconf)
BuildRequires: pkgconfig(fuse) BuildRequires: pkgconfig(fuse)
@ -246,6 +249,9 @@ fi
%changelog %changelog
* Wed Jun 12 2019 Kalev Lember <klember@redhat.com> - 1.4.0-2
- Backport an upstream patch to fix gnome-software CI
* Tue May 28 2019 Kalev Lember <klember@redhat.com> - 1.4.0-1 * Tue May 28 2019 Kalev Lember <klember@redhat.com> - 1.4.0-1
- Update to 1.4.0 - Update to 1.4.0