summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorGilles Dartiguelongue <eva@gentoo.org>2015-11-21 11:31:29 +0100
committerGilles Dartiguelongue <eva@gentoo.org>2015-11-24 22:56:16 +0100
commit3bdcae62e9f5c435e8f566c333f6ca01a7cdb21e (patch)
treeacfc2623e0dc2ec35fb870f161189d888c71bbc7 /eclass
parentxdg-utils.eclass: initial commit (diff)
downloadgentoo-3bdcae62e9f5c435e8f566c333f6ca01a7cdb21e.tar.gz
gentoo-3bdcae62e9f5c435e8f566c333f6ca01a7cdb21e.tar.bz2
gentoo-3bdcae62e9f5c435e8f566c333f6ca01a7cdb21e.zip
xdg.eclass: initial commit
Goal of this eclass is to end the inconsistent and often forgotten use of fdo-mime.eclass. Provides all needed phases for proper behavior. https://bugs.gentoo.org/show_bug.cgi?id=208047
Diffstat (limited to 'eclass')
-rw-r--r--eclass/xdg.eclass61
1 files changed, 61 insertions, 0 deletions
diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
new file mode 100644
index 000000000000..799d6a2076ad
--- /dev/null
+++ b/eclass/xdg.eclass
@@ -0,0 +1,61 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: xdg.eclass
+# @MAINTAINER:
+# freedesktop-bugs@gentoo.org
+# @AUTHOR:
+# Original author: Gilles Dartiguelongue <eva@gentoo.org>
+# @BLURB: Provides phases for XDG compliant packages.
+# @DESCRIPTION:
+# Utility eclass to update the desktop and shared mime info as laid
+# out in the freedesktop specs & implementations
+
+inherit xdg-utils
+
+case "${EAPI:-0}" in
+ 4|5|6)
+ EXPORT_FUNCTIONS src_prepare pkg_preinst pkg_postinst pkg_postrm
+ ;;
+ *) die "EAPI=${EAPI} is not supported" ;;
+esac
+
+DEPEND="
+ dev-util/desktop-file-utils
+ x11-misc/shared-mime-info
+"
+
+# @FUNCTION: xdg_src_prepare
+# @DESCRIPTION:
+# Prepare sources to work with XDG standards.
+xdg_src_prepare() {
+ xdg_environment_reset
+
+ has ${EAPI:-0} 6 && eapply_user
+}
+
+# @FUNCTION: xdg_pkg_preinst
+# @DESCRIPTION:
+# Finds .desktop and mime info files for later handling in pkg_postinst
+xdg_pkg_preinst() {
+ xdg_desktopfiles_savelist
+ xdg_mimeinfo_savelist
+}
+
+# @FUNCTION: xdg_pkg_postinst
+# @DESCRIPTION:
+# Handle desktop and mime info database updates.
+xdg_pkg_postinst() {
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+}
+
+# @FUNCTION: xdg_pkg_postrm
+# @DESCRIPTION:
+# Handle desktop and mime info database updates.
+xdg_pkg_postrm() {
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+}
+