Adopt info from other metadata sources

:warning: Deprecated: This document has been superseded by Using external metadata

Some of the values required by the snapcraft.yaml file
might be already provided by other metadata sources available in the upstream

Instead of duplicating this information, you can declare that a snapcraft part
must parse the metadata file from the source, and adopt that parsed
information. For example, the following snapcraft.yaml will parse the file
called metadata-file and try to extract from it the version, summary and
description for the snap.

name: my-snap-name
adopt-info: part-with-metadata

    plugin: dump
    parse-info: [metadata-file]

Metadata sources

Currently, the only supported source of metadata is appstream.


Appstream is a standard
for metadata of software components. It can provide the summary,
description and icon for the snap, and the desktop files for the

Let’s say we have an upstream project with the following appstream file in

<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
  <summary>Single-line elevator pitch for your amazing application</summary>
    This is applications's description. A paragraph or two to tell the
    most important story about it.
  <icon type="local">assets/icon.png</icon>
  <launchable type="desktop-id">

Then you can adopt this info into your snapcraft.yaml like this:

name: sampleapp-name
adopt-info: sampleapp

    command: sampleapp
    common-id: com.example.sampleapp

    plugin: dump
    parse-info: [sampleapp.metainfo.xml]

The resulting snap will take the summary and description from the appstream
file and it will use the referred icon and desktop files.

Note that appstream doesn’t use a path to declare the desktop file. It uses
a Desktop File ID.
To know which appstream desktop-id corresponds to your app, you must declare
the common-id of the app in the snapcraft.yaml. snapcraft will search for a
parsed appstream file with the same component id and extract the desktop-id.
Then it will search for the desktop file in the directories usr/local/share
and usr/share relative to the part source, following the Desktop File ID


Can you add information about:

  • what version of snapcraft introduces this feature
  • turn this into a wiki
  • maybe consider splitting the intoduction topic and link it to a more specific appstream one to later be able to add e.g.;` without adding too much length to the document.
  • add the header as in the other documents that are candidates to be posted on our future docs site

Thanks for working on this!

This should probably also mention that the parse-info contains paths. From the given examples it looked to me that the files were being searched in the well-defined appstream paths of the stage, which isn’t actually the case.

So [usr/share/appdata/] is needed rather than [] when working with a file installed into the well-defined location.

Also, the first link is broken

1 Like

Is it possible to append additional info like security confinement information and unofficial package declaration etc?

Note: more up-to-date documentation is available at Using external metadata