(s/desktop-file-install/app-data-validate/) |
m (use new tool) |
||
(4 intermediate revisions by one other user not shown) | |||
Line 4: | Line 4: | ||
== AppData files == | == AppData files == | ||
If a package contains a GUI application, then it SHOULD also | 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], and they must correctly validate using <code>appdata-validate --relax</code>. | ||
=== .appdata.xml file creation === | === .appdata.xml file creation === | ||
If the package doesn't already include and install its own .appdata.xml 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 .appdata.xml 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 .appdata.xml file (comical.appdata.xml): | 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> | <pre> | ||
Line 18: | Line 18: | ||
<name>Comical</name> | <name>Comical</name> | ||
<summary>A Comic Archive Reader</summary> | <summary>A Comic Archive Reader</summary> | ||
<summary xml:lang="fr">Un Comic Archive Lecteur</fr> | |||
<description> | <description> | ||
<p> | <p> | ||
Comical is an easy to use and cross-platform CBR and CBZ reader which | Comical is an easy to use and cross-platform CBR and CBZ reader which | ||
prefetches and caches pages for speed. | 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> | ||
<p> | <p> | ||
Resized images are crisp, and you can view pages one or two at a time. | 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! | 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> | </p> | ||
</description> | </description> | ||
Line 37: | Line 46: | ||
</pre> | </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>. | 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>. | ||
=== app-data-validate usage === | === app-data-validate usage === | ||
Although you can just include the .appdata.xml file in the package, you | Although you can just include the .appdata.xml file in the package, you '''MUST''' run <code>appdata-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> | <pre> | ||
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/*.appdata.xml | |||
</pre> | </pre> |
Latest revision as of 08:43, 7 August 2014
AppData files
If a package contains a GUI application, then it SHOULD also install a .appdata.xml
file into %{_datadir}/appdata/
. Installed .appdata.xml
files MUST follow the AppData specification page, and they must correctly validate using appdata-validate --relax
.
.appdata.xml file creation
If the package doesn't already include and install its own .appdata.xml
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 .appdata.xml
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 .appdata.xml
file (comical.appdata.xml):
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright 2014 Richard Hughes <richard@hughsie.com> --> <application> <id type="desktop">comical.desktop</id> <metadata_license>CC0</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</fr> <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">http://comical.sourceforge.net/images/comical-0.5-linux.jpg</screenshot> <screenshot>http://comical.sourceforge.net/images/comical-0.6-win32.jpg</screenshot> </screenshots> <url type="homepage">http://comical.sourceforge.net/</url> <updatecontact>richard_at_hughsie.com</updatecontact> </application>
The AppData file MUST be named with the same root as the .desktop file, so if the .desktop file is named org.gnome.SomeApp.desktop
then the AppData file MUST be called org.gnome.SomeApp.appdata.xml
.
app-data-validate usage
Although you can just include the .appdata.xml file in the package, you MUST run appdata-validate --relax
(in %check
or %install
) and have BuildRequires: libappstream-glib
, to help ensure .appdata.xml file safety and spec-compliance. Here are some examples of usage:
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/*.appdata.xml