flatpak: preserve xml declaration in installed metainfo

The flathub appdata validation requires an <?xml?> line.

If we want one of those, we need to pass the `xml_declaration=True`
kwarg to `ElementTree.write()`.

To make sure we catch issues like this for ourselves, validate the
in-tree metainfo before patching it, and validate the installed copy
after patching.
This commit is contained in:
Allison Karlitskaya 2022-11-09 10:59:35 +01:00
parent 58b95f1a8c
commit b91a8d843e
2 changed files with 3 additions and 2 deletions

View File

@ -11,12 +11,13 @@ install-for-flatpak: \
install-dist_scalableiconDATA \
install-dist_symboliciconDATA \
$(NULL)
appstream-util validate --nonet src/client/org.cockpit_project.CockpitClient.metainfo.xml
if test -s "${DOWNSTREAM_RELEASES_XML}"; then \
$(top_srcdir)/tools/patch-metainfo \
'$(DESTDIR)$(datadir)/metainfo/org.cockpit_project.CockpitClient.metainfo.xml' \
"${DOWNSTREAM_RELEASES_XML}"; \
fi
appstream-util validate --nonet src/client/org.cockpit_project.CockpitClient.metainfo.xml
appstream-util validate --nonet $(DESTDIR)$(datadir)/metainfo/org.cockpit_project.CockpitClient.metainfo.xml
mkdir -p $(DESTDIR)/$(bindir)
ln -sfTv $(cockpitclientdir)/cockpit-client $(DESTDIR)/$(bindir)/cockpit-client
cp -rT dist/static $(pkgdatadir)/static

View File

@ -32,4 +32,4 @@ if stub_release is not None:
metainfo_releases.extend(releases_releases)
metainfo.write(args.metainfo)
metainfo.write(args.metainfo, encoding='utf-8', xml_declaration=True)