Chapter 2. Upstream Metadata

- Prev
- AppStream
- Next

# ⁠Chapter 2. Upstream Metadata

AppStream allows upstream projects to define metadata about the components they provide using small XML files, metainfo files, which get installed into locations on the client system and are used by distribuors to enhance their metadata.
A "component" is a piece of software, like an application, a library, a font or a codec. For several components, especially those which are shown in software-centers, we provide specialized metainfo files to define specific properties and data of these components. For example, applications and fonts support screenshots, while codecs don't.
All metainfo files need to contain a minimal amount of information, defined in the "Generic Component" section, which also describes some optional elements which can be used. Specialized components might require more information to be complete and valid.

## ⁠2.1. Generic Component

### ⁠2.1.1. Introduction

For a distribution, it is good to know more about the content of a package. Which public interfaces (libraries? Python modules?) does it provide? Does it contain codecs? Does it contain firmware? Fonts? An application? All of this information can be used to automatically install missing software or to offer users a choice on what they want to install from a software center.
To provide this information, we created the metainfo files, which allow upstream projects to describe the content of their software package. If a metainfo file provides a `<provides/>` tag, distributors must also ensure that the package providing the file contain all items referenced by that statement, or is installed by a metapackage depending on packages which provide these items. This gives upstream projects a (very light) way to influence distributor packaging. More information about that can be found below.
Several specialized component-metainfo files exist, for example for applications or fonts. These are all based on this generic component XML specification, and are described in the following chapters.

### ⁠2.1.2. Filesystem locations

Upstream projects can ship one or more metainfo files in `/usr/share/appdata/%{id}.metainfo.xml`, where `id` is a unique identifier of this specific component.

Note

Applications are a special case here, because they are special in some ways (and also for historical reasons). If your metainfo file covers only an application, as described in the AppData section, install it as `/usr/share/appdata/%{id}.appdata.xml`.
Please note that the `/usr/share/appdata/symbols` directory is reserved for a possible future use for storing upstream-generated symbols files for libraries.

### ⁠2.1.3. XML Specification

The XML for a generic component definition starts with an `<component>` tag as root element. The `<component>` element must at least have an `id`, `name` and `releases` tag, a `provides` tag with appropriate children is highly recommended. All possible tags in the generic set are:

⁠<id/>
  The `<id>` tag is a short and unique identifier for this component. It must contain only ASCII characters, dots, hyphens and numbers, spaces are not allowed. Specialized metainfo types, such as application or fonts, may apply additional restrictions on the `id` tag value.
  Note that the value of this tag must be unique across all distributions. In case it is not, distributors are expected to reject the conflicting components from inclusion into their metadata.
⁠<metadata_license/>
  The `<metadata_license/>` tag is indicating the content licence that you are releasing the one Metainfo XML file as. This is not typically the same as the project licence. By ommitting the licence value would probably mean your data would not be incorporated into the distribution metadata (so this is a required tag). Permissible licence codes include:
  - CC0-1.0
  - CC-BY-3.0
  - CC-BY-SA-3.0
  - GFDL-1.3
  - MIT
  The licence codes correspond to the identifiers found at the SPDX OpenSource License Registry. For instance, CC-BY-SA-3.0 corresponds to http://creativecommons.org/licenses/by-sa/3.0/
⁠<name/>
  A human-readable name for this software component. For example, if the component id was "libc", it's name might be "GNU Standard C Library".
⁠<summary/>
  A short summary of what this component does. If the component is "PackageKit", the summary could be "Provides a package-management abstraction layer".
⁠<description/>
  A long description of this component. Some markup can be used.
  Do not assume the format is HTML. Only paragraph (p), ordered list (ol) and unordered list (ul) are supported at this time.
  In metainfo files, this tag should be translated by-paragraph, meaning that in a translated file, each translated `<p/>` child has a language property.
⁠<url/>
  Defines URLs for this component.There are several different URL types allowed:
  homepage
    Should be a link to the upstream homepage for the component.
  bugtracker
    Should point to the software's bug tracking system, for users to report new bugs.
  faq
    Should link a FAQ page for this software, to answer some of the most-asked questions in detail, something which you can not do in the component's description.
  help
    Should provide a link to an online user's reference, a software manual or help page.
  donation
    Links of this type should point to a webpage showing information on how to donate to the described software project.
⁠<releases/>
  The `<releases>` tag contains `<release/>` child tags which describe some metainformation about the current release of the described software. The `<release/>` tag may be present multiple times (for older releases), but a tag for the current version must always be present. A `release` tag can have the properties `version` and `timestamp` which contain the version number and a release timestamp in form of a UNIX epoch.
  Each `release` tag may have a `description` tag as child, containing a brief description of what is new in the release. The `description` tag is structured as described in <description/>
  Examples for a valid releases tag:

      ​<releases>
      ​  <release version="1.2" timestamp="1397253600" />
      ​  <release version="1.0" timestamp="1345932000" />
      ​</releases>

⁠<provides/>
  The `provides` tag and it's children describe the public interfaces this application provides. A public interface can be anything which other applications, which are not part of the upstream project, can access or reference. This includes binaries and libraries. Private interfaces should never be added to a `provides` tag.
  A `provides` tag contain a number of children describing the type and name of the provided public interface items. It is suggested that the build-system auto-generates this tag and it's children. Currently allowed item types are listed below. If you miss something, file a bug against AppStream so we can add the new type.
  <library/>
    Contains the name of a shared library placed in a publicly accessible library path, such as `/usr/lib`, `/usr/lib/<triplet>` or `/lib`. For example, for the libappstream library, the value for `library` would be `libappstream.so.1`.
  <binary/>
    Name of a binary installed into a location in `PATH`.
  <font/>
    Name of a font provided by this component. For example `Linux Libertine O`. The tag must have a `file` property stating the filename of the referenced font.
    Example:

        ​<provides>
        ​  <font file="LinLibertine_R.otf">Linux Libertine O</font>
        ​</provides>

  <modalias/>
    A modalias glob representing the hardware types (for example USB, PCI, ACPI, DMI) this component handles. Useful for installing printer drivers or other USB protocol drivers for smartphones, firmware, kernel drivers which are not merged upstream yet or whatever else.
  <firmware/>
    Name of the firmware this component provides, to make it possible to find the right firmware package to install for a given kernel driver. The value is the path below /lib/firmware to the firmware file in question, like the firmware value exported from Linux kernel modules.
    Example:

        ​<provides>
        ​  <firmware>ipw2200-bss.fw</firmware>
        ​</provides>

  <python2/>
    Name of a Python2 module this component provides.
  <python3/>
    Name of a Python3 module this component provides.
  <dbus/>
    Contains the name of a DBus service as property. The type of the service must be specified using the `type` property of this tag. Allowed values are `session` and `system`.
    Example:

        ​<provides>
        ​  <dbus type="system">org.freedesktop.PackageKit</dbus>
        ​</provides>

⁠<mimetypes/>
  This tag can contain one or more `<mimetype/>` children, describing the mime types this application supports. This tag is especially useful for generic components and addon-type components. For applications, the metadata will automatically be fetched from their .desktop files by the distribution's metadata generator. Example:

      ​
      ​<mimetypes>
      ​    <mimetype>text/html</mimetype>
      ​    <mimetype>image/jpeg</mimetype>
      ​    <mimetype>application/rss+xml</mimetype>
      ​ </mimetypes>

⁠<project_group/>
  If you include the `<project_group/>` tag then this identifies your project with a specific upstream umbrella project. Known values include GNOME, KDE, XFCE, MATE and LXDE, although other umbrella projects like Yorba or Mozilla make sense too.

  Note

  You should only identify with an umbrella project if you use all their infrastructure and policies, for instance string freezes dates, bugtracker and source control instance.
⁠<project_license/>
  The `<project_license/>` tag is indicating the license of the component (application/library/addon/font/etc.) described in the metadata document. It should be a string in SPDX format. Licenses may be combined using and and or logic. Possible values include:
  - GPL-2.0
  - LGPL-3.0+ and GPL-3.0+
  - MIT
  - CC-BY-SA-2.0
  - ...
  A full list of recognized licenses and their identifiers can be found at the SPDX OpenSource License Registry.
  Although the `project_license` tag is not mandatory, it is recommended to include it.
⁠<developer_name/>
  The `<developer_name/>` tag is designed to represent the developers or project responsible for development of the project described in the metadata.
  Values might be for example "The GNOME Foundation" or "The KDE Community". You must not include hyperlinks or emails in this field, if you want to link to the developer's homepage, use the <url/>-tag instead.
  This tag is translatable.
⁠<screenshots/>
  Visual components (like fonts or graphical applications) may choose to add one or multiple screenshots to their metadata.
  The `<screenshots/>` tag contains multiple `<screenshot/>` children, where at least one of them must have the property `type="default"` to indicate the application's primary screenshot. Every `<screenshot/>` tag must have at least one `<image/>` child, which should define the width and height of the referenced image in it's properties. The value of the `<image/>` tag is a direct URL to a screenshot uploaded to a public location on the web.
  Optionally, a `<screenshot/>` tag may have a `<caption/>` child, defining a short (not more then 255 characters!) description of what the user can see on the referenced screenshot.
  Ideally, all screenshots should have a 16:9 aspect ratio, and should have a width that is no smaller than 620px. They should also be in be in PNG or JPEG format. PNG is the preferred format; JPEG should only be used when screenshots include large photographs or other images where a lossy format like JPEG may compress better.
⁠<update_contact/>
  The `<update_contact/>` tag is an optional tag which can be added to provide an email address distributors can use to contact the project about invalid or incomplete metadata, or in case the specification has changed, about old metadata. It can also be used to ask general questions in case of an update of the component described in the metadata file.
  The `<update_contact/>` tag must only be used by distributors. It is not included in the distribution-provided AppStream XML file, and therefore not exposed to the end user via any kind of UI.
  Upstream authors might decide to add an email address in cleartext, but spam protection using `_AT_` is also valid.
  Example:

      ​<update_contact>developer_AT_example.com</update_contact>

An example for a very basic component file could look like this:

    ​
    ​<?xml version="1.0" encoding="UTF-8"?>
    ​<component>
    ​  <id>foobar</id>
    ​  <name>Foo Bar</name>
    ​  <summary>A foo-ish bar</summary>
    ​  <url type="homepage">http://www.example.org</url>
    ​  <metadata_license>CC0</metadata_license>
    ​
    ​  <provides>
    ​    <library>libfoobar.so.2</library>
    ​    <font>foo.ttf</font>
    ​    <binary>foobar</binary>
    ​  </provides>
    ​  <releases>
    ​    <release version="1.2" timestamp="1365768000" />
    ​  </releases>
    ​  <developer_name>FooBar Team</developer_name>
    ​</component>

- PrevChapter 1. About AppStream
- Up
- Home
- Next2.2. Desktop Applications