Notes on ebuilds with GUI

When this wiki page was started (2017-11-13), there was a lot confusion about how to write clean ebuilds for desktop applications. As result, there are many ebuilds which use obsolete eclasses, or even worse do not install, update and remove the icons and menus. The eclasses are hardly documented and the documentation has mistakes. Many for loops for icons miss the definition of the local variable.

Note
This page is still work in progress. It would be nice, if we could extract a howto wiki page from it afterwards and improve the documentation of the eclasses.

Eclasses

xdg.eclass

eclass reference: xdg.eclass

  • xdg inherits xdg-utils

xdg-utils.eclass

eclass reference: xdg-utils.eclass

gnome2.eclass

eclass reference: gnome2.eclass

gnome2-utils.eclass

eclass reference: gnome2-utils.eclass

kde5.eclass

eclass reference: kde5.eclass

  • kde5_pkg_preinst Function storing icon caches
  • kde5_pkg_postinst Function to rebuild the KDE System Configuration Cache after an application has been installed.
  • kde5_pkg_postrm Function to rebuild the KDE System Configuration Cache after an application has been removed.

fdo-mime.eclass (obsolete)

eclass reference: fdo-mime.eclass

fdo-mime is obsolete since 2017-06-19 see mail "[gentoo-dev] [PATCH] fdo-mime.eclass: Mark the eclass as deprecated".

See also bug #621914.

How to fix ebuilds which still inherit fdo-mime?

  1. emerge the ebuild
  2. test with equery f, if files were installed in one of the special folders of the table on the bottom.
  3. remove inherit fdo-mime
  4. add the new eclasses accordingly to the table. Like inherit xdg-utils
  5. if fdo-mime functions were substituted with the same xdg-utils functions no revision bump is required. Else make a revision bump.
  6. test with repoman

What repoman QA can detect

CODE
* QA Notice: .desktop files with MimeType= were found installed
 * but desktop mimeinfo cache has not been updated:
 *   /usr/share/applications/SciTE.desktop
 * Please make sure to call xdg_desktop_database_update()
 * in pkg_postinst() and pkg_postrm() phases of appropriate pkgs.

Code examples to create icons

CODE
<syntaxhighlight lang="bash">src_install() {
    local i
    for i in 16x16 22x22 32x32 48x48 64x64 128x128; do
        newicon -s ${i} utilities/${PN}${i}.png ${PN}.png
    done
}</syntaxhighlight>

.desktop files

brainstorming section (delete later, when merged in the text)

This page provides a summary of various files whose installation should be accompanied by appropriate postinst/postrm trigger calls.

Path Conditions preinst prerm postrm postinst
xdg-utils.eclass (or automatic in xdg.eclass)
/usr/share/applicationsif MimeType= is specified--xdg_desktop_database_updatexdg_desktop_database_update
/usr/share/mime--xdg_mimeinfo_database_updatexdg_mimeinfo_database_update
/usr/share/icons--xdg_icon_cache_updatexdg_icon_cache_update
gnome2-utils.eclass (or automatic in gnome2.eclass)
/etc/gconf/schemas/gnome2_gconf_savelist--gnome2_gconf_install
/usr/share/glib-2.0/schemasgnome2_schemas_savelist-gnome2_schemas_updategnome2_schemas_update
/usr/share/omfgnome2_scrollkeeper_savelist-gnome2_scrollkeeper_updategnome2_scrollkeeper_update
/usr/lib*/gdk-pixbuf-2.0gnome2_gdk_pixbuf_savelist--gnome2_gdk_pixbuf_update
/usr/lib*/gio/modules--gnome2_giomodule_cache_updategnome2_giomodule_cache_update
  • *1) Not needed in general, but still useful to use in phase defining eclasses, like gnome2.eclass.
  • Needs to be updated since some savelists are not needed
  • what about fonts?

Working principle of a trigger in bash

CODE
<syntaxhighlight lang="bash">while read type file; do
	case "${file}" in
		/usr/share/ca-certificates/*.crt)
			update-ca-certificates
			break
		;;
	esac
done < "${TEMP}/files"</syntaxhighlight>


This article is issued from Gentoo. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.