import gnome-settings-daemon-3.32.0-11.el8

This commit is contained in:
CentOS Sources 2020-11-03 06:44:45 -05:00 committed by Andrew Lukoshko
parent 76ab47fb46
commit 3f821160de
4 changed files with 20 additions and 2280 deletions

View File

@ -1,249 +0,0 @@
From ca35861a54b9f9413e4db8486a2786ba771a0271 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Thu, 27 Jun 2019 16:12:00 +0200
Subject: [PATCH] subman: Add InstalledProducts dbus property for g-c-c
---
plugins/subman/gsd-subscription-manager.c | 135 ++++++++++++++++++++++
1 file changed, 135 insertions(+)
diff --git a/plugins/subman/gsd-subscription-manager.c b/plugins/subman/gsd-subscription-manager.c
index 08b13fa6..a8c18a26 100644
--- a/plugins/subman/gsd-subscription-manager.c
+++ b/plugins/subman/gsd-subscription-manager.c
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2019 Richard Hughes <richard@hughsie.com>
+ * Copyright (C) 2019 Kalev Lember <klember@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -44,6 +45,7 @@ static const gchar introspection_xml[] =
" <arg type='a{sv}' name='options' direction='in'/>"
" </method>"
" <method name='Unregister'/>"
+" <property name='InstalledProducts' type='aa{sv}' access='read'/>"
" <property name='SubscriptionStatus' type='u' access='read'/>"
" </interface>"
"</node>";
@@ -72,6 +74,7 @@ struct GsdSubscriptionManagerPrivate
GDBusProxy *proxies[_RHSM_INTERFACE_LAST];
const gchar *userlang; /* owned by GLib internally */
GHashTable *config; /* str:str */
+ GPtrArray *installed_products;
gchar *address;
GTimer *timer_last_notified;
@@ -92,6 +95,32 @@ static void gsd_subscription_manager_finalize (GObject *objec
G_DEFINE_TYPE (GsdSubscriptionManager, gsd_subscription_manager, G_TYPE_OBJECT)
+typedef struct
+{
+ gchar *product_name;
+ gchar *product_id;
+ gchar *version;
+ gchar *arch;
+ gchar *status;
+ gchar *starts;
+ gchar *ends;
+} ProductData;
+
+static void
+product_data_free (ProductData *product)
+{
+ g_free (product->product_name);
+ g_free (product->product_id);
+ g_free (product->version);
+ g_free (product->arch);
+ g_free (product->status);
+ g_free (product->starts);
+ g_free (product->ends);
+ g_free (product);
+}
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (ProductData, product_data_free);
+
static gpointer manager_object = NULL;
GQuark
@@ -120,6 +149,32 @@ _client_subscription_status_from_text (const gchar *status_txt)
return GSD_SUBMAN_SUBSCRIPTION_STATUS_UNKNOWN;
}
+static GVariant *
+_make_installed_products_variant (GPtrArray *installed_products)
+{
+ GVariantBuilder builder;
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("aa{sv}"));
+
+ for (guint i = 0; i < installed_products->len; i++) {
+ ProductData *product = g_ptr_array_index (installed_products, i);
+ g_auto(GVariantDict) dict;
+
+ g_variant_dict_init (&dict, NULL);
+
+ g_variant_dict_insert (&dict, "product-name", "s", product->product_name);
+ g_variant_dict_insert (&dict, "product-id", "s", product->product_id);
+ g_variant_dict_insert (&dict, "version", "s", product->version);
+ g_variant_dict_insert (&dict, "arch", "s", product->arch);
+ g_variant_dict_insert (&dict, "status", "s", product->status);
+ g_variant_dict_insert (&dict, "starts", "s", product->starts);
+ g_variant_dict_insert (&dict, "ends", "s", product->ends);
+
+ g_variant_builder_add_value (&builder, g_variant_dict_end (&dict));
+ }
+
+ return g_variant_builder_end (&builder);
+}
+
static void
_emit_property_changed (GsdSubscriptionManager *manager,
const gchar *property_name,
@@ -154,6 +209,69 @@ _emit_property_changed (GsdSubscriptionManager *manager,
g_variant_builder_clear (&invalidated_builder);
}
+static gboolean
+_client_installed_products_update (GsdSubscriptionManager *manager, GError **error)
+{
+ GsdSubscriptionManagerPrivate *priv = manager->priv;
+ JsonNode *json_root;
+ JsonArray *json_products_array;
+ const gchar *json_txt = NULL;
+ g_autoptr(GVariant) val = NULL;
+ g_autoptr(JsonParser) json_parser = json_parser_new ();
+
+ val = g_dbus_proxy_call_sync (priv->proxies[_RHSM_INTERFACE_PRODUCTS],
+ "ListInstalledProducts",
+ g_variant_new ("(sa{sv}s)",
+ "" /* filter_string */,
+ NULL /* proxy_options */,
+ priv->userlang),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, NULL, error);
+ if (val == NULL)
+ return FALSE;
+ g_variant_get (val, "(&s)", &json_txt);
+ g_debug ("Products.ListInstalledProducts JSON: %s", json_txt);
+ if (!json_parser_load_from_data (json_parser, json_txt, -1, error))
+ return FALSE;
+ json_root = json_parser_get_root (json_parser);
+ json_products_array = json_node_get_array (json_root);
+ if (json_products_array == NULL) {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA,
+ "no InstalledProducts array in %s", json_txt);
+ return FALSE;
+ }
+
+ g_ptr_array_set_size (priv->installed_products, 0);
+
+ for (guint i = 0; i < json_array_get_length (json_products_array); i++) {
+ JsonArray *json_product = json_array_get_array_element (json_products_array, i);
+ g_autoptr(ProductData) product = g_new0 (ProductData, 1);
+
+ if (json_product == NULL)
+ continue;
+ if (json_array_get_length (json_product) < 8) {
+ g_debug ("Unexpected number of array elements in InstalledProducts JSON");
+ continue;
+ }
+
+ product->product_name = g_strdup (json_array_get_string_element (json_product, 0));
+ product->product_id = g_strdup (json_array_get_string_element (json_product, 1));
+ product->version = g_strdup (json_array_get_string_element (json_product, 2));
+ product->arch = g_strdup (json_array_get_string_element (json_product, 3));
+ product->status = g_strdup (json_array_get_string_element (json_product, 4));
+ product->starts = g_strdup (json_array_get_string_element (json_product, 6));
+ product->ends = g_strdup (json_array_get_string_element (json_product, 7));
+
+ g_ptr_array_add (priv->installed_products, g_steal_pointer (&product));
+ }
+
+ /* emit notification for g-c-c */
+ _emit_property_changed (manager, "InstalledProducts",
+ _make_installed_products_variant (priv->installed_products));
+
+ return TRUE;
+}
+
static gboolean
_client_subscription_status_update (GsdSubscriptionManager *manager, GError **error)
{
@@ -450,6 +568,8 @@ _client_register_with_keys (GsdSubscriptionManager *manager,
return FALSE;
if (!_client_subscription_status_update (manager, error))
return FALSE;
+ if (!_client_installed_products_update (manager, error))
+ return FALSE;
_client_maybe__show_notification (manager);
/* success */
@@ -497,6 +617,8 @@ _client_register (GsdSubscriptionManager *manager,
return FALSE;
if (!_client_subscription_status_update (manager, error))
return FALSE;
+ if (!_client_installed_products_update (manager, error))
+ return FALSE;
_client_maybe__show_notification (manager);
return TRUE;
}
@@ -523,6 +645,8 @@ _client_unregister (GsdSubscriptionManager *manager, GError **error)
return FALSE;
if (!_client_subscription_status_update (manager, error))
return FALSE;
+ if (!_client_installed_products_update (manager, error))
+ return FALSE;
_client_maybe__show_notification (manager);
return TRUE;
}
@@ -575,6 +699,10 @@ _subman_proxy_signal_cb (GDBusProxy *proxy,
g_warning ("failed to update subscription status: %s", error->message);
g_clear_error (&error);
}
+ if (!_client_installed_products_update (manager, &error)) {
+ g_warning ("failed to update installed products: %s", error->message);
+ g_clear_error (&error);
+ }
_client_maybe__show_notification (manager);
}
@@ -640,6 +768,8 @@ _client_load (GsdSubscriptionManager *manager, GError **error)
return FALSE;
if (!_client_subscription_status_update (manager, error))
return FALSE;
+ if (!_client_installed_products_update (manager, error))
+ return FALSE;
if (!_client_syspurpose_update (manager, error))
return FALSE;
@@ -703,6 +833,7 @@ gsd_subscription_manager_init (GsdSubscriptionManager *manager)
{
GsdSubscriptionManagerPrivate *priv = manager->priv = GSD_SUBSCRIPTION_MANAGER_GET_PRIVATE (manager);
+ priv->installed_products = g_ptr_array_new_with_free_func ((GDestroyNotify) product_data_free);
priv->timer_last_notified = g_timer_new ();
/* expired */
@@ -767,6 +898,7 @@ gsd_subscription_manager_finalize (GObject *object)
g_clear_object (&manager->priv->bus_cancellable);
}
+ g_clear_pointer (&manager->priv->installed_products, g_ptr_array_unref);
g_clear_pointer (&manager->priv->introspection_data, g_dbus_node_info_unref);
g_clear_object (&manager->priv->connection);
g_clear_object (&manager->priv->notification_expired);
@@ -884,6 +1016,9 @@ handle_get_property (GDBusConnection *connection,
if (g_strcmp0 (property_name, "SubscriptionStatus") == 0)
return g_variant_new_uint32 (priv->subscription_status);
+ if (g_strcmp0 (property_name, "InstalledProducts") == 0)
+ return _make_installed_products_variant (priv->installed_products);
+
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
"Failed to get property: %s", property_name);
return NULL;
--
2.21.0

