@pabloyoyoista
Copy link
Contributor

In the appstream-generator in alpine, we are currently seeing some programs fail with this error:

metainfo-license-invalid
The MetaInfo file does not seem to be licensed under a permissive license that is in the allowed set for AppStream metadata. Valid permissive licenses include FSFAP, CC0-1.0 or MIT. Using one of the vetted permissive licenses is required to allow distributors to include the metadata in mixed data collections without the risk of license violations due to mixing incompatible licenses.We only support a limited set of licenses that went through legal review. Refer to [the specification documentation](https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-metadata_license) for information on how to make 'GPL-3.0+ или GFDL-1.3-only' a valid expression, or consider replacing the license with one of the recognized licenses directly.

The reason seems to be that while parsing the metainfo files, in the as_component_load_from_xml file, all the metadata_license tags are processed, regardless of its localization. Therefore, some localized metainfo file like the following:

  <metadata_license>GPL-3.0+ or GFDL-1.3-only</metadata_license>
  <metadata_license xml:lang="bg">GPL-3.0+ или GFDL-1.3-only</metadata_license> 

will end up with the localized version (because it is the last one) as the metadata_license.

I can think of different solutions to this, from only processing non-localized metadata_license entries to verifying the correctness of the entered license in as_component_set_metadata_license. However, I am not sure of the other implications it might have, so I decided to open an issue and wait for guidance :)