From Fedora Project Wiki

m (Fix typo in example /fr => /summary.)
(Remove old content and replace with redirect.)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== AppData files ==
{{GuidelineRedirect|AppData}}
 
If a package contains a GUI application, then it '''SHOULD''' also install a <code>.appdata.xml</code> file into <code>%{_datadir}/appdata/</code>. Installed <code>.appdata.xml</code> files '''MUST''' follow the [http://people.freedesktop.org/~hughsient/appdata/ AppData specification page].
 
If a package contains an add-on for GUI application, then it '''SHOULD''' also install a <code>.metainfo.xml</code> file into <code>%{_datadir}/appdata/</code>. Installed <code>.metainfo.xml</code> files '''MUST''' follow the [http://www.freedesktop.org/software/appstream/docs/sect-Quickstart-Addons.html AppStream add-ons specification page].
 
The AppData files '''MUST''' correctly validate using <code>appstream-util validate-relax</code>.
 
=== .appdata.xml file creation ===
If the package doesn't already include and install its own <code>.appdata.xml</code> file, you can make your own and sending it upstream. Benefits of sending the file upstream is that upstream can translate the file using the existing translation resources and can also modify the screenshots and descriptions as the application changes over time. You can do this by including a <code>.appdata.xml</code> file you create as a Source: (e.g. Source3: %{name}.appdata.xml) or generating it in the spec file. Here is the contents of a sample <code>.appdata.xml</code> file (comical.appdata.xml):
 
<pre>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2014 Richard Hughes <richard@hughsie.com> -->
<component type="desktop">
  <id>comical.desktop</id>
  <metadata_license>CC0-1.0</metadata_license>
  <project_license>GPL-2.0+ and GFDL-1.3</project_license>
  <name>Comical</name>
  <summary>A Comic Archive Reader</summary>
  <summary xml:lang="fr">Un Comic Archive Lecteur</summary>
  <description>
    <p>
      Comical is an easy to use and cross-platform CBR and CBZ reader which
      prefetches and caches pages for speed.
    </p>
    <p xml:lang="fr">
      Comical est une CBR et CBZ lecteur facile à utiliser et
      multi-plateforme qui prélectures et caches pages pour la vitesse.
    </p>
    <p>
      Resized images are crisp, and you can view pages one or two at a time.
      Comical is open-source, so feel free to contribute new features!
    </p>
    <p xml:lang="fr">
      Images redimensionnées sont nettes, et vous pouvez voir une ou deux pages à la fois.
      Comical est open-source, alors n'hésitez pas à apporter de nouvelles fonctionnalités!
    </p>
  </description>
  <screenshots>
    <screenshot type="default">
      <image>http://comical.sourceforge.net/images/comical-0.5-linux.jpg</image>
    </screenshot>
    <screenshot>
      <image>http://comical.sourceforge.net/images/comical-0.6-win32.jpg</image>
    </screenshot>
  </screenshots>
  <url type="homepage">http://comical.sourceforge.net/</url>
  <update_contact>richard_at_hughsie.com</update_contact>
</component>
</pre>
 
The AppData file '''MUST''' be named with the same root as the .desktop file, so if the .desktop file is named <code>org.gnome.SomeApp.desktop</code> then the AppData file MUST be called <code>org.gnome.SomeApp.appdata.xml</code>.
 
=== .metainfo.xml file creation ===
If the add-on package doesn't already include and install its own <code>.metainfo.xml</code> file, you can make your own and sending it upstream. You can do this by including a <code>.metainfo.xml</code> file you create as a Source: (e.g. Source4: %{name}.metainfo.xml) or generating it in the spec file. Here is the contents of a sample <code>.metainfo.xml</code> file (gedit-bookmarks.metainfo.xml):
 
<pre>
<?xml version="1.0" encoding="UTF-8"?>
​<component type="addon">
​  <id>gedit-bookmarks</id>
​  <extends>gedit.desktop</extends>
​  <name>Bookmarks</name>
​  <summary>Easy document navigation with bookmarks</summary>
​  <url type="homepage">https://wiki.gnome.org/Apps/Gedit/ShippedPlugins</url>
​  <url type="bugtracker">https://bugzilla.gnome.org/enter_bug.cgi?product=gedit&amp;component=Plugins</url>
​  <metadata_license>CC0-1.0</metadata_license>
​  <project_license>GPL-2.0+</project_license>
​</component>
</pre>
 
You can use anything as the <code><id></code> but it needs to be unique and sensible and also match the <code>.metainfo.xml</code> filename prefix.
 
=== app-data-validate usage ===
Although you can just include the .appdata.xml file in the package, you '''MUST''' run  <code>appstream-util validate-relax</code> (in <code>%check</code> or <code>%install</code>) and have <code>BuildRequires: libappstream-glib</code>, to help ensure .appdata.xml file safety and spec-compliance. Here are some examples of usage:
 
<pre>
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/*.appdata.xml
</pre>
 
[[Category:Packaging guidelines]]

Latest revision as of 23:54, 22 January 2019

Warning.png
The current version of this document is located at https://docs.fedoraproject.org/en-US/packaging-guidelines/AppData/. Please update your bookmarks.