Skip to content

Commit

Permalink
manifest: Don't emit empty id in provides when renaming
Browse files Browse the repository at this point in the history
Followup from #579

Signed-off-by: Hubert Figuière <[email protected]>
  • Loading branch information
hfiguiere authored and TingPing committed Feb 16, 2024
1 parent 57f9ae9 commit d9f5a5e
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/builder-manifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d9f5a5e

Please sign in to comment.