Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please document news-to-appdata script #437

Open
fedelibre opened this issue Mar 15, 2022 · 8 comments
Open

Please document news-to-appdata script #437

fedelibre opened this issue Mar 15, 2022 · 8 comments

Comments

@fedelibre
Copy link

I'm trying to use the appstream-util news-to-appdata script present in the 21.08 Freedesktop SDK flatpak package, but I can't find any information about the syntax to be used. I'm using it within an application flatpak manifest, because upstream devs could not add the script in their build system.

[📦 org.freedesktop.Platform ~]$ appstream-util --version
Version:	0.7.18

I tried this (taken from appstreamcli) but it didn't work:

appstream-util news-to-appdata NEWS ${FLATPAK_DEST}/id.appdata.xml ${FLATPAK_DEST}/id.appdata.xml

Here's the short error message:

Not enough arguments, expected NEWS
@ximion
Copy link
Collaborator

ximion commented Mar 15, 2022

Hi! appstream-util does not do an equivalent thing to appstreamcli here. What you need to do is run appstream-util news-to-appdata ./NEWS (no other parameters) and then the tool will print release description markup (and just that) to stdout.

@fedelibre
Copy link
Author

Ok, I see.
Unfortunately it parses the NEWS file differently from appstreamcli, as it assumes that each item in a list is on a single line. In other words, every line within a section becomes a <li>element</li>.

I'm working on a too long and verbose NEWS file. It's time to simplify it.

@fedelibre
Copy link
Author

Can you help me with the sed script to copy the output of appstream-util in the right place of the appdata file? (i.e. before the last line </application> or after the previous line <content_rating)

I don't know how to use appstream-util stdout within the sed command. Here's what I tried:

appstream-util news-to-appdata NEWS | xargs sed -i '/^<content_rating/a STDOUT' /app/share/appdata/org.denemo.Denemo.appdata.xml

where STDOUT should be replaced by appstream-util stdout.

Or do you know better ways?

@ximion
Copy link
Collaborator

ximion commented Mar 19, 2022

before the last line </application>

If you have any <application> tag in your metainfo file, you should seriously think about upgrading that file to a newer version of the AppStream spec - that stuff has been deprecated for about 8 years now ;-)

Honest question: Is there a reason why you can't use appstreamcli, which makes you not require all sed magic?

@fedelibre
Copy link
Author

Honest question: Is there a reason why you can't use appstreamcli, which makes you not require all sed magic?

The only reason is that appstreamcli is not available in Freedesktop SDK 21.08, so I have to build appstream and all its dependencies within my application manifest. Probably I'd better fo this. And maybe ask Freedesktop to include appstreamcli.

@fedelibre
Copy link
Author

Wait, I've just realized there's a freedesktop appstream.cli extension!

@ximion
Copy link
Collaborator

ximion commented Mar 20, 2022

Jup, but including it in the SDK directly is also probably a good idea (but I'll leave that call to the Flatpak people, I don't have enough experience with building runtimes yet to say that this is a good idea for sure ^^)

@fedelibre
Copy link
Author

I suspect it is a good idea. How can I access appstreamcli otherwise? (when building a flatpak app)
I've just opened a new issue and we can follow-up the discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants