Skip to content

Commit

Permalink
Add appstream metainfo docs
Browse files Browse the repository at this point in the history
Resolves #551
  • Loading branch information
malfisya committed Jul 1, 2024
1 parent 5eb52a4 commit 53fcdaf
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions docs/packaging/appstream-metainfo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: Appstream Metainfo

Check warning on line 2 in docs/packaging/appstream-metainfo.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (Metainfo)
summary: The purpose and format of Appstream Metainfo

Check warning on line 3 in docs/packaging/appstream-metainfo.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (Metainfo)
---

# AppStream Metainfo

Check warning on line 6 in docs/packaging/appstream-metainfo.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (Metainfo)

:::important

AppStream metainfo is required for the inclusion of graphical application to Solus repository.

Check warning on line 10 in docs/packaging/appstream-metainfo.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (metainfo)

:::

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 distributors to enhance their metadata.

Check warning on line 14 in docs/packaging/appstream-metainfo.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (metainfo)

AppStream metainfo become a requirement for Solus because new software centers such as GNOME software and KDE Siscover rely on it to know which applications are available in repository. Typically AppStream metainfo is shipped bundled with graphical application itself, but sometimes upstream doesn't do so. Packagers are required to add AppStream metainfo themselves when that happen.

Check warning on line 16 in docs/packaging/appstream-metainfo.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (metainfo)

Check warning on line 16 in docs/packaging/appstream-metainfo.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (Siscover)

Check warning on line 16 in docs/packaging/appstream-metainfo.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (metainfo)

Check warning on line 16 in docs/packaging/appstream-metainfo.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (metainfo)

## Adding appstream metainfo to an existing package

There are a few scenarios that Packagers might encounter:

|No | Scenario |Solution |
| -------- | --------------------------------- | -----------|
| 1 | An application already provides appstream metainfo| Nothing to do|
|2| An application contains appstream metainfo in the source package but we do not install it | Install the appstream metainfo to `/usr/share/metainfo`. _Example_: [here](https://github.com/getsolus/packages/commit/0a726a53454e7c8a6b0e66de69d59bcc66f0fc19 )|
|3| An application doesn't contain appstream metainfo in the source package but it exists on Flathub | Borrow and tweak the appstream metainfo from the Flathub repo. Encourage upstream to add it to their source. _Example_: [here](https://github.com/getsolus/packages/commit/da2f65b93f412da43d1db9edbcb08bb90517a0eb)|

Check warning on line 26 in docs/packaging/appstream-metainfo.md

View workflow job for this annotation

GitHub Actions / spellcheck

Unknown word (Flathub)
|4| An application doesn't provide appstream metainfo and it doesn't exist on flathub| Write the appstream data, submit it to upstream. _Example_: [here](https://github.com/getsolus/packages/commit/414219d8b2ceeabe85178d3a467f81b9131016f4)|
| 5 |Appstream metainfo is provided but generation of it is failing| See [here](https://github.com/getsolus/solus-appstream-data#debugging-failures). _Example_: [here](https://github.com/getsolus/packages/commit/583b7c742caf50e2f66a70e9b62e9b91566c03f5).|


AppStream metadata is to be placed in the `/usr/share/metainfo/` directory and must be placed in the package which should be installed in order to get the software described by the respective metadata. This means that you might need to move the *.metainfo.xml or *.appdata.xml to the right (meta)package.

In case your AppStream metadata is describing a desktop-application (you can tell by the XML root-node having a type="desktop-application" or type="desktop" attribute), the .appdata.xml file must be placed in the same package as the .desktop file already is, which (as above) must be the package containing the application itself.

## Testing appstream data

- Clone the package repo

- Build it or eopkg fetch pkgname

- Run `sudo eopkg it appstream-glib`, `appstream-builder --packages-dir=. --include-failed -v`

- Look in the `example-failed.xml.gz` file to see if the appstream generation failed

- Look in the `example.xml.gz` file to see if the appstream generation succeeded.

- Install the package and run `appstream-util validate /usr/share/metainfo/pkgname.xml`

## Other Info

Generally speaking, a package must provide one appstream metainfo file, an icon as well as an .desktop file to succeed. However, there are exceptions to this. If an application provides more than one appstream metainfo file then the package must be subpackaged to generation of all the appstream metainfo files to succeed.

0 comments on commit 53fcdaf

Please sign in to comment.