# 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 `summary` 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. While hyphens are allowed for legacy compatibility, their usage is strongly discouraged to ensure interoperability of the AppStream ID with other tools such as D-Bus (and thereby making the ID more generic and useful). It is also strongly discouraged to start any segment of the ID with a digit.

  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.

  Escaping characters in the component ID

  To ensures the greatest possible compatibility of an AppStream ID, it is recommended to replace any hyphens in the ID with underscores, and prefix every leading digit of a section with an underscore as well. Since the underscore is not a valid character in domain names, the uniqueness of the ID is kept. For example, the ID `org.7-zip.7Zip` could become `org._7_zip._7Zip`.

<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 (this means copyleft licenses like the GPL are not suitable as metadata license). Valid permissive licenses 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".

<icon/>

  The `<icon/>` tag describes the component icon. It is mostly used for GUI applications (component-type `desktop-application`). It can be of type `stock`, `local` or `remote`.

  `stock` icons are loaded from the icon stock (the current or hicolor/locolor fallback themes). The icon name must not include any file-extension or path.

  `local` icons are loaded from a file in the filesystem. They should specify a full file path. This icon type may have `width` and `height` properties.

  `remote` icons loaded from a remote URL. Currently, only HTTP/HTTPS urls are supported. This icon type should have `width` and `height` properties.

<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.

<launchable/>

  This optional tag indicates possible methods to launch the software described in this component. It is allowed to appear multiple times in the metainfo data.

  The `<launchable/>` tag has a essential `type` property indicating the system that is used to launch the component. The following types are allowed:

  desktop-id

    The application can be launched via a desktop file. The value of the tag is a desktop-file id.

    In case a software component has multiple launchable entries, the software center might display a dialog to choose which entry to launch. If possible though, it should be avoided to add multiple `launchable` tags of type `desktop-id`.

  service

    The software can be started, stopped, and monitored by the OS "init" facility, such as systemd. The value of the tag is a name that can be used with that facility, such as a systemd unit name.

    Multiple `launchable` tags of type `service` are not alternatives to start the same service, but the component does contain multiple services that might all need to be started.

    Only those services should be listed as launchables that the user is actually expected to start and stop manually. Services that are started/stopped indirectly via dependencies of other services should not be listed.

    For systemd units, the services listed as launchables are expected to support enabling and disabling.

  cockpit-manifest

    The software can be launched from the menus of the Cockpit admin interface. The value of the tag is the name of a Cockpit package.

  url

    The application is a web site that is viewed through a browser. The value of the tag is a direct HTTP/HTTPS URL that the browser must navigate to.

  Example:

      <launchable type="desktop-id">org.gnome.Sysprof2.desktop</launchable>

<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 `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.

  Finally a `release` tag may have a `type` property to classify releases with one of the following values:

  - `stable`

  - `development`

  By default, if no release type is defined, `stable` is assumed. A software displaying a listing of releases should only show stable releases and discard any development release if the current version is itself stable. It can show all versions when development versions of the software are also distributed.

  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.1" type="development" date="2013-10-20" />
        <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/>

    Full name of a font provided by this component. See for more information.

  <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>

  <id/>

    Contains the component-ID of another software component. The presence of this tag indicates that the software component containing it is able to provide all functionality of the one referenced in the `<provides/> ↪ <id/>` tag.

    This is useful in case a component-id had to be renamed in the past, e.g. because its domain-name changed.

<requires/> & <recommends/>

  The `requires` tag denotes an absolute requirement on a different system component. A component can require a certain hardware to be present, or kernel, or other component to be installed first. If a requirement is not met, AppStream clients should prevent the installation of the particular software component.

  If it is not essential that a certain requirement is met by the system, but just recommended to be available, a `recommends` tag should be used. In this case, AppStream clients should allow the installation of the software component, but may display a warning before allowing it.

  A `requires` or `recommends` tag contains children describing the type, value and version relation of the required item. Each child can have a `version` and a `compare` property, to allow depending on a certain minimal version of the respective item. The `version` property contains the version to be compared against, while the `compare` property contains a two-letter code denoting how to compare the version of a present item with the version listed in the property. If no `compare` property is given, but a `version` property is found, AppStream implementations should implicitly assume a value of `ge` for comparison of the versions. The installed version is on the left side of the required version when comparing them. Possible two-letter codes for version comparisons are:

  - `eq` - Equal to

  - `ne` - Not equal to

  - `lt` - Lesser than

  - `gt` - Greater than

  - `le` - Lesser than or equal to

  - `ge` - Greater than or equal to

  Possible item types to declare a requirement on or a recommendation for are:

  <id/>

    A relation to another software component. The value should be another component-ID. Example:

        <requires>
          <id version="1.0" compare="ge">org.example.MySoftware</id>
        </requires>

  <modalias/>

    Check for a specific hardware to be present via its modalias. The modalias may contain a wildcard expression. Example:

        <recommends>
          <modalias>usb:v1130p0202d*</modalias>
        </recommends>

  <kernel/>

    Check for a specific kernel to be running on the system. The kernel name is the output of `uname -s`. Example:

        <requires>
          <kernel version="4.14" compare="ge">Linux</kernel>
        </requires>

  <memory/>

    Set a relation to the amount of physical memory (RAM) the system should have to run the software component. The memory size is set in MiB. You usually only want to use this with the `recommends` tag, because users might want to install the software on systems even if they have a lesser amount of memory compared to what would be ideal. Example:

        <recommends>
          <memory>2048</memory> <!-- recommend at least 2GiB of memory -->
        </recommends>

<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 SPDX license expression. 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 than 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>

<content_rating/>

  The `<content_rating/>` tag is an optional tag which can be added to specify age ratings for the respective software components. These maybe be used for parental control or to display their information in software centers.

  The tag must have a `type` property, indicating the type of the rating system that is used. At the moment, the Open Age Ratings Service (value `oars-1.0`) is supported natively, but more services might be added in future.

  The `<content_rating/>` must have `<content_attribute/>` children which each have an `id` property indicating the specific section that is rated. Their value indicates the intensity of the rated section and can be one of:

  - `none` - no rating given

  - `mild`

  - `moderate`

  - `intense`

  The website of the Open Age Ratings Service provides an online form which will automatically generate AppStream compatible markup based on a set of questions answered about the content.

  Example:

      <content_rating type="oars-1.0">
        <content_attribute id="drugs-alcohol">moderate</content_attribute>
        <content_attribute id="language-humor">mild</content_attribute>
      </content_rating>

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: , , , .