# Generic Component

## 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 contains a `<provides/>` tag, distributors must also ensure that the package providing the file contains 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.

## Filesystem locations

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

Applications are a special case here, because they are usually treated differently by software centers (and also for historical reasons). If your metainfo file contains an application, as described in , you may want to install it as `/usr/share/metainfo/%{id}.appdata.xml`.

Legacy Path

The `/usr/share/appdata/` path must be scanned by AppStream tools as well, to support legacy applications installing metadata there. For new software components, it is advised not to use this directory.

## XML Specification

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

<id/>

  The `<id>` tag is a unique identifier for this component. It must contain only ASCII characters, dots, hyphens and numbers. Spaces are not allowed.

  The ID must follow a reverse-DNS scheme, consisting of `{tld}.{vendor}.{product}`, for example `org.kde.Gwenview` or `com.hugski.ColorHug2`. Ownership of `{vendor}.{tld}` in the domain name system guarantees uniqueness of IDs.

  To increase the uniqueness and to distinguish between different pieces of a software suite, it is suggested to append the type name to the component-id in these cases. For example, one can use `com.hugski.ColorHug2` for the client tools to control hardware, and `com.hugski.ColorHug2.firmware` for the runtime firmware files.

  Note that the value of this tag must be unique across all distributions and software deployment platforms. In case it is not unique, distributors are expected to reject the conflicting components from inclusion into their metadata and notify the upstream projects about this issue.

<metadata_license/>

  The `<metadata_license/>` tag indicates the content license that you are releasing the one Metainfo XML file under. This is typically not the same as the project license. Omitting the license value can result in your data not being incorporated into the distribution metadata (so this is a required tag).

  A permissive license ensures your data can be combined with arbitrary other data in one file. Permissive license names include:

  - `CC0-1.0`

  - `CC-BY-3.0`

  - `CC-BY-SA-3.0`

  - `GFDL-1.3`

  - `MIT`

  - `FSFAP`

  The license codes correspond to the identifiers found at the SPDX OpenSource License Registry. For instance, `CC-BY-SA-3.0` corresponds to the license at creativecommons.org/licenses/by-sa/3.0.

<name/>

  A human-readable name for this software component. For example, if the component ID was "libc", its 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.

<categories/>

  This tag can contain one or more `<category>>` entries, describing the categories this software component is associated with. This tag is usually applied to components of type `desktop-application`, but can be used with any component. A list of valid category names can be found in the Freedesktop menu spec. Example:

      <categories>
          <category>Game</category>
          <category>ArcadeGame</category>
      </categories>

<url/>

  Defines web 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 cannot do in the component's description.

  help

    Should provide a web link to an online user's reference, a software manual or help page.

  donation

    URLs of this type should point to a webpage showing information on how to donate to the described software project.

  translate

    URLs of this type should point to a webpage where users can submit or modify translations of the upstream project.

    Typically this should be a link to the project page in Weblate, Transifex or Zanata, but could also be a link to an upstream-hosted wiki page describing how to send translations upstream.

