appstream-glib icon indicating copy to clipboard operation
appstream-glib copied to clipboard

Error reporting of 'appstream-util validate' is too vague.

Open van-de-bugger opened this issue 3 years ago • 4 comments

$ appstream-util --version
Version:	0.8.0

$ appstream-util validate ./io.sourceforge.kbd-tapper.metainfo.xml 
./io.sourceforge.kbd-tapper.metainfo.xml: FAILED:
• tag-invalid           : Expected children for tag
Validation of files failed

Ok, a tag in my metainfo file is invalid. But could appstream-validate give me a little hint which one? Either line number or at least invalid tag name would be appreciated.

The wrong metainfo file is attached. I have to replace .xml suffix with .txt in order to upload the file: github does not allow to upload xml files.

io.sourceforge.kbd-tapper.metainfo.txt

van-de-bugger avatar Oct 01 '22 23:10 van-de-bugger

Using appstream-glib for this is no longer ideal, because it does not validate a lot of new concepts used in AppStream today. Validating with appstreamcli instead gives you:

~$ appstreamcli validate io.sourceforge.kbd-tapper.metainfo.xml
W: io.sourceforge.kbd-tapper:25: tag-empty requires
E: io.sourceforge.kbd-tapper:26: tag-invalid-text-content recommends
I: io.sourceforge.kbd-tapper:3: cid-contains-hyphen io.sourceforge.kbd-tapper

✘ Validation failed: errors: 1, warnings: 1, infos: 1

So, your requires tag in line 25 is empty, and your recommends tag in line 26 is invalid (see https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-relations for how this should look like).

ximion avatar Oct 02 '22 02:10 ximion

Using appstream-glib for this is no longer ideal, because it does not validate a lot of new concepts used in AppStream today.

Thanks for replacement, but it does not solve the issue. Is appstream-util still maintained or completely abandoned? I see no reason why it doesn't print the warning like this one:

$ appstream-util validate ./io.sourceforge.kbd-tapper.metainfo.xml 
Warning: 'appstream-util validate' is outdated, use 'appstreamcli' instead.
...

van-de-bugger avatar Oct 02 '22 17:10 van-de-bugger

Is appstream-util still maintained or completely abandoned?

I think @hughsie would call it "deep maintenance mode" ;-) - no major new features, but bugfixes are still applied and releases made. Appstream-glib is a separate project from AppStream itself, I'm not sure if it should print a warning like this... (would certainly not be a decision that I should make, as I am very biased and not the project's maintainer).

How does using the newer tool not solve the issue? As far as I can see, it tells you exactly what you want to know...

ximion avatar Oct 02 '22 18:10 ximion

How does using the newer tool not solve the issue? As far as I can see, it tells you exactly what you want to know...

Your suggestion solves my problem. But it does not solve the problem the ticket is about: "Error reporting of 'appstream-util validate' is too vague." I understand appstream-util is in "deep maintenance mode", but I think it is good idea to inform users about it.

van-de-bugger avatar Oct 02 '22 18:10 van-de-bugger