import gnome-software-3.36.1-4.el8

This commit is contained in:
CentOS Sources 2020-11-03 06:45:21 -05:00 committed by Andrew Lukoshko
parent 6364d58514
commit d29d6cabb5
13 changed files with 2860 additions and 363 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/gnome-software-3.30.6.tar.xz
SOURCES/gnome-software-3.36.1.tar.xz

View File

@ -1 +1 @@
a7006d754afdc4f9d59690b5805f8c93d02a0c98 SOURCES/gnome-software-3.30.6.tar.xz
9c6342f47f5ad90deac7cc8250f559146f506fff SOURCES/gnome-software-3.36.1.tar.xz

View File

@ -0,0 +1,813 @@
From b6a41a1b9e9020a23dbc418183ebe4746b6ec027 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Mon, 18 May 2020 14:45:35 +0200
Subject: [PATCH 1/2] Add basic auth support to flatpak plugin
This is useful for e.g. OCI remotes that can use basic auth.
All user visible strings in the basic auth dialog are taken from the
flatpak CLI client.
---
lib/gs-plugin-loader.c | 29 +++-
lib/gs-plugin-loader.h | 7 +-
lib/gs-plugin.c | 68 +++++++++-
lib/gs-plugin.h | 13 +-
plugins/flatpak/gs-plugin-flatpak.c | 55 +++++++-
po/POTFILES.in | 2 +
src/gnome-software.gresource.xml | 1 +
src/gs-basic-auth-dialog.c | 130 ++++++++++++++++++
src/gs-basic-auth-dialog.h | 28 ++++
src/gs-basic-auth-dialog.ui | 203 ++++++++++++++++++++++++++++
src/gs-shell.c | 25 +++-
src/meson.build | 1 +
12 files changed, 556 insertions(+), 6 deletions(-)
create mode 100644 src/gs-basic-auth-dialog.c
create mode 100644 src/gs-basic-auth-dialog.h
create mode 100644 src/gs-basic-auth-dialog.ui
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 979f3d5d..35382e3f 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2007-2018 Richard Hughes <richard@hughsie.com>
- * Copyright (C) 2014-2018 Kalev Lember <klember@redhat.com>
+ * Copyright (C) 2014-2020 Kalev Lember <klember@redhat.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -74,6 +74,7 @@ enum {
SIGNAL_PENDING_APPS_CHANGED,
SIGNAL_UPDATES_CHANGED,
SIGNAL_RELOAD,
+ SIGNAL_BASIC_AUTH_START,
SIGNAL_LAST
};
@@ -2016,6 +2017,23 @@ gs_plugin_loader_status_changed_cb (GsPlugin *plugin,
0, app, status);
}
+static void
+gs_plugin_loader_basic_auth_start_cb (GsPlugin *plugin,
+ const gchar *remote,
+ const gchar *realm,
+ GCallback callback,
+ gpointer user_data,
+ GsPluginLoader *plugin_loader)
+{
+ g_debug ("emitting basic-auth-start %s", realm);
+ g_signal_emit (plugin_loader,
+ signals[SIGNAL_BASIC_AUTH_START], 0,
+ remote,
+ realm,
+ callback,
+ user_data);
+}
+
static gboolean
gs_plugin_loader_job_actions_changed_delay_cb (gpointer user_data)
{
@@ -2102,6 +2120,9 @@ gs_plugin_loader_open_plugin (GsPluginLoader *plugin_loader,
g_signal_connect (plugin, "status-changed",
G_CALLBACK (gs_plugin_loader_status_changed_cb),
plugin_loader);
+ g_signal_connect (plugin, "basic-auth-start",
+ G_CALLBACK (gs_plugin_loader_basic_auth_start_cb),
+ plugin_loader);
g_signal_connect (plugin, "report-event",
G_CALLBACK (gs_plugin_loader_report_event_cb),
plugin_loader);
@@ -2712,6 +2733,12 @@ gs_plugin_loader_class_init (GsPluginLoaderClass *klass)
G_STRUCT_OFFSET (GsPluginLoaderClass, reload),
NULL, NULL, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ signals [SIGNAL_BASIC_AUTH_START] =
+ g_signal_new ("basic-auth-start",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GsPluginLoaderClass, basic_auth_start),
+ NULL, NULL, g_cclosure_marshal_generic,
+ G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_POINTER);
}
static void
diff --git a/lib/gs-plugin-loader.h b/lib/gs-plugin-loader.h
index 74cbfa53..e88ea2d1 100644
--- a/lib/gs-plugin-loader.h
+++ b/lib/gs-plugin-loader.h
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2007-2017 Richard Hughes <richard@hughsie.com>
- * Copyright (C) 2015 Kalev Lember <klember@redhat.com>
+ * Copyright (C) 2015-2020 Kalev Lember <klember@redhat.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -31,6 +31,11 @@ struct _GsPluginLoaderClass
void (*pending_apps_changed) (GsPluginLoader *plugin_loader);
void (*updates_changed) (GsPluginLoader *plugin_loader);
void (*reload) (GsPluginLoader *plugin_loader);
+ void (*basic_auth_start) (GsPluginLoader *plugin_loader,
+ const gchar *remote,
+ const gchar *realm,
+ GCallback callback,
+ gpointer user_data);
};
GsPluginLoader *gs_plugin_loader_new (void);
diff --git a/lib/gs-plugin.c b/lib/gs-plugin.c
index 5aed1058..3f63fa97 100644
--- a/lib/gs-plugin.c
+++ b/lib/gs-plugin.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2013-2016 Richard Hughes <richard@hughsie.com>
- * Copyright (C) 2014-2018 Kalev Lember <klember@redhat.com>
+ * Copyright (C) 2014-2020 Kalev Lember <klember@redhat.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -87,6 +87,7 @@ enum {
SIGNAL_RELOAD,
SIGNAL_REPORT_EVENT,
SIGNAL_ALLOW_UPDATES,
+ SIGNAL_BASIC_AUTH_START,
SIGNAL_LAST
};
@@ -851,6 +852,64 @@ gs_plugin_status_update (GsPlugin *plugin, GsApp *app, GsPluginStatus status)
g_source_attach (idle_source, NULL);
}
+typedef struct {
+ GsPlugin *plugin;
+ gchar *remote;
+ gchar *realm;
+ GCallback callback;
+ gpointer user_data;
+} GsPluginBasicAuthHelper;
+
+static gboolean
+gs_plugin_basic_auth_start_cb (gpointer user_data)
+{
+ GsPluginBasicAuthHelper *helper = user_data;
+ g_signal_emit (helper->plugin,
+ signals[SIGNAL_BASIC_AUTH_START], 0,
+ helper->remote,
+ helper->realm,
+ helper->callback,
+ helper->user_data);
+ g_free (helper->remote);
+ g_free (helper->realm);
+ g_slice_free (GsPluginBasicAuthHelper, helper);
+ return FALSE;
+}
+
+/**
+ * gs_plugin_basic_auth_start:
+ * @plugin: a #GsPlugin
+ * @remote: a string
+ * @realm: a string
+ * @callback: callback to invoke to submit the user/password
+ * @user_data: callback data to pass to the callback
+ *
+ * Emit the basic-auth-start signal in the main thread.
+ *
+ * Since: 3.38
+ **/
+void
+gs_plugin_basic_auth_start (GsPlugin *plugin,
+ const gchar *remote,
+ const gchar *realm,
+ GCallback callback,
+ gpointer user_data)
+{
+ GsPluginBasicAuthHelper *helper;
+ g_autoptr(GSource) idle_source = NULL;
+
+ helper = g_slice_new0 (GsPluginBasicAuthHelper);
+ helper->plugin = plugin;
+ helper->remote = g_strdup (remote);
+ helper->realm = g_strdup (realm);
+ helper->callback = callback;
+ helper->user_data = user_data;
+
+ idle_source = g_idle_source_new ();
+ g_source_set_callback (idle_source, gs_plugin_basic_auth_start_cb, helper, NULL);
+ g_source_attach (idle_source, NULL);
+}
+
static gboolean
gs_plugin_app_launch_cb (gpointer user_data)
{
@@ -1959,6 +2018,13 @@ gs_plugin_class_init (GsPluginClass *klass)
G_STRUCT_OFFSET (GsPluginClass, allow_updates),
NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+
+ signals [SIGNAL_BASIC_AUTH_START] =
+ g_signal_new ("basic-auth-start",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GsPluginClass, basic_auth_start),
+ NULL, NULL, g_cclosure_marshal_generic,
+ G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_POINTER);
}
static void
diff --git a/lib/gs-plugin.h b/lib/gs-plugin.h
index 7dd2d864..d07afd3b 100644
--- a/lib/gs-plugin.h
+++ b/lib/gs-plugin.h
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2012-2016 Richard Hughes <richard@hughsie.com>
+ * Copyright (C) 2020 Kalev Lember <klember@redhat.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -37,7 +38,12 @@ struct _GsPluginClass
GsPluginEvent *event);
void (*allow_updates) (GsPlugin *plugin,
gboolean allow_updates);
- gpointer padding[26];
+ void (*basic_auth_start) (GsPlugin *plugin,
+ const gchar *remote,
+ const gchar *realm,
+ GCallback callback,
+ gpointer user_data);
+ gpointer padding[25];
};
typedef struct GsPluginData GsPluginData;
@@ -116,5 +122,10 @@ void gs_plugin_report_event (GsPlugin *plugin,
void gs_plugin_set_allow_updates (GsPlugin *plugin,
gboolean allow_updates);
gboolean gs_plugin_get_network_available (GsPlugin *plugin);
+void gs_plugin_basic_auth_start (GsPlugin *plugin,
+ const gchar *remote,
+ const gchar *realm,
+ GCallback callback,
+ gpointer user_data);
G_END_DECLS
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index 4d6a81ba..2518025d 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -2,7 +2,7 @@
*
* Copyright (C) 2016 Joaquim Rocha <jrocha@endlessm.com>
* Copyright (C) 2016-2018 Richard Hughes <richard@hughsie.com>
- * Copyright (C) 2017-2018 Kalev Lember <klember@redhat.com>
+ * Copyright (C) 2017-2020 Kalev Lember <klember@redhat.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -456,6 +456,55 @@ _group_apps_by_installation (GsPlugin *plugin,
return g_steal_pointer (&applist_by_flatpaks);
}
+#if FLATPAK_CHECK_VERSION(1,6,0)
+typedef struct {
+ FlatpakTransaction *transaction;
+ guint id;
+} BasicAuthData;
+
+static void
+basic_auth_data_free (BasicAuthData *data)
+{
+ g_object_unref (data->transaction);
+ g_slice_free (BasicAuthData, data);
+}
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(BasicAuthData, basic_auth_data_free)
+
+static void
+_basic_auth_cb (const gchar *user, const gchar *password, gpointer user_data)
+{
+ g_autoptr(BasicAuthData) data = user_data;
+
+ g_debug ("Submitting basic auth data");
+
+ /* NULL user aborts the basic auth request */
+ flatpak_transaction_complete_basic_auth (data->transaction, data->id, user, password, NULL /* options */);
+}
+
+static gboolean
+_basic_auth_start (FlatpakTransaction *transaction,
+ const char *remote,
+ const char *realm,
+ GVariant *options,
+ guint id,
+ GsPlugin *plugin)
+{
+ BasicAuthData *data;
+
+ if (!gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE))
+ return FALSE;
+
+ data = g_slice_new0 (BasicAuthData);
+ data->transaction = g_object_ref (transaction);
+ data->id = id;
+
+ g_debug ("Login required remote %s (realm %s)\n", remote, realm);
+ gs_plugin_basic_auth_start (plugin, remote, realm, G_CALLBACK (_basic_auth_cb), data);
+ return TRUE;
+}
+#endif
+
static FlatpakTransaction *
_build_transaction (GsPlugin *plugin, GsFlatpak *flatpak,
GCancellable *cancellable, GError **error)
@@ -491,6 +540,10 @@ _build_transaction (GsPlugin *plugin, GsFlatpak *flatpak,
/* connect up signals */
g_signal_connect (transaction, "ref-to-app",
G_CALLBACK (_ref_to_app), plugin);
+#if FLATPAK_CHECK_VERSION(1,6,0)
+ g_signal_connect (transaction, "basic-auth-start",
+ G_CALLBACK (_basic_auth_start), plugin);
+#endif
/* use system installations as dependency sources for user installations */
flatpak_transaction_add_default_dependency_sources (transaction);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 20721c4a..a44a6ad3 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -10,6 +10,8 @@ src/gs-app-row.c
src/gs-app-row.ui
src/gs-app-tile.c
src/gs-app-tile.ui
+src/gs-basic-auth-dialog.c
+src/gs-basic-auth-dialog.ui
lib/gs-category.c
src/gs-category-page.c
src/gs-category-page.ui
diff --git a/src/gnome-software.gresource.xml b/src/gnome-software.gresource.xml
index 3eaabca2..459ecf82 100644
--- a/src/gnome-software.gresource.xml
+++ b/src/gnome-software.gresource.xml
@@ -4,6 +4,7 @@
<file preprocess="xml-stripblanks">gnome-software.ui</file>
<file preprocess="xml-stripblanks">gs-app-addon-row.ui</file>
<file preprocess="xml-stripblanks">gs-app-row.ui</file>
+ <file preprocess="xml-stripblanks">gs-basic-auth-dialog.ui</file>
<file preprocess="xml-stripblanks">gs-category-page.ui</file>
<file preprocess="xml-stripblanks">gs-category-tile.ui</file>
<file preprocess="xml-stripblanks">gs-details-page.ui</file>
diff --git a/src/gs-basic-auth-dialog.c b/src/gs-basic-auth-dialog.c
new file mode 100644
index 00000000..c690a327
--- /dev/null
+++ b/src/gs-basic-auth-dialog.c
@@ -0,0 +1,130 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2020 Kalev Lember <klember@redhat.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include "config.h"
+
+#include "gs-basic-auth-dialog.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+struct _GsBasicAuthDialog
+{
+ GtkDialog parent_instance;
+
+ GsBasicAuthCallback callback;
+ gpointer callback_data;
+
+ /* template widgets */
+ GtkButton *login_button;
+ GtkLabel *description_label;
+ GtkEntry *user_entry;
+ GtkEntry *password_entry;
+};
+
+G_DEFINE_TYPE (GsBasicAuthDialog, gs_basic_auth_dialog, GTK_TYPE_DIALOG)
+
+static void
+cancel_button_clicked_cb (GsBasicAuthDialog *dialog)
+{
+ /* abort the basic auth request */
+ dialog->callback (NULL, NULL, dialog->callback_data);
+
+ gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
+}
+
+static void
+login_button_clicked_cb (GsBasicAuthDialog *dialog)
+{
+ const gchar *user;
+ const gchar *password;
+
+ user = gtk_entry_get_text (dialog->user_entry);
+ password = gtk_entry_get_text (dialog->password_entry);
+
+ /* submit the user/password to basic auth */
+ dialog->callback (user, password, dialog->callback_data);
+
+ gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+}
+
+static void
+dialog_validate (GsBasicAuthDialog *dialog)
+{
+ const gchar *user;
+ const gchar *password;
+ gboolean valid_user;
+ gboolean valid_password;
+
+ /* require user */
+ user = gtk_entry_get_text (dialog->user_entry);
+ valid_user = user != NULL && strlen (user) != 0;
+
+ /* require password */
+ password = gtk_entry_get_text (dialog->password_entry);
+ valid_password = password != NULL && strlen (password) != 0;
+
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->login_button), valid_user && valid_password);
+}
+
+static void
+update_description (GsBasicAuthDialog *dialog, const gchar *remote, const gchar *realm)
+{
+ g_autofree gchar *description = NULL;
+
+ /* TRANSLATORS: This is a description for entering user/password */
+ description = g_strdup_printf (_("Login required remote %s (realm %s)"),
+ remote, realm);
+ gtk_label_set_text (dialog->description_label, description);
+}
+
+static void
+gs_basic_auth_dialog_init (GsBasicAuthDialog *dialog)
+{
+ gtk_widget_init_template (GTK_WIDGET (dialog));
+}
+
+static void
+gs_basic_auth_dialog_class_init (GsBasicAuthDialogClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/Software/gs-basic-auth-dialog.ui");
+
+ gtk_widget_class_bind_template_child (widget_class, GsBasicAuthDialog, login_button);
+ gtk_widget_class_bind_template_child (widget_class, GsBasicAuthDialog, description_label);
+ gtk_widget_class_bind_template_child (widget_class, GsBasicAuthDialog, user_entry);
+ gtk_widget_class_bind_template_child (widget_class, GsBasicAuthDialog, password_entry);
+
+ gtk_widget_class_bind_template_callback (widget_class, dialog_validate);
+ gtk_widget_class_bind_template_callback (widget_class, cancel_button_clicked_cb);
+ gtk_widget_class_bind_template_callback (widget_class, login_button_clicked_cb);
+}
+
+GtkWidget *
+gs_basic_auth_dialog_new (GtkWindow *parent,
+ const gchar *remote,
+ const gchar *realm,
+ GsBasicAuthCallback callback,
+ gpointer callback_data)
+{
+ GsBasicAuthDialog *dialog;
+
+ dialog = g_object_new (GS_TYPE_BASIC_AUTH_DIALOG,
+ "use-header-bar", TRUE,
+ "transient-for", parent,
+ "modal", TRUE,
+ NULL);
+ dialog->callback = callback;
+ dialog->callback_data = callback_data;
+
+ update_description (dialog, remote, realm);
+ dialog_validate (dialog);
+
+ return GTK_WIDGET (dialog);
+}
diff --git a/src/gs-basic-auth-dialog.h b/src/gs-basic-auth-dialog.h
new file mode 100644
index 00000000..ec5f1d03
--- /dev/null
+++ b/src/gs-basic-auth-dialog.h
@@ -0,0 +1,28 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2020 Kalev Lember <klember@redhat.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#pragma once
+
+#include <gtk/gtk.h>
+
+#include "gnome-software-private.h"
+
+G_BEGIN_DECLS
+
+typedef void (*GsBasicAuthCallback) (const gchar *user, const gchar *password, gpointer callback_data);
+
+#define GS_TYPE_BASIC_AUTH_DIALOG (gs_basic_auth_dialog_get_type ())
+
+G_DECLARE_FINAL_TYPE (GsBasicAuthDialog, gs_basic_auth_dialog, GS, BASIC_AUTH_DIALOG, GtkDialog)
+
+GtkWidget *gs_basic_auth_dialog_new (GtkWindow *parent,
+ const gchar *remote,
+ const gchar *realm,
+ GsBasicAuthCallback callback,
+ gpointer callback_data);
+
+G_END_DECLS
diff --git a/src/gs-basic-auth-dialog.ui b/src/gs-basic-auth-dialog.ui
new file mode 100644
index 00000000..339e831d
--- /dev/null
+++ b/src/gs-basic-auth-dialog.ui
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="GsBasicAuthDialog" parent="GtkDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="type_hint">dialog</property>
+ <property name="title" translatable="yes">Login Required</property>
+ <property name="use_header_bar">1</property>
+ <child internal-child="headerbar">
+ <object class="GtkHeaderBar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="show_close_button">False</property>
+ <child>
+ <object class="GtkButton" id="cancel_button">
+ <property name="label" translatable="yes">_Cancel</property>
+ <property name="visible">True</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="valign">center</property>
+ <signal name="clicked" handler="cancel_button_clicked_cb" object="GsBasicAuthDialog" swapped="yes"/>
+ <style>
+ <class name="text-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="pack_type">start</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="login_button">
+ <property name="label" translatable="yes">_Login</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="valign">center</property>
+ <signal name="clicked" handler="login_button_clicked_cb" object="GsBasicAuthDialog" swapped="yes"/>
+ <style>
+ <class name="text-button"/>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child internal-child="vbox">
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkGrid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="row_spacing">8</property>
+ <property name="column_spacing">6</property>
+ <property name="border_width">20</property>
+ <property name="margin_end">20</property>
+ <child>
+ <object class="GtkLabel" id="description_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="wrap">True</property>
+ <property name="wrap_mode">word-char</property>
+ <property name="margin_bottom">20</property>
+ <property name="max_width_chars">55</property>
+ <property name="xalign">0</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">2</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="user_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_User</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">user_entry</property>
+ <property name="margin_start">20</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="password_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Password</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">password_entry</property>
+ <property name="margin_start">20</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="user_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="invisible_char">●</property>
+ <property name="activates_default">True</property>
+ <property name="invisible_char_set">True</property>
+ <property name="input_purpose">password</property>
+ <signal name="changed" handler="dialog_validate" object="GsBasicAuthDialog" swapped="yes"/>
+ <signal name="activate" handler="dialog_validate" object="GsBasicAuthDialog" swapped="yes"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="password_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="visibility">False</property>
+ <property name="invisible_char">●</property>
+ <property name="activates_default">True</property>
+ <property name="invisible_char_set">True</property>
+ <property name="input_purpose">password</property>
+ <signal name="changed" handler="dialog_validate" object="GsBasicAuthDialog" swapped="yes"/>
+ <signal name="activate" handler="dialog_validate" object="GsBasicAuthDialog" swapped="yes"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </template>
+ <object class="GtkSizeGroup">
+ <widgets>
+ <widget name="user_label"/>
+ <widget name="password_label"/>
+ </widgets>
+ </object>
+ <object class="GtkSizeGroup">
+ <widgets>
+ <widget name="user_entry"/>
+ <widget name="password_entry"/>
+ </widgets>
+ </object>
+ <object class="GtkSizeGroup">
+ <property name="mode">horizontal</property>
+ <widgets>
+ <widget name="login_button"/>
+ <widget name="cancel_button"/>
+ </widgets>
+ </object>
+</interface>
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 009776ad..41503cf8 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -2,7 +2,7 @@
*
* Copyright (C) 2013-2017 Richard Hughes <richard@hughsie.com>
* Copyright (C) 2013 Matthias Clasen <mclasen@redhat.com>
- * Copyright (C) 2014-2018 Kalev Lember <klember@redhat.com>
+ * Copyright (C) 2014-2020 Kalev Lember <klember@redhat.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -18,6 +18,7 @@
#include "gs-common.h"
#include "gs-shell.h"
+#include "gs-basic-auth-dialog.h"
#include "gs-details-page.h"
#include "gs-installed-page.h"
#include "gs-metered-data-dialog.h"
@@ -362,6 +363,25 @@ scheduler_ready_cb (GObject *source_object,
}
#endif /* HAVE_MOGWAI */
+static void
+gs_shell_basic_auth_start_cb (GsPluginLoader *plugin_loader,
+ const gchar *remote,
+ const gchar *realm,
+ GsBasicAuthCallback callback,
+ gpointer callback_data,
+ GsShell *shell)
+{
+ GsShellPrivate *priv = gs_shell_get_instance_private (shell);
+ GtkWidget *dialog;
+
+ dialog = gs_basic_auth_dialog_new (priv->main_window, remote, realm, callback, callback_data);
+ gs_shell_modal_dialog_present (shell, GTK_DIALOG (dialog));
+
+ /* just destroy */
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), dialog);
+}
+
static void
free_back_entry (BackEntry *entry)
{
@@ -2126,6 +2146,9 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
g_signal_connect_object (priv->plugin_loader, "notify::network-metered",
G_CALLBACK (gs_shell_network_metered_notify_cb),
shell, 0);
+ g_signal_connect_object (priv->plugin_loader, "basic-auth-start",
+ G_CALLBACK (gs_shell_basic_auth_start_cb),
+ shell, 0);
priv->cancellable = g_object_ref (cancellable);
priv->settings = g_settings_new ("org.gnome.software");
diff --git a/src/meson.build b/src/meson.build
index cbd0a511..6581e77c 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -20,6 +20,7 @@ gnome_software_sources = [
'gs-application.c',
'gs-app-row.c',
'gs-app-tile.c',
+ 'gs-basic-auth-dialog.c',
'gs-category-page.c',
'gs-category-tile.c',
'gs-common.c',
--
2.26.2

View File

@ -0,0 +1,61 @@
From 9dce785c2a71e81c410c6e314dd4d4db6cc02808 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Wed, 3 Jun 2020 16:35:03 +0200
Subject: [PATCH] Fix hardcoded desktop and appdata names to match what's in
RHEL 8.3
---
data/assets/org.gnome.Software.Featured.xml | 2 +-
plugins/core/gs-plugin-hardcoded-popular.c | 2 +-
src/gs-folders.c | 6 +++---
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/data/assets/org.gnome.Software.Featured.xml b/data/assets/org.gnome.Software.Featured.xml
index d1d920be..822fc6a9 100644
--- a/data/assets/org.gnome.Software.Featured.xml
+++ b/data/assets/org.gnome.Software.Featured.xml
@@ -145,7 +145,7 @@ text-shadow: none;</value>
</custom>
</component>
<component merge="append">
- <id>org.gimp.GIMP</id>
+ <id>gimp.desktop</id>
<custom>
<value key="GnomeSoftware::FeatureTile-css">border-color: #4a8c30;
text-shadow: none;
diff --git a/plugins/core/gs-plugin-hardcoded-popular.c b/plugins/core/gs-plugin-hardcoded-popular.c
index 3998a813..03b44475 100644
--- a/plugins/core/gs-plugin-hardcoded-popular.c
+++ b/plugins/core/gs-plugin-hardcoded-popular.c
@@ -29,7 +29,7 @@ gs_plugin_add_popular (GsPlugin *plugin,
"org.gnome.clocks.desktop",
"org.gnome.Dictionary.desktop",
"org.gnome.Documents.desktop",
- "org.gnome.Evince",
+ "evince.desktop",
"org.gnome.gedit.desktop",
"org.gnome.Maps.desktop",
"org.gnome.Weather",
diff --git a/src/gs-folders.c b/src/gs-folders.c
index fa068f0e..589cc1e2 100644
--- a/src/gs-folders.c
+++ b/src/gs-folders.c
@@ -560,12 +560,12 @@ gs_folders_convert (void)
"org.gnome.DejaDup.desktop",
"org.gnome.Dictionary.desktop",
"org.gnome.DiskUtility.desktop",
- "org.gnome.eog.desktop",
- "org.gnome.Evince.desktop",
+ "eog.desktop",
+ "evince.desktop",
"org.gnome.FileRoller.desktop",
"org.gnome.fonts.desktop",
"org.gnome.Screenshot.desktop",
- "org.gnome.seahorse.Application.desktop",
+ "seahorse.desktop",
"org.gnome.Terminal.desktop",
"org.gnome.tweaks.desktop",
"org.gnome.Usage.desktop",
--
2.18.2

View File

@ -0,0 +1,69 @@
From bc31889bf90e14776e4404cd58e9b0244efc4f2e Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 9 Jun 2020 21:42:41 +0200
Subject: [PATCH] Improve the heuristic for detecting old-style AppStream
override files
The heuristic was trying to detect old-style AppStream override files
that have the following structure:
<component type=desktop>
<id>org.kde.amarok.desktop</id>
<categories>
<category>AudioVideo</category>
<category>Featured</category>
</categories>
</component>
When it found one, it gave it the wildcard quirk to avoid leaking the
result to the installed apps list.
This however incorrectly tripped on old appdata files that didn't
specify name and relied on filling the missing name/summary/icon from
the desktop file.
Fix this by tightening the heuristic and also look for
<metadata_license> that none of the override files should have.
This fixes RHEL firefox package to correctly show up when clicking on
'Show Details' in GNOME Shell.
---
plugins/core/gs-appstream.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/plugins/core/gs-appstream.c b/plugins/core/gs-appstream.c
index a387f2e0..da9ba970 100644
--- a/plugins/core/gs-appstream.c
+++ b/plugins/core/gs-appstream.c
@@ -746,6 +746,13 @@ gs_appstream_refine_app (GsPlugin *plugin,
gs_app_remove_quirk (app, GS_APP_QUIRK_HIDE_EVERYWHERE);
}
+ /* try to detect old-style AppStream 'override'
+ * files without the merge attribute */
+ if (xb_node_query_text (component, "name", NULL) == NULL &&
+ xb_node_query_text (component, "metadata_license", NULL) == NULL) {
+ gs_app_add_quirk (app, GS_APP_QUIRK_IS_WILDCARD);
+ }
+
/* set id */
tmp = xb_node_query_text (component, "id", NULL);
if (tmp != NULL && gs_app_get_id (app) == NULL)
@@ -770,13 +777,8 @@ gs_appstream_refine_app (GsPlugin *plugin,
/* set name */
tmp = xb_node_query_text (component, "name", NULL);
- if (tmp != NULL) {
+ if (tmp != NULL)
gs_app_set_name (app, GS_APP_QUALITY_HIGHEST, tmp);
- } else {
- /* this is a heuristic, but works even with old-style AppStream
- * files without the merge attribute */
- gs_app_add_quirk (app, GS_APP_QUIRK_IS_WILDCARD);
- }
/* set summary */
tmp = xb_node_query_text (component, "summary", NULL);
--
2.26.2

View File

@ -1,145 +0,0 @@
From f91c54a70860ed12270bbafa121acae36f29badb Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 18 Dec 2018 02:44:31 +0100
Subject: [PATCH] Lower AsStore new API version checks for Fedora
We have new the AsStore thread safety patches along with new thread safe
API backported to libappstream-glib-0.7.14-3.fc29.
---
plugins/core/gs-appstream.c | 12 ++++++------
plugins/core/gs-plugin-appstream.c | 12 ++++++------
plugins/flatpak/gs-flatpak.c | 2 +-
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/plugins/core/gs-appstream.c b/plugins/core/gs-appstream.c
index b7bccd19a..7b606fe0d 100644
--- a/plugins/core/gs-appstream.c
+++ b/plugins/core/gs-appstream.c
@@ -860,7 +860,7 @@ gs_appstream_store_search (GsPlugin *plugin,
gboolean ret = TRUE;
g_autoptr(GPtrArray) array = NULL;
-#if AS_CHECK_VERSION(0,7,15)
+#if AS_CHECK_VERSION(0,7,14)
array = as_store_dup_apps (store);
#else
array = g_ptr_array_ref (as_store_get_apps (store));
@@ -937,7 +937,7 @@ gs_appstream_store_add_category_apps (GsPlugin *plugin,
g_autoptr(GPtrArray) array = NULL;
/* just look at each app in turn */
-#if AS_CHECK_VERSION(0,7,15)
+#if AS_CHECK_VERSION(0,7,14)
array = as_store_dup_apps (store);
#else
array = g_ptr_array_ref (as_store_get_apps (store));
@@ -985,7 +985,7 @@ gs_appstream_store_add_categories (GsPlugin *plugin,
g_autoptr(GPtrArray) array = NULL;
/* find out how many packages are in each category */
-#if AS_CHECK_VERSION(0,7,15)
+#if AS_CHECK_VERSION(0,7,14)
array = as_store_dup_apps (store);
#else
array = g_ptr_array_ref (as_store_get_apps (store));
@@ -1013,7 +1013,7 @@ gs_appstream_add_popular (GsPlugin *plugin,
{
g_autoptr(GPtrArray) array = NULL;
-#if AS_CHECK_VERSION(0,7,15)
+#if AS_CHECK_VERSION(0,7,14)
array = as_store_dup_apps (store);
#else
array = g_ptr_array_ref (as_store_get_apps (store));
@@ -1059,7 +1059,7 @@ gs_appstream_add_recent (GsPlugin *plugin,
{
g_autoptr(GPtrArray) array = NULL;
-#if AS_CHECK_VERSION(0,7,15)
+#if AS_CHECK_VERSION(0,7,14)
array = as_store_dup_apps (store);
#else
array = g_ptr_array_ref (as_store_get_apps (store));
@@ -1088,7 +1088,7 @@ gs_appstream_add_featured (GsPlugin *plugin,
{
g_autoptr(GPtrArray) array = NULL;
-#if AS_CHECK_VERSION(0,7,15)
+#if AS_CHECK_VERSION(0,7,14)
array = as_store_dup_apps (store);
#else
array = g_ptr_array_ref (as_store_get_apps (store));
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index 77d004162..ce0ca9bda 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -56,7 +56,7 @@ gs_plugin_appstream_create_app_hash (AsStore *store)
hash = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, (GDestroyNotify) g_object_unref);
-#if AS_CHECK_VERSION(0,7,15)
+#if AS_CHECK_VERSION(0,7,14)
apps = as_store_dup_apps (store);
#else
apps = g_ptr_array_ref (as_store_get_apps (store));
@@ -290,7 +290,7 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
return FALSE;
}
}
-#if AS_CHECK_VERSION(0,7,15)
+#if AS_CHECK_VERSION(0,7,14)
items = as_store_dup_apps (priv->store);
#else
items = g_ptr_array_ref (as_store_get_apps (priv->store));
@@ -391,7 +391,7 @@ gs_plugin_refine_from_id (GsPlugin *plugin,
g_autoptr(GPtrArray) apps_merge = NULL;
g_debug ("no app with ID %s found in system appstream", unique_id);
-#if AS_CHECK_VERSION(0,7,15)
+#if AS_CHECK_VERSION(0,7,14)
apps = as_store_dup_apps (priv->store);
#else
apps = g_ptr_array_ref (as_store_get_apps (priv->store));
@@ -405,7 +405,7 @@ gs_plugin_refine_from_id (GsPlugin *plugin,
}
/* fall back to trying to get a merge app */
-#if AS_CHECK_VERSION(0,7,15)
+#if AS_CHECK_VERSION(0,7,14)
apps_merge = as_store_dup_apps_by_id_merge (priv->store, gs_app_get_id (app));
for (guint i = 0; i < apps_merge->len; i++) {
item = g_ptr_array_index (apps_merge, i);
@@ -472,7 +472,7 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
g_autoptr(GPtrArray) array = NULL;
/* find any upgrades */
-#if AS_CHECK_VERSION(0,7,15)
+#if AS_CHECK_VERSION(0,7,14)
array = as_store_dup_apps (priv->store);
#else
array = g_ptr_array_ref (as_store_get_apps (priv->store));
@@ -620,7 +620,7 @@ gs_plugin_add_installed (GsPlugin *plugin,
g_autoptr(GPtrArray) array = NULL;
/* search categories for the search term */
-#if AS_CHECK_VERSION(0,7,15)
+#if AS_CHECK_VERSION(0,7,14)
array = as_store_dup_apps (priv->store);
#else
array = g_ptr_array_ref (as_store_get_apps (priv->store));
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index b835d843c..921fd12e9 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -328,7 +328,7 @@ gs_flatpak_add_apps_from_xremote (GsFlatpak *self,
}
/* override the *AppStream* origin */
-#if AS_CHECK_VERSION(0,7,15)
+#if AS_CHECK_VERSION(0,7,14)
apps = as_store_dup_apps (store);
#else
apps = g_ptr_array_ref (as_store_get_apps (store));
--
2.19.1

View File

@ -1,50 +0,0 @@
From 96f516a4e01b00094919c6c365d804a109b5875f Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Wed, 24 Oct 2018 15:00:59 +0200
Subject: [PATCH] Lower as_utils_vercmp_full version check for Fedora
We have new as_utils_vercmp_full API backported to
libappstream-glib-0.7.14-2.fc29.
---
lib/gs-plugin-loader.c | 2 +-
src/gs-update-dialog.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 93e394906..b84a0ba65 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -1423,7 +1423,7 @@ gs_plugin_loader_app_sort_match_value_cb (GsApp *app1, GsApp *app2, gpointer use
static gint
gs_plugin_loader_app_sort_version_cb (GsApp *app1, GsApp *app2, gpointer user_data)
{
-#if AS_CHECK_VERSION(0,7,15)
+#if AS_CHECK_VERSION(0,7,14)
return as_utils_vercmp_full (gs_app_get_version (app1),
gs_app_get_version (app2),
AS_VERSION_COMPARE_FLAG_NONE);
diff --git a/src/gs-update-dialog.c b/src/gs-update-dialog.c
index b4c1b1187..e92cd5b87 100644
--- a/src/gs-update-dialog.c
+++ b/src/gs-update-dialog.c
@@ -374,7 +374,7 @@ is_downgrade (const gchar *evr1,
* part of the semantic version */
/* check version */
-#if AS_CHECK_VERSION(0,7,15)
+#if AS_CHECK_VERSION(0,7,14)
rc = as_utils_vercmp_full (version1, version2,
AS_VERSION_COMPARE_FLAG_NONE);
#else
@@ -384,7 +384,7 @@ is_downgrade (const gchar *evr1,
return rc > 0;
/* check release */
-#if AS_CHECK_VERSION(0,7,15)
+#if AS_CHECK_VERSION(0,7,14)
rc = as_utils_vercmp_full (version1, version2,
AS_VERSION_COMPARE_FLAG_NONE);
#else
--
2.19.1

View File

@ -1,27 +0,0 @@
From 4107a4aafc2a524454ca0590ab4d36764e513ddf Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Fri, 12 Jul 2019 11:08:54 +0300
Subject: [PATCH] details page: Hide addons that are not available in repos
https://bugzilla.redhat.com/show_bug.cgi?id=1719779
---
src/gs-details-page.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 2a59f8f08..5784250aa 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -1383,7 +1383,8 @@ gs_details_page_refresh_addons (GsDetailsPage *self)
GtkWidget *row;
addon = gs_app_list_index (addons, i);
- if (gs_app_get_state (addon) == AS_APP_STATE_UNAVAILABLE)
+ if (gs_app_get_state (addon) == AS_APP_STATE_UNKNOWN ||
+ gs_app_get_state (addon) == AS_APP_STATE_UNAVAILABLE)
continue;
row = gs_app_addon_row_new (addon);
--
2.21.0

View File

@ -1,35 +0,0 @@
From d51c480fc9f1bcb1b878be156f88741a6bbb364d Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 24 Sep 2019 11:16:14 +0200
Subject: [PATCH 1/2] epiphany: Don't adopt apps that have package name set
In Fedora appstream metadata we have <component type="webapp"> apps that
are supposed to be installed as packages and have the pkgname set.
Instead of adopting them in the epiphany plugin, leave them for the
packagekit plugin to handle.
https://gitlab.gnome.org/GNOME/gnome-software/issues/802
---
plugins/epiphany/gs-plugin-epiphany.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/plugins/epiphany/gs-plugin-epiphany.c b/plugins/epiphany/gs-plugin-epiphany.c
index 44e2e5bd..3db666e8 100644
--- a/plugins/epiphany/gs-plugin-epiphany.c
+++ b/plugins/epiphany/gs-plugin-epiphany.c
@@ -56,8 +56,10 @@ gs_plugin_initialize (GsPlugin *plugin)
void
gs_plugin_adopt_app (GsPlugin *plugin, GsApp *app)
{
- if (gs_app_get_kind (app) == AS_APP_KIND_WEB_APP)
+ if (gs_app_get_kind (app) == AS_APP_KIND_WEB_APP &&
+ gs_app_get_bundle_kind (app) != AS_BUNDLE_KIND_PACKAGE) {
gs_app_set_management_plugin (app, gs_plugin_get_name (plugin));
+ }
}
static gchar *
--
2.24.1

View File

@ -0,0 +1,104 @@
From de3afc6463aeb0e2d637a0360d1b96acffdf4e6d Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 19 May 2020 14:28:10 +0200
Subject: [PATCH 2/2] Add webflow auth support to flatpak plugin
This is just the minimal support, launching the auth page in the default
web browser when libflatpak signals that we need to do the webflow auth.
Possible improvements could include doing either a webkitgtk dialog, or
maybe asking for confirmation before launching the web browser.
---
plugins/flatpak/gs-plugin-flatpak.c | 69 +++++++++++++++++++++++++++++
1 file changed, 69 insertions(+)
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index 2518025d..a453cec8 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -503,6 +503,71 @@ _basic_auth_start (FlatpakTransaction *transaction,
gs_plugin_basic_auth_start (plugin, remote, realm, G_CALLBACK (_basic_auth_cb), data);
return TRUE;
}
+
+static gboolean
+_webflow_start (FlatpakTransaction *transaction,
+ const char *remote,
+ const char *url,
+ GVariant *options,
+ guint id,
+ GsPlugin *plugin)
+{
+ const char *browser;
+ g_autoptr(GError) error_local = NULL;
+
+ if (!gs_plugin_has_flags (plugin, GS_PLUGIN_FLAGS_INTERACTIVE))
+ return FALSE;
+
+ g_debug ("Authentication required for remote '%s'", remote);
+
+ /* Allow hard overrides with $BROWSER */
+ browser = g_getenv ("BROWSER");
+ if (browser != NULL) {
+ const char *args[3] = { NULL, url, NULL };
+ args[0] = browser;
+ if (!g_spawn_async (NULL, (char **)args, NULL, G_SPAWN_SEARCH_PATH,
+ NULL, NULL, NULL, &error_local)) {
+ g_autoptr(GsPluginEvent) event = NULL;
+
+ g_warning ("Failed to start browser %s: %s", browser, error_local->message);
+
+ event = gs_plugin_event_new ();
+ gs_flatpak_error_convert (&error_local);
+ gs_plugin_event_set_error (event, error_local);
+ gs_plugin_event_add_flag (event, GS_PLUGIN_EVENT_FLAG_WARNING);
+ gs_plugin_report_event (plugin, event);
+
+ return FALSE;
+ }
+ } else {
+ if (!g_app_info_launch_default_for_uri (url, NULL, &error_local)) {
+ g_autoptr(GsPluginEvent) event = NULL;
+
+ g_warning ("Failed to show url: %s", error_local->message);
+
+ event = gs_plugin_event_new ();
+ gs_flatpak_error_convert (&error_local);
+ gs_plugin_event_set_error (event, error_local);
+ gs_plugin_event_add_flag (event, GS_PLUGIN_EVENT_FLAG_WARNING);
+ gs_plugin_report_event (plugin, event);
+
+ return FALSE;
+ }
+ }
+
+ g_debug ("Waiting for browser...");
+
+ return TRUE;
+}
+
+static void
+_webflow_done (FlatpakTransaction *transaction,
+ GVariant *options,
+ guint id,
+ GsPlugin *plugin)
+{
+ g_debug ("Browser done");
+}
#endif
static FlatpakTransaction *
@@ -543,6 +608,10 @@ _build_transaction (GsPlugin *plugin, GsFlatpak *flatpak,
#if FLATPAK_CHECK_VERSION(1,6,0)
g_signal_connect (transaction, "basic-auth-start",
G_CALLBACK (_basic_auth_start), plugin);
+ g_signal_connect (transaction, "webflow-start",
+ G_CALLBACK (_webflow_start), plugin);
+ g_signal_connect (transaction, "webflow-done",
+ G_CALLBACK (_webflow_done), plugin);
#endif
/* use system installations as dependency sources for user installations */
--
2.26.2

View File

@ -1,39 +0,0 @@
From d3b4d3bd00b3d664ed5873babf06baf42f624de3 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 24 Sep 2019 11:19:31 +0200
Subject: [PATCH 2/2] packagekit: Don't skip over web apps
We now have web apps that are supposed to be installed as packages.
Don't just skip over all web apps, but rely on the management plugin
being correctly set.
Fixes: https://gitlab.gnome.org/GNOME/gnome-software/issues/802
---
plugins/packagekit/gs-plugin-packagekit-refine.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/plugins/packagekit/gs-plugin-packagekit-refine.c b/plugins/packagekit/gs-plugin-packagekit-refine.c
index 924b74a4..84849dc4 100644
--- a/plugins/packagekit/gs-plugin-packagekit-refine.c
+++ b/plugins/packagekit/gs-plugin-packagekit-refine.c
@@ -487,8 +487,6 @@ gs_plugin_packagekit_refine_details (GsPlugin *plugin,
GsApp *app = gs_app_list_index (list, i);
if (gs_app_has_quirk (app, AS_APP_QUIRK_MATCH_ANY_PREFIX))
continue;
- if (gs_app_get_kind (app) == AS_APP_KIND_WEB_APP)
- continue;
if (g_strcmp0 (gs_app_get_management_plugin (app), "packagekit") != 0)
continue;
if (gs_app_get_source_id_default (app) == NULL)
@@ -635,8 +633,6 @@ gs_plugin_packagekit_refine_name_to_id (GsPlugin *plugin,
const gchar *tmp;
if (gs_app_has_quirk (app, AS_APP_QUIRK_MATCH_ANY_PREFIX))
continue;
- if (gs_app_get_kind (app) == AS_APP_KIND_WEB_APP)
- continue;
tmp = gs_app_get_management_plugin (app);
if (tmp != NULL && g_strcmp0 (tmp, "packagekit") != 0)
continue;
--
2.24.1

File diff suppressed because it is too large Load Diff

View File

@ -8,26 +8,30 @@
%global gnome_desktop_version 3.18.0
%global fwupd_version 1.0.7
%global flatpak_version 0.9.4
%global libxmlb_version 0.1.7
%global fwupd_arches aarch64 ppc64le s390x x86_64
Name: gnome-software
Version: 3.30.6
Release: 3%{?dist}
Version: 3.36.1
Release: 4%{?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.30/%{name}-%{version}.tar.xz
# Lower appstream-glib version check as we have the required new API backported to
# libappstream-glib-0.7.14-3.fc29.
Patch0: 0001-Lower-as_utils_vercmp_full-version-check-for-Fedora.patch
Patch1: 0001-Lower-AsStore-new-API-version-checks-for-Fedora.patch
Source0: https://download.gnome.org/sources/gnome-software/3.36/%{name}-%{version}.tar.xz
# Backported from upstream
Patch2: 0001-details-page-Hide-addons-that-are-not-available-in-r.patch
Patch3: 0001-epiphany-Don-t-adopt-apps-that-have-package-name-set.patch
Patch4: 0002-packagekit-Don-t-skip-over-web-apps.patch
# Add support for basic auth and webflow auth in flatpak plugin
# https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/467
Patch0: 0001-Add-basic-auth-support-to-flatpak-plugin.patch
Patch1: 0002-Add-webflow-auth-support-to-flatpak-plugin.patch
# Add back shell extensions support as we don't have the extensions app in RHEL 8.3
# https://bugzilla.redhat.com/show_bug.cgi?id=1839774
Patch2: add-back-shell-extensions-support.patch
# Fix hardcoded desktop and appdata names to match what's in RHEL 8.3
Patch3: 0001-Fix-hardcoded-desktop-and-appdata-names-to-match-wha.patch
# Fix 'Show Details' to correctly work for rpm-installed firefox
Patch4: 0001-Improve-the-heuristic-for-detecting-old-style-AppStr.patch
BuildRequires: gcc
BuildRequires: gettext
@ -39,6 +43,7 @@ BuildRequires: fwupd-devel >= %{fwupd_version}
%endif
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: gnome-desktop3-devel
BuildRequires: gnome-online-accounts-devel
BuildRequires: gsettings-desktop-schemas-devel >= %{gsettings_desktop_schemas_version}
BuildRequires: gspell-devel
BuildRequires: gtk3-devel >= %{gtk3_version}
@ -46,26 +51,23 @@ BuildRequires: gtk-doc
BuildRequires: json-glib-devel >= %{json_glib_version}
BuildRequires: libappstream-glib-devel >= %{appstream_glib_version}
BuildRequires: libsoup-devel
BuildRequires: libxmlb-devel >= %{libxmlb_version}
BuildRequires: meson
BuildRequires: PackageKit-glib-devel >= %{packagekit_version}
BuildRequires: polkit-devel
BuildRequires: libsecret-devel
BuildRequires: flatpak-devel >= %{flatpak_version}
%if 0%{?fedora}
BuildRequires: libdnf-devel
BuildRequires: ostree-devel
BuildRequires: rpm-devel
BuildRequires: rpm-ostree-devel
%endif
BuildRequires: libgudev1-devel
%ifarch %{valgrind_arches}
BuildRequires: valgrind-devel
%endif
BuildRequires: liboauth-devel
%if 0%{?fedora}
BuildRequires: snapd-glib-devel >= 1.42
%endif
Requires: appstream-data
%if 0%{?fedora}
Requires: epiphany-runtime
%endif
Requires: flatpak%{?_isa} >= %{flatpak_version}
Requires: flatpak-libs%{?_isa} >= %{flatpak_version}
%ifarch %{fwupd_arches}
@ -84,9 +86,12 @@ Requires: libappstream-glib%{?_isa} >= %{appstream_glib_version}
Requires: librsvg2%{?_isa}
Requires: libsoup%{?_isa} >= %{libsoup_version}
Requires: PackageKit%{?_isa} >= %{packagekit_version}
Requires: libxmlb%{?_isa} >= %{libxmlb_version}
Obsoletes: gnome-software-editor < 3.35.1
# this is not a library version
%define gs_plugin_version 12
%define gs_plugin_version 13
%description
gnome-software is an application that makes it easy to add, remove
@ -100,34 +105,12 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
These development files are for building gnome-software plugins outside
the source tree. Most users do not need this subpackage installed.
%package editor
Summary: Banner designer for GNOME Software
Requires: %{name}%{?_isa} = %{version}-%{release}
%description editor
Editor for designing banners for GNOME Software.
%if 0%{?fedora}
%package snap
Summary: Support for Ubuntu Snap packages
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: snapd-login-service
Supplements: (gnome-software%{?_isa} and snapd%{?_isa})
%description snap
Adds support for Snap packages from the Snap store.
%endif
%prep
%autosetup -p1
%build
%meson \
%if 0%{?fedora}
-Dsnap=true \
%else
-Dsnap=false \
%endif
%ifnarch %{valgrind_arches}
-Dvalgrind=false \
%endif
@ -137,15 +120,17 @@ Adds support for Snap packages from the Snap store.
-Dgudev=true \
-Dpackagekit=true \
-Dexternal_appstream=false \
-Drpm_ostree=true \
-Dtests=false \
-Dubuntuone=false \
-Dubuntu_reviews=false
-Dmalcontent=false \
-Drpm_ostree=false \
-Dtests=false
%meson_build
%install
%meson_install
# remove unneeded dpkg plugin
rm %{buildroot}%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_dpkg.so
# make the software center load faster
desktop-file-edit %{buildroot}%{_datadir}/applications/org.gnome.Software.desktop \
--set-key=X-AppInstall-Package --set-value=%{name}
@ -170,24 +155,23 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%dir %{_datadir}/gnome-software
%{_datadir}/gnome-software/*.png
%{_mandir}/man1/gnome-software.1.gz
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/icons/hicolor/*/apps/org.gnome.Software.svg
%{_datadir}/icons/hicolor/symbolic/apps/org.gnome.Software-symbolic.svg
%{_datadir}/icons/hicolor/scalable/status/software-installed-symbolic.svg
%{_datadir}/gnome-software/featured-*.svg
%{_datadir}/gnome-software/featured-*.jpg
%{_datadir}/metainfo/org.gnome.Software.appdata.xml
%{_datadir}/metainfo/org.gnome.Software.Plugin.Epiphany.metainfo.xml
%{_datadir}/metainfo/org.gnome.Software.Plugin.Flatpak.metainfo.xml
%ifarch %{fwupd_arches}
%{_datadir}/metainfo/org.gnome.Software.Plugin.Fwupd.metainfo.xml
%endif
%{_datadir}/metainfo/org.gnome.Software.Plugin.Odrs.metainfo.xml
%{_datadir}/metainfo/org.gnome.Software.Plugin.Steam.metainfo.xml
%dir %{_libdir}/gs-plugins-%{gs_plugin_version}
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_appstream.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_desktop-categories.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_desktop-menu-path.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_dpkg.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_dummy.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_epiphany.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_fedora-langpacks.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_fedora-pkgdb-collections.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_flatpak.so
%ifarch %{fwupd_arches}
@ -195,7 +179,6 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%endif
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_generic-updates.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_hardcoded-blacklist.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_hardcoded-featured.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_hardcoded-popular.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_icons.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_key-colors-metadata.so
@ -217,9 +200,7 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_provenance.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_repos.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_rewrite-resource.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_rpm-ostree.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_shell-extensions.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_steam.so
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_systemd-updates.so
%{_sysconfdir}/xdg/autostart/gnome-software-service.desktop
%{_datadir}/app-info/xmls/org.gnome.Software.Featured.xml
@ -231,24 +212,31 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_libexecdir}/gnome-software-cmd
%{_libexecdir}/gnome-software-restarter
%if 0%{?fedora}
%files snap
%{_libdir}/gs-plugins-%{gs_plugin_version}/libgs_plugin_snap.so
%{_datadir}/metainfo/org.gnome.Software.Plugin.Snap.metainfo.xml
%endif
%files devel
%{_libdir}/pkgconfig/gnome-software.pc
%dir %{_includedir}/gnome-software
%{_includedir}/gnome-software/*.h
%{_datadir}/gtk-doc/html/gnome-software
%files editor
%{_bindir}/gnome-software-editor
%{_datadir}/applications/org.gnome.Software.Editor.desktop
%{_mandir}/man1/gnome-software-editor.1*
%changelog
* Thu Jun 11 2020 Kalev Lember <klember@redhat.com> - 3.36.1-4
- Fix 'Show Details' to correctly work for rpm-installed firefox
- Resolves: #1845714
* Wed Jun 03 2020 Kalev Lember <klember@redhat.com> - 3.36.1-3
- Upload correct 3.36.1 tarball
- Fix hardcoded desktop and appdata names to match what's in RHEL 8.3
- Add back shell extensions support
- Resolves: #1839774
* Tue Jun 02 2020 Kalev Lember <klember@redhat.com> - 3.36.1-2
- Add support for basic auth and webflow auth in flatpak plugin
- Resolves: #1815502
* Fri May 22 2020 Richard Hughes <rhughes@redhat.com> - 3.36.1-1
- Update to 3.36.1
- Resolves: #1797932
* Wed Jan 29 2020 Kalev Lember <klember@redhat.com> - 3.30.6-3
- Fix issues with installing Cockpit
- Resolves: #1759913