ximion / appstream

Tools and libraries to work with AppStream metadata
http://www.freedesktop.org/wiki/Distributions/AppStream/
GNU Lesser General Public License v2.1
210 stars 114 forks source link

news-to-metainfo with yaml doesn't support paragraphs with bullet points #373

Closed vchernin closed 2 years ago

vchernin commented 2 years ago

Following examples here, I'm trying to write yaml release notes that can be converted to appstream metainfo.

Ideally I'd like paragraphs with bullet points roughly like:

Added
    - Cool new feature x
    - Cool new feature y

Bug fixes
    - Fixed bug a
    - Fixed bug b

However yaml-to-news and news-to-yaml --format=yaml doesn't seem to be able to preserve paragraphs with bullet points.

Demo of bug: If you run metainfo-to-news --format=yaml on a metainfo file, then run news-to-metainfo --format=yaml on the same file the pargraph formatting is no longer preserved, the final metainfo release description is different from the original.

Working metainfo
From https://github.com/bottlesdevs/Bottles/blob/master/data/com.usebottles.bottles.appdata.xml.in ``` com.usebottles.bottles.desktop CC0-1.0 GPL-3.0-or-later Bottles Run Windows software Mirko Brombin

Run Windows software on Linux with Bottles!

Bottle software and enjoy at your leisure!

Our built-in dependency installation system grants automatic software compatibility access. Use the download manager to download the official components: the runner (Wine, Proton), DXVK, dependencies, etc.

Bottle versioning keeps your work safe now and lets you restore it later!

Features:

  • Create bottles using preconfigured environments or create your own
  • Run executables (.exe/.msi) in your bottles, directly from the context menu of your file-manager
  • Automated detection of applications installed in your bottles
  • Add environment variables quickly
  • Override DLLs directly from per-bottle preferences
  • On-the-fly runner change for any Bottle
  • Various gaming-performance optimizations (esync, fsync, DXVK, cache, shader compiler, offload … and much more.)
  • Automatic installation and management of Wine and Proton runners
  • Automatic bottle repair in case of breakage
  • Integrated dependency-installer based on a community-driven repository
  • Integrated Task manager for Wine processes
  • Access to ProtonDB and WineHQ for support
  • System for bringing your configuration to new versions of Bottles
  • Back up and import bottles
  • Import Wine prefixes from other managers
  • Bottles versioning (experimental)
  • ... and much more that you can find by installing Bottles!
application/x-ms-dos-executable application/x-msi application/x-ms-shortcut application/x-wine-extension-msp https://raw.githubusercontent.com/bottlesdevs/Bottles/master/data/appstream/screenshot.png https://raw.githubusercontent.com/bottlesdevs/Bottles/master/data/appstream/1.png https://raw.githubusercontent.com/bottlesdevs/Bottles/master/data/appstream/2.png https://raw.githubusercontent.com/bottlesdevs/Bottles/master/data/appstream/3.png https://raw.githubusercontent.com/bottlesdevs/Bottles/master/data/appstream/4.png https://raw.githubusercontent.com/bottlesdevs/Bottles/master/data/appstream/5.png https://raw.githubusercontent.com/bottlesdevs/Bottles/master/data/appstream/6.png https://raw.githubusercontent.com/bottlesdevs/Bottles/master/data/appstream/7.png com.usebottles.bottles https://usebottles.com https://github.com/bottlesdevs/Bottles/issues https://docs.usebottles.com https://usebottles.com/funding https://hosted.weblate.org/engage/bottles pointing keyboard touch 768

News

  • Bottles runtime updated to 0.2
  • Caffe is now the new default runner, falling back to Vaniglia if not available
  • New environment variables management, has also a nice new UI
  • The new Operation manager handle tasks queue to avoid conflicts
  • Improved xwayland support for runners when running in a wayland session
  • Improved compatibility for optimus laptops
  • Prevented value changes in preferences when scrolling on combo boxes
  • Now the Crash Report dialog disable the send button if the report is already sent multiple times
  • The new copy_file action can be used to copy any file during dependency installation
  • Now is possible to rename manually added programs
  • The uninstaller can now remove more than one program in one go (used by dependencies/installers)
  • Improved DLSS support, now is automatically configured
  • Extended the programs search to new directories

Bug fixes

  • Fixed onboard (first start-up) freeze on components download
  • Fixed random crashes caused by non-safe thread access
  • Fixed wayland support, was setting the wrong port for xwayland, the new method tests a bunch of ports to find the right one
  • Fixed vkd3d installation, was failing due to a regression in command handling
  • Fixed a crash during bottle creation caused by a non handled exception
  • Fixed random crash saving environment variables
  • Fixed a crash caused by the logger trying to split a None
  • Fixed silent EasyTerm crash when gamemode is enabled but it doesn't find the executable
  • Fixed wrong environment variables setting on non optimus laptops
  • Fixed a crash caused by a non handled exception of Patool library
  • Fixed Windows version change for winxp, was setting the wrong value for 64bit bottles
  • Fixed a bug during initial checks

