[gnome-software/uajain/fixup-metdata-tag: 2/2] flatpak: Fixup <metadata> tag to <custom>
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/uajain/fixup-metdata-tag: 2/2] flatpak: Fixup <metadata> tag to <custom>
- Date: Thu, 17 Oct 2019 10:38:05 +0000 (UTC)
commit 22dd273fab2145dd4564e8c97cc336bc1dcbc93b
Author: Umang Jain <umang endlessm com>
Date: Thu Oct 17 12:57:30 2019 +0530
flatpak: Fixup <metadata> tag to <custom>
Fixup <metadata> tag to <custom> for appstream versions >= 0.9.
Appstream plugin already does this for it's appstreams' xmlb
silos via gs_plugin_appstream_upgrade_cb hence, flatpak
should also follow it.
plugins/flatpak/gs-flatpak.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index f9993cc1..7842ca73 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -339,6 +339,20 @@ gs_flatpak_fix_id_desktop_suffix_cb (XbBuilderFixup *self,
return TRUE;
}
+static gboolean
+gs_flatpak_fix_metadata_tag_cb (XbBuilderFixup *self,
+ XbBuilderNode *bn,
+ gpointer user_data,
+ GError **error)
+{
+ if (g_strcmp0 (xb_builder_node_get_element (bn), "component") == 0) {
+ g_autoptr(XbBuilderNode) metadata = xb_builder_node_get_child (bn, "metadata", NULL);
+ if (metadata != NULL)
+ xb_builder_node_set_element (metadata, "custom");
+ }
+ return TRUE;
+}
+
static gboolean
gs_flatpak_set_origin_cb (XbBuilderFixup *self,
XbBuilderNode *bn,
@@ -449,6 +463,7 @@ gs_flatpak_add_apps_from_xremote (GsFlatpak *self,
g_autoptr(XbBuilderFixup) fixup1 = NULL;
g_autoptr(XbBuilderFixup) fixup2 = NULL;
g_autoptr(XbBuilderFixup) fixup3 = NULL;
+ g_autoptr(XbBuilderFixup) fixup4 = NULL;
g_autoptr(XbBuilderNode) info = NULL;
g_autoptr(XbBuilderSource) source = xb_builder_source_new ();
@@ -500,6 +515,13 @@ gs_flatpak_add_apps_from_xremote (GsFlatpak *self,
xb_builder_fixup_set_max_depth (fixup3, 1);
xb_builder_source_add_fixup (source, fixup3);
+ /* Fixup <metadata> to <custom> for appstream versions >= 0.9 */
+ fixup4 = xb_builder_fixup_new ("FixMetadataTag",
+ gs_flatpak_fix_metadata_tag_cb,
+ xremote, NULL);
+ xb_builder_fixup_set_max_depth (fixup4, 2);
+ xb_builder_source_add_fixup (source, fixup4);
+
/* add metadata */
icon_prefix = g_build_filename (appstream_dir_fn, "icons", NULL);
info = xb_builder_node_insert (NULL, "info", NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]