Re: MIME support in Debian.
To summarise our discussion, I have created the following wiki page:
= Support of MIME types in Debian packages =
== For the command line ==
MIME support in Debian is formally described in the
[http://www.debian.org/doc/packaging-manuals/mime-policy/ MIME sub-policy],
which requests that packages use the update-mime command from the mime-support
package. This can be done directly, or indirectly through helper programs, in
particular dh_installmime from debhelper. The format of the registration file
is described in the mailcap(5) manpage, and many examples can be found in
== For the desktop ==
The MIME system has been reused by Desktop managers in order to associate
relevant programs to files. Divergent implementations have been used, but this
page focuses on the standard from FreeDesktop.org.
Association between a file suffix and file type is done through XML files
following the Shared MIME-info Database specification. The Debian package
shared-mime-info contains the specification and the program
update-mime-database that is used to populate the /usr/share/mime with relevant
entries, using the XML file as a source. dh_installmime can be used to simplify
Programs are indirectly associated to file suffixes through the association
with a file type. This is done through their .desktop file, with the MimeType
== In summary, if you use debhelper: ==
* create a file named by the package name plus .mime as a suffix , containing
information in the mailcap format.
* create a XML file named by the package name plus .sharedmimeinfo as a
suffix, containing information about a given file type, and its usual suffix.
* create a destkop entry named by the program name plus .desktop as a suffix,
and document inside what file types the program can accept. Install it by
yourseld in /usr/share/applications, dh_desktop does not do this at the time
this memo is written.
* call dh_installmime and dh_desktop
== Further readings ==
* The Debian MIME policy: http://www.debian.org/doc/packaging-manuals/mime-policy/
* The manual pages of update-mime, update-mime-database, dh_installmime, dh_desktop and mailcap.
* The Shared MIME info specification: http://standards.freedesktop.org/shared-mime-info-spec/latest
* The Desktop entry specification: http://standards.freedesktop.org/desktop-entry-spec/latest/
* The RFCs 2045 and 2048
* More information can be found at http://sourceforge.net/docman/?group_id=159685
Informations to write this page were collected in during a discussion on the
debian-mentors mailing list :
There are still two things I am wondering:
- Do the packages need to depend on mime-support and shared-mime-info ?
- If two programs can open files with a given suffix, they have to ship the
same .sharedmimeinfo file. How can we factorize this code ?
Merry christmas to you and everybody else !
Wakō, Saitama, Japan