<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`, `date` and `timestamp`. The `date` property can have any time in ISO 8601 format as its value and should be present for every release. The `timestamp` tag contains the release time in the form of a UNIX epoch. This tag should not be used in metainfo files in newly written metadata, but will still be parsed in case it is present. The the `timestamp` property is mainly used in generated distro-metadata. In case both release-time tags are present, the `timestamp` tag will take precedence over `date`.

  Optionally, the `<release/>` tag may also have an `urgency` property, having one of the following values:

  - `low`

  - `medium`

  - `high`

  - `critical`

  The `urgency` defines how important it is to install the new release as an update. This is especially important for `type=firmware` components. If no urgency is defined, a `medium` urgency is implicitly assumed. The urgency defines how the update will be presented to the user, and sometimes if it will be installed automatically and immediately, or delayed.

  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 .

  A `release` tag may also have one or multiple `size` tags as children, which define the installed and download size of this component release. This is useful in case the component does not have a corresponding native package in a distribution, for example if it is a Limba bundle or LVFS firmware. The size type is defined via a `type` property on the `size` tag, and may assume the value `download` or `installed`. The size itself is set as the value and must be given in bytes.

  Examples for a valid releases tag:

      <releases>
        <release version="1.2" date="2014-04-12" urgency="high">
          <size type="download">12345678</size>
          <size type="installed">42424242</size>
        </release>
        <release version="1.0" date="2012-08-26" />
      </releases>

<provides/>

  The `provides` tag and its 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 its 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/>

    Filename of a font provided by this component. For example `Dustismo_Roman.ttf`.

    Example:

        <provides>
          <font>LinLibertine_R.otf</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, and out of tree kernel drivers.

  <firmware/>

    This provided element is described in details for the `firmware` component type, where it is mandatory. Please see for more information.

  <python2/>

    Name of a Python 2 module this component provides.

  <python3/>

    Name of a Python 3 module this component provides.

  <dbus/>

    Contains the well-known name of a D-Bus service as its value. The type of the service must be specified using the `type` property of this tag. Allowed values are `user` 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.

  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 -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 primary screenshot of the software. Every `<screenshot/>` tag must have at least one `<image/>` child.

  The value of the `<image/>` tag is a direct HTTP/HTTPS/FTP URL to a screenshot uploaded to a public location on the web. The `<image/>` tag may have the following properties:

  - `type`

    The type of the image: `source` for the source image, and `thumbnail` for a thumbnail image. In case the type is `thumbnail`, the `width` and `height` properties must be present.

  - `width`

    The width of the image in pixels.

  - `height`

    The height of the image in pixels.

  - `xml:lang`

    The language this screenshot image is translated in. This property should only be present if there are multiple images with different locales present.

  Optionally, a `<screenshot/>` tag may have a translatable `<caption/>` child, defining a short (ideally not more then 256 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 620 pixels. 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.

  Example:

      <screenshots>
        <screenshot type="default">
          <caption>The FooBar main window.</caption>
          <image type="source" width="1600" height="900">https://example.com/foobar/screenshot-1.png</image>
        </screenshot>
        <screenshot>
          <caption>Foobar showing the frobnicate functionality.</caption>
          <image type="source" width="1600" height="900">https://example.com/foobar/screenshot-2.png</image>
        </screenshot>
       </screenshots>

<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. The value of this tag is generally treated a case-insensitive way.

  Example:

      <update_contact>developer_AT_example.com</update_contact>

<translation/>

  The `<translation/>` tag is an optional tag which can be added to specify the translation domain used for this software component. It may be used by the AppStream distro metadata generator to determine the translation status of the respective software.

  The tag must have a `type` property, assuming the value of the translation system which is used. Right now, allowed translation systems and values for `type` are:

  - `gettext`

  - `qt`

  In case a software components gets its translation from multiple translation domains, the `<translation/>` tag may be defined more than once.

  Example:

      <translation type="gettext">foobar</translation>

<suggests/>

  The `<suggests/>` tag is an optional tag which can be added to specify the component-ids of other software this components suggests. Software centers might present the suggested software on the installation page of the described component.

  The tag may have a `type` property, with the value `upstream`, indicating that this suggestion originates from the upstream project. If no `type` property is given, `upstream` is implicitly assumed as value. Metainfo files must not define other `suggests` types, those are reserved for AppStream catalog XML (see in catalog XML).

  The `suggests` tag must have one or more `<id/>` tags as children, specifying the IDs of the suggested other software components.

  Example:

      <suggests>
        <id>org.kde.gwenview.desktop</id>
        <id>org.inkscape.Inkscape</id>
      </suggests>

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

    <?xml version="1.0" encoding="UTF-8"?>
    <component>
      <id>com.example.foobar</id>
      <name>Foo Bar</name>
      <summary>A foo-ish bar</summary>
      <url type="homepage">http://www.example.org</url>
      <metadata_license>CC0-1.0</metadata_license>

      <provides>
        <library>libfoobar.so.2</library>
        <font>foo.ttf</font>
        <binary>foobar</binary>
      </provides>
      <releases>
        <release version="1.2" date="2015-02-16" />
      </releases>
      <developer_name>FooBar Team</developer_name>
    </component>

For a component of type `generic`, the minimal amount of required tags is: , , , .