[gnome-software/wip/hughsie/fwupd] fwupd: Use the runtime fwupd version for the user agent rather than the build version
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/hughsie/fwupd] fwupd: Use the runtime fwupd version for the user agent rather than the build version
- Date: Wed, 8 Jul 2020 18:06:20 +0000 (UTC)
commit 0835f9c203af63d0f5615fa34d6619c341b452e6
Author: Richard Hughes <richard hughsie com>
Date: Wed Jul 8 18:51:17 2020 +0100
fwupd: Use the runtime fwupd version for the user agent rather than the build version
This ensures everyone gets the right firmware if the vendor has set a hard requirement for deployment.
See https://github.com/fwupd/fwupd/pull/2256 for details.
plugins/fwupd/gs-plugin-fwupd.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/plugins/fwupd/gs-plugin-fwupd.c b/plugins/fwupd/gs-plugin-fwupd.c
index 95d875c0..7a2a06e5 100644
--- a/plugins/fwupd/gs-plugin-fwupd.c
+++ b/plugins/fwupd/gs-plugin-fwupd.c
@@ -93,20 +93,8 @@ void
gs_plugin_initialize (GsPlugin *plugin)
{
GsPluginData *priv = gs_plugin_alloc_data (plugin, sizeof(GsPluginData));
- g_autofree gchar *user_agent = NULL;
- g_autoptr(SoupSession) soup_session = NULL;
-
priv->client = fwupd_client_new ();
- /* use a custom user agent to provide the fwupd version */
- user_agent = fwupd_build_user_agent (PACKAGE_NAME, PACKAGE_VERSION);
- soup_session = soup_session_new_with_options (SOUP_SESSION_USER_AGENT, user_agent,
- SOUP_SESSION_TIMEOUT, 10,
- NULL);
- soup_session_remove_feature_by_type (soup_session,
- SOUP_TYPE_CONTENT_DECODER);
- gs_plugin_set_soup_session (plugin, soup_session);
-
/* set name of MetaInfo file */
gs_plugin_set_appstream_id (plugin, "org.gnome.Software.Plugin.Fwupd");
}
@@ -222,6 +210,7 @@ gboolean
gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
{
GsPluginData *priv = gs_plugin_get_data (plugin);
+ g_autoptr(SoupSession) soup_session = NULL;
#if FWUPD_CHECK_VERSION(1,4,5)
/* send our implemented feature set */
@@ -232,8 +221,23 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
g_prefix_error (error, "Failed to set front-end features: ");
return FALSE;
}
+
+ /* we know the runtime daemon version now */
+ fwupd_client_set_user_agent_for_package (priv->client, PACKAGE_NAME, PACKAGE_VERSION);
+ g_object_get (priv->client, "soup-session", &soup_session, NULL);
+#else
+ g_autofree gchar *user_agent = NULL;
+ /* use a custom user agent to provide the fwupd version */
+ user_agent = fwupd_build_user_agent (PACKAGE_NAME, PACKAGE_VERSION);
+ soup_session = soup_session_new_with_options (SOUP_SESSION_USER_AGENT, user_agent,
+ SOUP_SESSION_TIMEOUT, 10,
+ NULL);
+ soup_session_remove_feature_by_type (soup_session, SOUP_TYPE_CONTENT_DECODER);
#endif
+ /* use for gnome-software downloads */
+ gs_plugin_set_soup_session (plugin, soup_session);
+
/* add source */
priv->cached_origin = gs_app_new (gs_plugin_get_name (plugin));
gs_app_set_kind (priv->cached_origin, AS_APP_KIND_SOURCE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]