summaryrefslogtreecommitdiff
path: root/eclass/xdg.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-02-16 12:59:29 +0000
committerV3n3RiX <venerix@redcorelinux.org>2019-02-16 12:59:29 +0000
commit79599515788b85b18aa655e7b7f8cc05c1bbddd8 (patch)
treeade7cb031f363fad64c77139dea7aa3d81908537 /eclass/xdg.eclass
parent6bc2e4d7c5906e46a8f275a876ead6ec41aca5bb (diff)
gentoo resync : 16.02.1018
Diffstat (limited to 'eclass/xdg.eclass')
-rw-r--r--eclass/xdg.eclass43
1 files changed, 29 insertions, 14 deletions
diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
index 9ee771223dc0..219be712e84d 100644
--- a/eclass/xdg.eclass
+++ b/eclass/xdg.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: xdg.eclass
@@ -6,16 +6,16 @@
# freedesktop-bugs@gentoo.org
# @AUTHOR:
# Original author: Gilles Dartiguelongue <eva@gentoo.org>
-# @SUPPORTED_EAPIS: 4 5 6
+# @SUPPORTED_EAPIS: 4 5 6 7
# @BLURB: Provides phases for XDG compliant packages.
# @DESCRIPTION:
-# Utility eclass to update the desktop and shared mime info as laid
+# Utility eclass to update the desktop, icon and shared mime info as laid
# out in the freedesktop specs & implementations
inherit xdg-utils
case "${EAPI:-0}" in
- 4|5|6)
+ 4|5|6|7)
EXPORT_FUNCTIONS src_prepare pkg_preinst pkg_postinst pkg_postrm
;;
*) die "EAPI=${EAPI} is not supported" ;;
@@ -35,33 +35,36 @@ fi
xdg_src_prepare() {
xdg_environment_reset
- has ${EAPI:-0} 6 && default
+ [[ ${EAPI:-0} != [45] ]] && default
}
# @FUNCTION: xdg_pkg_preinst
# @DESCRIPTION:
-# Finds .desktop and mime info files for later handling in pkg_postinst.
-# Locations are stored in XDG_ECLASS_DESKTOPFILES and XDG_ECLASS_MIMEINFOFILES
-# respectively.
+# Finds .desktop, icon and mime info files for later handling in pkg_postinst.
+# Locations are stored in XDG_ECLASS_DESKTOPFILES, XDG_ECLASS_ICONFILES
+# and XDG_ECLASS_MIMEINFOFILES respectively.
xdg_pkg_preinst() {
local f
XDG_ECLASS_DESKTOPFILES=()
while IFS= read -r -d '' f; do
XDG_ECLASS_DESKTOPFILES+=( ${f} )
- done < <(cd "${D}" && find 'usr/share/applications' -type f -print0 2>/dev/null)
+ done < <(cd "${ED}" && find 'usr/share/applications' -type f -print0 2>/dev/null)
+
+ XDG_ECLASS_ICONFILES=()
+ while IFS= read -r -d '' f; do
+ XDG_ECLASS_ICONFILES+=( ${f} )
+ done < <(cd "${ED}" && find 'usr/share/icons' -type f -print0 2>/dev/null)
XDG_ECLASS_MIMEINFOFILES=()
while IFS= read -r -d '' f; do
XDG_ECLASS_MIMEINFOFILES+=( ${f} )
- done < <(cd "${D}" && find 'usr/share/mime' -type f -print0 2>/dev/null)
-
- export XDG_ECLASS_DESKTOPFILES XDG_ECLASS_MIMEINFOFILES
+ done < <(cd "${ED}" && find 'usr/share/mime' -type f -print0 2>/dev/null)
}
# @FUNCTION: xdg_pkg_postinst
# @DESCRIPTION:
-# Handle desktop and mime info database updates.
+# Handle desktop, icon and mime info database updates.
xdg_pkg_postinst() {
if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
xdg_desktop_database_update
@@ -69,6 +72,12 @@ xdg_pkg_postinst() {
debug-print "No .desktop files to add to database"
fi
+ if [[ ${#XDG_ECLASS_ICONFILES[@]} -gt 0 ]]; then
+ xdg_icon_cache_update
+ else
+ debug-print "No icon files to add to cache"
+ fi
+
if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
xdg_mimeinfo_database_update
else
@@ -78,7 +87,7 @@ xdg_pkg_postinst() {
# @FUNCTION: xdg_pkg_postrm
# @DESCRIPTION:
-# Handle desktop and mime info database updates.
+# Handle desktop, icon and mime info database updates.
xdg_pkg_postrm() {
if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
xdg_desktop_database_update
@@ -86,6 +95,12 @@ xdg_pkg_postrm() {
debug-print "No .desktop files to add to database"
fi
+ if [[ ${#XDG_ECLASS_ICONFILES[@]} -gt 0 ]]; then
+ xdg_icon_cache_update
+ else
+ debug-print "No icon files to add to cache"
+ fi
+
if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
xdg_mimeinfo_database_update
else