mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-14 02:40:34 +00:00
Correctly parse format the version numbers correctly using old metadata
The LVFS has always sent components with the old-style '<metadata>' section rather than the new-style '<custom>' section, and when using appstream-glib we just accepted either element name. Although the LVFS has just been fixed to use the new name, old metadata might be present on the system already. When all clients have downloaded new metadata we can revert this, perhaps in a couple of weeks time. Until then, the belt-and-braces approach is probably a good idea. Fixes https://github.com/hughsie/fwupd/issues/874
This commit is contained in:
parent
7cd6d363e1
commit
1af48b13bd
@ -1774,6 +1774,17 @@ fu_engine_is_device_supported (FuEngine *self, FuDevice *device)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_engine_appstream_upgrade_cb (XbBuilderFixup *self,
|
||||
XbBuilderNode *bn,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
if (g_strcmp0 (xb_builder_node_get_element (bn), "metadata") == 0)
|
||||
xb_builder_node_set_element (bn, "custom");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_engine_load_metadata_store (FuEngine *self, GError **error)
|
||||
{
|
||||
@ -1801,6 +1812,7 @@ fu_engine_load_metadata_store (FuEngine *self, GError **error)
|
||||
const gchar *path = NULL;
|
||||
g_autoptr(GError) error_local = NULL;
|
||||
g_autoptr(GFile) file = NULL;
|
||||
g_autoptr(XbBuilderFixup) fixup = NULL;
|
||||
g_autoptr(XbBuilderNode) custom = NULL;
|
||||
g_autoptr(XbBuilderSource) source = xb_builder_source_new ();
|
||||
|
||||
@ -1827,6 +1839,13 @@ fu_engine_load_metadata_store (FuEngine *self, GError **error)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* fix up any legacy installed files */
|
||||
fixup = xb_builder_fixup_new ("AppStreamUpgrade",
|
||||
fu_engine_appstream_upgrade_cb,
|
||||
self, NULL);
|
||||
xb_builder_fixup_set_max_depth (fixup, 3);
|
||||
xb_builder_source_add_fixup (source, fixup);
|
||||
|
||||
/* add metadata */
|
||||
custom = xb_builder_node_new ("custom");
|
||||
xb_builder_node_insert_text (custom,
|
||||
|
Loading…
Reference in New Issue
Block a user