Skip to content

Commit

Permalink
flaptak-builder: Fix rename with empty id
Browse files Browse the repository at this point in the history
Signed-off-by: Hubert Figuière <[email protected]>
  • Loading branch information
hfiguiere committed Feb 15, 2024
1 parent 91c576e commit 464e738
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
3 changes: 2 additions & 1 deletion org.flatpak.Builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,8 @@
"type": "patch",
"paths": [
"patches/flatpak-builder-lfs.patch",
"patches/flatpak-builder-appstream-cli-urls.patch"
"patches/flatpak-builder-appstream-cli-urls.patch",
"patches/flatpak-builder-empty-id.patch"
]
}
]
Expand Down
46 changes: 46 additions & 0 deletions patches/flatpak-builder-empty-id.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff --git a/src/builder-manifest.c b/src/builder-manifest.c
index 27312714..61d22f14 100644
--- a/src/builder-manifest.c
+++ b/src/builder-manifest.c
@@ -2806,9 +2806,6 @@ builder_manifest_cleanup (BuilderManifest *self,
FlatpakXml *n_id;
FlatpakXml *n_root;
FlatpakXml *n_text;
- FlatpakXml *n_provides = NULL;
- FlatpakXml *n_provides_id = NULL;
- FlatpakXml *id_text = NULL;
g_autofree char *old_id = NULL;
g_autoptr(FlatpakXml) xml_root = NULL;
g_autoptr(GInputStream) in = NULL;
@@ -2841,16 +2838,23 @@ builder_manifest_cleanup (BuilderManifest *self,
}
}

- n_provides = flatpak_xml_find (n_root, "provides", NULL);
- if (!n_provides)
+ if (old_id)
{
- n_provides = flatpak_xml_new ("provides");
- flatpak_xml_add (n_root, n_provides);
+ FlatpakXml *n_provides = NULL;
+ FlatpakXml *n_provides_id = NULL;
+ FlatpakXml *id_text = NULL;
+
+ n_provides = flatpak_xml_find (n_root, "provides", NULL);
+ if (!n_provides)
+ {
+ n_provides = flatpak_xml_new ("provides");
+ flatpak_xml_add (n_root, n_provides);
+ }
+ n_provides_id = flatpak_xml_new ("id");
+ id_text = flatpak_xml_new_text (g_steal_pointer (&old_id));
+ flatpak_xml_add (n_provides_id, id_text);
+ flatpak_xml_add (n_provides, n_provides_id);
}
- n_provides_id = flatpak_xml_new ("id");
- id_text = flatpak_xml_new_text (g_steal_pointer (&old_id));
- flatpak_xml_add (n_provides_id, id_text);
- flatpak_xml_add (n_provides, n_provides_id);

/* replace any optional launchable */
n_id = flatpak_xml_find (n_root, "launchable", NULL);

0 comments on commit 464e738

Please sign in to comment.