View File

@ -1,77 +0,0 @@
From 298355d8b3d5a85b99e74a06e936a0113797bf2a Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Fri, 28 Jun 2019 18:10:36 +0200
Subject: [PATCH] subman: Increase RHSM dbus call timeouts
Increase the dbus timeouts to 5 minutes as the register/unregister calls
seem to routinely take more than a minute.
---
plugins/subman/gsd-subman-helper.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/plugins/subman/gsd-subman-helper.c b/plugins/subman/gsd-subman-helper.c
index 182f7190..af7a82e9 100644
--- a/plugins/subman/gsd-subman-helper.c
+++ b/plugins/subman/gsd-subman-helper.c
@@ -28,6 +28,8 @@
#include <gio/gio.h>
#include <json-glib/json-glib.h>
+#define DBUS_TIMEOUT 300000 /* 5 minutes */
+
static void
_helper_convert_error (const gchar *json_txt, GError **error)
{
@@ -94,7 +96,8 @@ _helper_unregister (GError **error)
proxy_options,
""), /* lang */
G_DBUS_CALL_FLAGS_NONE,
- -1, NULL, error);
+ DBUS_TIMEOUT,
+ NULL, error);
return res != NULL;
}
@@ -127,7 +130,8 @@ _helper_auto_attach (GError **error)
proxy_options,
""), /* lang */
G_DBUS_CALL_FLAGS_NONE,
- -1, NULL, error);
+ DBUS_TIMEOUT,
+ NULL, error);
if (res == NULL)
return FALSE;
g_variant_get (res, "(&s)", &str);
@@ -158,7 +162,8 @@ _helper_save_config (const gchar *key, const gchar *value, GError **error)
g_variant_new_string (value),
""), /* lang */
G_DBUS_CALL_FLAGS_NONE,
- -1, NULL, error);
+ DBUS_TIMEOUT,
+ NULL, error);
return res != NULL;
}
@@ -305,7 +310,8 @@ main (int argc, char *argv[])
subman_conopts,
userlang),
G_DBUS_CALL_FLAGS_NO_AUTO_START,
- -1, NULL, &error_local);
+ DBUS_TIMEOUT,
+ NULL, &error_local);
if (res == NULL) {
g_dbus_error_strip_remote_error (error_local);
_helper_convert_error (error_local->message, &error);
@@ -339,7 +345,8 @@ main (int argc, char *argv[])
subman_conopts,
userlang),
G_DBUS_CALL_FLAGS_NO_AUTO_START,
- -1, NULL, &error_local);
+ DBUS_TIMEOUT,
+ NULL, &error_local);
if (res == NULL) {
g_dbus_error_strip_remote_error (error_local);
_helper_convert_error (error_local->message, &error);
--
2.21.0

View File

@ -8,7 +8,7 @@
Name: gnome-settings-daemon
Version: 3.32.0
Release: 9%{?dist}
Release: 11%{?dist}
Summary: The daemon sharing settings from GNOME to GTK+/KDE applications
License: GPLv2+
@ -32,7 +32,6 @@ BuildRequires: pkgconfig(gsettings-desktop-schemas) >= %{gsettings_desktop_sche
BuildRequires: pkgconfig(gtk+-3.0) >= %{gtk3_version}
BuildRequires: pkgconfig(gudev-1.0)
BuildRequires: pkgconfig(gweather-3.0) >= %{libgweather_version}
BuildRequires: pkgconfig(json-glib-1.0)
BuildRequires: pkgconfig(lcms2) >= 2.2
BuildRequires: pkgconfig(libcanberra-gtk3)
BuildRequires: pkgconfig(libgeoclue-2.0)
@ -85,11 +84,6 @@ Patch00006: 0001-xsettings-Add-an-entry-for-the-overlay-scrolling-set.patch
Patch10001: 0001-housekeeping-Add-a-GPU-memory-usage-notification.patch
# Subscription manager integration
Patch10002: 0001-subman-Add-a-new-plugin-to-provide-system-subscripti.patch
Patch10003: 0001-subman-Add-InstalledProducts-dbus-property-for-g-c-c.patch
Patch10004: 0001-subman-Increase-RHSM-dbus-call-timeouts.patch
%description
A daemon to share settings from GNOME to other applications. It also
handles global keybindings, as well as a number of desktop-wide settings.
@ -103,7 +97,17 @@ The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%prep
%autosetup -p1
%setup -q
%patch00001 -p 1
%patch00002 -p 1
%patch00003 -p 1
%patch00004 -p 1
%patch00005 -p 1
%patch00006 -p 1
%patch10001 -p 1
%build
%meson
@ -200,12 +204,6 @@ mkdir $RPM_BUILD_ROOT%{_libdir}/gnome-settings-daemon-3.0/gtk-modules
%{_sysconfdir}/xdg/autostart/org.gnome.SettingsDaemon.Sharing.desktop
%{_datadir}/glib-2.0/schemas/org.gnome.settings-daemon.plugins.sharing.gschema.xml
%{_sysconfdir}/xdg/autostart/org.gnome.SettingsDaemon.Subscription.desktop
%{_libexecdir}/gsd-subman
%{_libexecdir}/gsd-subman-helper
%{_datadir}/polkit-1/actions/org.gnome.settings-daemon.plugins.subman.policy
%{_datadir}/polkit-1/rules.d/org.gnome.settings-daemon.plugins.subman.rules
%{_libdir}/gnome-settings-daemon-3.0/libgsd.so
/usr/lib/udev/rules.d/*.rules
@ -220,6 +218,14 @@ mkdir $RPM_BUILD_ROOT%{_libdir}/gnome-settings-daemon-3.0/gtk-modules
%{_libdir}/pkgconfig/gnome-settings-daemon.pc
%changelog
* Wed Sep 02 2020 Ray Strode <rstrode@redhat.com> - 3.32.0-11
- Remove subman plugin for now
Resolves: #1872457
* Thu Aug 13 2020 Carl George <carl@redhat.com> - 3.32.0-10
- Disable subman plugin on CentOS
Resolves: #1827030
* Fri Nov 22 2019 Benjamin Otte <otte@redhat.com> - 3.32.0-9
- Update gsettings-deskto-schemas dependency for new setting
Resolves: #1775683, #1723462