mirror of
https://git.proxmox.com/git/fwupd
synced 2025-07-27 09:46:25 +00:00
fu-engine/fu-config: Reload metadata store when configuration changes
Emit a signal from FuConfig object that is caught by FuEngine to reload the store. This should fix problems with Fedora CI failing.
This commit is contained in:
parent
d2afb59b42
commit
263cab99e9
@ -20,6 +20,14 @@
|
|||||||
#include "fwupd-error.h"
|
#include "fwupd-error.h"
|
||||||
#include "fwupd-remote-private.h"
|
#include "fwupd-remote-private.h"
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
SIGNAL_CHANGED,
|
||||||
|
SIGNAL_LAST
|
||||||
|
};
|
||||||
|
|
||||||
|
static guint signals[SIGNAL_LAST] = { 0 };
|
||||||
|
|
||||||
static void fu_config_finalize (GObject *obj);
|
static void fu_config_finalize (GObject *obj);
|
||||||
|
|
||||||
struct _FuConfig
|
struct _FuConfig
|
||||||
@ -40,6 +48,13 @@ struct _FuConfig
|
|||||||
|
|
||||||
G_DEFINE_TYPE (FuConfig, fu_config, G_TYPE_OBJECT)
|
G_DEFINE_TYPE (FuConfig, fu_config, G_TYPE_OBJECT)
|
||||||
|
|
||||||
|
static void
|
||||||
|
fu_config_emit_changed (FuConfig *self)
|
||||||
|
{
|
||||||
|
g_debug ("::configuration changed");
|
||||||
|
g_signal_emit (self, signals[SIGNAL_CHANGED], 0);
|
||||||
|
}
|
||||||
|
|
||||||
static GPtrArray *
|
static GPtrArray *
|
||||||
fu_config_get_config_paths (void)
|
fu_config_get_config_paths (void)
|
||||||
{
|
{
|
||||||
@ -80,6 +95,7 @@ fu_config_monitor_changed_cb (GFileMonitor *monitor,
|
|||||||
g_debug ("%s changed, reloading all configs", filename);
|
g_debug ("%s changed, reloading all configs", filename);
|
||||||
if (!fu_config_load (self, FU_CONFIG_LOAD_FLAG_NONE, &error))
|
if (!fu_config_load (self, FU_CONFIG_LOAD_FLAG_NONE, &error))
|
||||||
g_warning ("failed to rescan config: %s", error->message);
|
g_warning ("failed to rescan config: %s", error->message);
|
||||||
|
fu_config_emit_changed (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint64
|
static guint64
|
||||||
@ -603,6 +619,12 @@ fu_config_class_init (FuConfigClass *klass)
|
|||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
object_class->finalize = fu_config_finalize;
|
object_class->finalize = fu_config_finalize;
|
||||||
|
|
||||||
|
signals[SIGNAL_CHANGED] =
|
||||||
|
g_signal_new ("changed",
|
||||||
|
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
|
||||||
|
0, NULL, NULL, g_cclosure_marshal_VOID__VOID,
|
||||||
|
G_TYPE_NONE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2362,6 +2362,16 @@ fu_engine_load_metadata_store (FuEngine *self, FuEngineLoadFlags flags, GError *
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fu_engine_config_changed_cb (FuConfig *config, FuEngine *self)
|
||||||
|
{
|
||||||
|
g_autoptr(GError) error_local = NULL;
|
||||||
|
if (!fu_engine_load_metadata_store (self, FU_ENGINE_LOAD_FLAG_NONE,
|
||||||
|
&error_local))
|
||||||
|
g_warning ("Failed to reload metadata store: %s",
|
||||||
|
error_local->message);
|
||||||
|
}
|
||||||
|
|
||||||
static FuKeyringResult *
|
static FuKeyringResult *
|
||||||
fu_engine_get_existing_keyring_result (FuEngine *self,
|
fu_engine_get_existing_keyring_result (FuEngine *self,
|
||||||
FuKeyring *kr,
|
FuKeyring *kr,
|
||||||
@ -4670,6 +4680,10 @@ fu_engine_init (FuEngine *self)
|
|||||||
self->compile_versions = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
self->compile_versions = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||||
self->approved_firmware = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
self->approved_firmware = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||||
|
|
||||||
|
g_signal_connect (self->config, "changed",
|
||||||
|
G_CALLBACK (fu_engine_config_changed_cb),
|
||||||
|
self);
|
||||||
|
|
||||||
g_signal_connect (self->idle, "notify::status",
|
g_signal_connect (self->idle, "notify::status",
|
||||||
G_CALLBACK (fu_engine_idle_status_notify_cb), self);
|
G_CALLBACK (fu_engine_idle_status_notify_cb), self);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user