Translations

  • Chinese (Traditional) translations thanks to @XiaoPanPanKevinPan
  • Italian translations thanks to @AlexzanDev, @phaerrax
  • Czech translations thanks to @SoongVilda
  • Russian translations thanks to @ZSHFan
  • Finnish translations thanks to Jiri Grönroos
  • French translations thanks to @GoudronViande24, @Bloombug, @julroy67
  • Korean translations thanks to @OctopusET, @qogusdn1017
  • Portuguese (Brazil) translations thanks to @redvulps, @davipatricio
  • Vietnamese translations thanks to AD, Giai Ngo
  • Portuguese translations thanks to @Bloombug
  • Polish translations thanks to Krzysztof Marcinek
  • Hindi translations thanks to @athenasaurav
  • Spanish translations thanks to Alberto Cañaveras
  • Indonesian translations thanks to neko
  • German translations thanks to @McLutzifer, @Translator5
  • Japanese translations thanks to @Hebi-no-Sekigae
```

Then run:

appstreamcli metainfo-to-news --format=yaml com.usebottles.bottles.appdata.xml.in yaml_release_notes

Now converted to yaml release notes
``` --- Version: 2021.12.28-treviso Date: 2021-12-27 Description: |- News * Bottles runtime updated to 0.2 * Caffe is now the new default runner, falling back to Vaniglia if not available * New environment variables management, has also a nice new UI * The new Operation manager handle tasks queue to avoid conflicts * Improved xwayland support for runners when running in a wayland session * Improved compatibility for optimus laptops * Prevented value changes in preferences when scrolling on combo boxes * Now the Crash Report dialog disable the send button if the report is already sent multiple times * The new copy_file action can be used to copy any file during dependency installation * Now is possible to rename manually added programs * The uninstaller can now remove more than one program in one go (used by dependencies/installers) * Improved DLSS support, now is automatically configured * Extended the programs search to new directories Bug fixes * Fixed onboard (first start-up) freeze on components download * Fixed random crashes caused by non-safe thread access * Fixed wayland support, was setting the wrong port for xwayland, the new method tests a bunch of ports to find the right one * Fixed vkd3d installation, was failing due to a regression in command handling * Fixed a crash during bottle creation caused by a non handled exception * Fixed random crash saving environment variables * Fixed a crash caused by the logger trying to split a None * Fixed silent EasyTerm crash when gamemode is enabled but it doesn't find the executable * Fixed wrong environment variables setting on non optimus laptops * Fixed a crash caused by a non handled exception of Patool library * Fixed Windows version change for winxp, was setting the wrong value for 64bit bottles * Fixed a bug during initial checks Translations * Chinese (Traditional) translations thanks to @XiaoPanPanKevinPan * Italian translations thanks to @AlexzanDev, @phaerrax * Czech translations thanks to @SoongVilda * Russian translations thanks to @ZSHFan * Finnish translations thanks to Jiri Grönroos * French translations thanks to @GoudronViande24, @Bloombug, @julroy67 * Korean translations thanks to @OctopusET, @qogusdn1017 * Portuguese (Brazil) translations thanks to @redvulps, @davipatricio * Vietnamese translations thanks to AD, Giai Ngo * Portuguese translations thanks to @Bloombug * Polish translations thanks to Krzysztof Marcinek * Hindi translations thanks to @athenasaurav * Spanish translations thanks to Alberto Cañaveras * Indonesian translations thanks to neko * German translations thanks to @McLutzifer, @Translator5 * Japanese translations thanks to @Hebi-no-Sekigae ```

Then run:

appstreamcli news-to-metainfo --format=yaml yaml_release_notes new-incorrect-metainfo

