Validate AppStream metadata in the CI
Closed, ResolvedPublic

Description

Hi!
It would be great if the KDE CI could validate AppStream upstream metadata (also called metainfo or appdata).
In order to have more powerful analysis for generic errors, I recently extended the validator module of appstreamcli to also be able to validate while file-trees.
So if you have a recent version of AppStream installed (at least 0.8.4 or a Git snapshot), you can just do:

appstreamcli validate-tree --pedantic /path/to/the/installed/application/destdir

and check the output, which will be > 0 in case errors or warnings were found.
The validator will return output like this:

I: [org.kde.kaddressbook.desktop] First 'description/p' paragraph might be too short.
E: [stage.desktop] Component metadata refers to a non-existing .desktop file.
E: [simple-scan.appdata.xml] Your file is in a legacy AppStream format, which can not be validated. Please migrate it to spec version 0.6 or above.
E: [org.gnome.Screenshot.appdata.xml] Your file is in a legacy AppStream format, which can not be validated. Please migrate it to spec version 0.6 or above.
W: [org.kde.okteta.desktop] Found invalid tag: 'updatecontact'. Non-standard tags have to be prefixed with "x-".
E: [flow.desktop] Component metadata refers to a non-existing .desktop file.
E: [org.kde.okteta.desktop] The tag 'project_license' appears multiple times, while it should only be defined once per component.
Validation failed.

Thanks for considering!

P.S: There are also other validators around, which might be worth adding later as well - appstreamcli will perform the basic validations for compliance with the specification (and go beyond that when the --pedantic flag is passed).

mak created this task.Sep 7 2015, 11:55 PM
mak updated the task description. (Show Details)
mak raised the priority of this task from to Normal.
mak added a project: build.kde.org.
mak added a subscriber: mak.
mak added a comment.Sep 7 2015, 11:58 PM

Oh, I forgot to add: You can get an up-to-date Git snapshot of AppStream via

git clone https://github.com/ximion/appstream.git
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make && sudo make install

The dependencies are pretty light, and should be available on any Linux distribution.

mak lowered the priority of this task from Normal to Wishlist.Sep 7 2015, 11:59 PM
scarlettclark raised the priority of this task from Wishlist to Normal.

I will implement this on the new revamp in the works.

mak added a comment.EditedSep 8 2015, 6:50 PM

I just made a release of AppStream which contains the new validate-tree subcommand (still marked as unstable though, means I might change the name of the command or its semantics, although that's not very likely to happen).
Users of Debian unstable just need to upgrade to get it (and have the appstream package installed). I am thinking about filling a sync request for Ubuntu, since their version in the archive is broken with current DEP-11 metadata.

scarlettclark raised the priority of this task from Normal to Needs Triage.Nov 5 2015, 3:39 PM

Moving to top priority.

Hi, I am working on a Jenkins plugin for this finally.
The slaves we have I see do not have your latest build and only have 8.4 is this ok? or can you backport to Vivid? Thuough I guess I can upgrade to Wily. I was trying to avoid all that until the new CI revamp is released. Or maybe it would be better to keep a appstreamer build in KDE CI itself? Thoughts? I just want to make sure we have consistency somehow. We will also eventually have a debian builder as well (I think).

mak added a comment.Nov 11 2015, 2:09 AM

I think it would make sense to have a very recent version of appstreamcli, so in case some new checks are added we can benefit from them immediately.
That said, Debian has the latest version in Testing and Unstable, the version in Wily is a little bit outdated and the version in Vivid is very outdated.

If you want, I can provide backports for Vivid, Wily, etc. via a PPA (should be very trivial).

That would be wonderful if you could. Thank you very much. That way I can focus on the plugin rather than packaging lol.

mak added a comment.EditedNov 11 2015, 3:50 PM

The PPA in question already exists, and I use it for Limba, PackageKit and AppStream: https://launchpad.net/~ximion/+archive/ubuntu/packagekit/+packages
The Vivid suite currently holds an up2date AppStream and PackageKit, so other packages that could interfere with something.
I could also create a PPA containing *only* the AppStream package, if you want - but IMHO the ASLIPK repo should be fine :-)

mak added a comment.Nov 11 2015, 9:15 PM

Okay, I made the latest release available in the vivid suite of that PPA. Adding the PPA will also upgrade glib2 and cmake in the process, I hope that doesn't cause any problems (it actually shouldn't). At least the dependency on a recent GLib2 is necessary.
For Wily, no additional dependencies had to be added, and Xenial already has the latest release in the official repos.

scarlettclark closed this task as Resolved.Apr 13 2016, 7:54 PM

This is complete. Please open new task for improvement requests.