Now converted back to metainfo
``` com.usebottles.bottles.desktop Bottles Run Windows software CC0-1.0 GPL-3.0-or-later Mirko Brombin

Run Windows software on Linux with Bottles!

Bottle software and enjoy at your leisure!

Our built-in dependency installation system grants automatic software compatibility access. Use the download manager to download the official components: the runner (Wine, Proton), DXVK, dependencies, etc.

Bottle versioning keeps your work safe now and lets you restore it later!

Features:

  • Create bottles using preconfigured environments or create your own
  • Run executables (.exe/.msi) in your bottles, directly from the context menu of your file-manager
  • Automated detection of applications installed in your bottles
  • Add environment variables quickly
  • Override DLLs directly from per-bottle preferences
  • On-the-fly runner change for any Bottle
  • Various gaming-performance optimizations (esync, fsync, DXVK, cache, shader compiler, offload … and much more.)
  • Automatic installation and management of Wine and Proton runners
  • Automatic bottle repair in case of breakage
  • Integrated dependency-installer based on a community-driven repository
  • Integrated Task manager for Wine processes
  • Access to ProtonDB and WineHQ for support
  • System for bringing your configuration to new versions of Bottles
  • Back up and import bottles
  • Import Wine prefixes from other managers
  • Bottles versioning (experimental)
  • ... and much more that you can find by installing Bottles!
768 pointing keyboard touch https://usebottles.com https://github.com/bottlesdevs/Bottles/issues https://docs.usebottles.com https://usebottles.com/funding https://hosted.weblate.org/engage/bottles application/x-ms-dos-executable application/x-msi application/x-ms-shortcut application/x-wine-extension-msp com.usebottles.bottles https://raw.githubusercontent.com/bottlesdevs/Bottles/master/data/appstream/screenshot.png https://raw.githubusercontent.com/bottlesdevs/Bottles/master/data/appstream/1.png https://raw.githubusercontent.com/bottlesdevs/Bottles/master/data/appstream/2.png https://raw.githubusercontent.com/bottlesdevs/Bottles/master/data/appstream/3.png https://raw.githubusercontent.com/bottlesdevs/Bottles/master/data/appstream/4.png https://raw.githubusercontent.com/bottlesdevs/Bottles/master/data/appstream/5.png https://raw.githubusercontent.com/bottlesdevs/Bottles/master/data/appstream/6.png https://raw.githubusercontent.com/bottlesdevs/Bottles/master/data/appstream/7.png

News * Bottles runtime updated to 0.2 * Caffe is now the new default runner, falling back to Vaniglia if not available * New environment variables management, has also a nice new UI * The new Operation manager handle tasks queue to avoid conflicts * Improved xwayland support for runners when running in a wayland session * Improved compatibility for optimus laptops * Prevented value changes in preferences when scrolling on combo boxes * Now the Crash Report dialog disable the send button if the report is already sent multiple times * The new copy_file action can be used to copy any file during dependency installation * Now is possible to rename manually added programs * The uninstaller can now remove more than one program in one go (used by dependencies/installers) * Improved DLSS support, now is automatically configured * Extended the programs search to new directories

Bug fixes * Fixed onboard (first start-up) freeze on components download * Fixed random crashes caused by non-safe thread access * Fixed wayland support, was setting the wrong port for xwayland, the new method tests a bunch of ports to find the right one * Fixed vkd3d installation, was failing due to a regression in command handling * Fixed a crash during bottle creation caused by a non handled exception * Fixed random crash saving environment variables * Fixed a crash caused by the logger trying to split a None * Fixed silent EasyTerm crash when gamemode is enabled but it doesn't find the executable * Fixed wrong environment variables setting on non optimus laptops * Fixed a crash caused by a non handled exception of Patool library * Fixed Windows version change for winxp, was setting the wrong value for 64bit bottles * Fixed a bug during initial checks

Translations * Chinese (Traditional) translations thanks to @XiaoPanPanKevinPan * Italian translations thanks to @AlexzanDev, @phaerrax * Czech translations thanks to @SoongVilda * Russian translations thanks to @ZSHFan * Finnish translations thanks to Jiri Grönroos * French translations thanks to @GoudronViande24, @Bloombug, @julroy67 * Korean translations thanks to @OctopusET, @qogusdn1017 * Portuguese (Brazil) translations thanks to @redvulps, @davipatricio * Vietnamese translations thanks to AD, Giai Ngo * Portuguese translations thanks to @Bloombug * Polish translations thanks to Krzysztof Marcinek * Hindi translations thanks to @athenasaurav * Spanish translations thanks to Alberto Cañaveras * Indonesian translations thanks to neko * German translations thanks to @McLutzifer, @Translator5 * Japanese translations thanks to @Hebi-no-Sekigae

```

Notice how different the <releases> section is.

The issue isn't necessarily about that one can't convert metainfo perfectly back and forth. Rather, that there doesn't seem to be a way to define paragraphs with bullet points in the yaml release notes format. yaml-to-news --format=yaml not preserving the paragraphs is (presumbably) a reflection of that.

From what I can tell in the blog post's example, a news file instead of yaml should not experience this bug.

Note technically apptreamcli validate complains about the example metainfo (along with all the others I tried), but the warnings don't seem relevant.

ximion commented 2 years ago

This is a fairly rudimentary change, please check if it works for you! :-)