summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarty E. Plummer <hanetzer@startmail.com>2019-01-01 16:19:20 -0600
committerMart Raudsepp <leio@gentoo.org>2019-02-11 19:13:58 +0200
commitb023adcba2abc9d28d9a72fcd78f6811dcad92e2 (patch)
tree8d1b15fa9f29ab685b48e83d3f132c401e609158 /eclass/xdg-utils.eclass
parentgnome2.eclass: move icon handling code to xdg.eclass (diff)
downloadgentoo-b023adcba2abc9d28d9a72fcd78f6811dcad92e2.tar.gz
gentoo-b023adcba2abc9d28d9a72fcd78f6811dcad92e2.tar.bz2
gentoo-b023adcba2abc9d28d9a72fcd78f6811dcad92e2.zip
xdg-utils: use path based lookup instead of hardcoded paths
Package-Manager: Portage-2.3.51, Repoman 2.3.11 Signed-off-by: Marty E. Plummer <hanetzer@startmail.com> Signed-off-by: Mart Raudsepp <leio@gentoo.org>
Diffstat (limited to 'eclass/xdg-utils.eclass')
-rw-r--r--eclass/xdg-utils.eclass47
1 files changed, 14 insertions, 33 deletions
diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
index 3c3a3e8227c0..c65c91c0cd2a 100644
--- a/eclass/xdg-utils.eclass
+++ b/eclass/xdg-utils.eclass
@@ -21,30 +21,12 @@ case "${EAPI:-0}" in
*) die "EAPI=${EAPI} is not supported" ;;
esac
-# @ECLASS-VARIABLE: DESKTOP_DATABASE_UPDATE_BIN
-# @INTERNAL
-# @DESCRIPTION:
-# Path to update-desktop-database
-: ${DESKTOP_DATABASE_UPDATE_BIN:="/usr/bin/update-desktop-database"}
-
# @ECLASS-VARIABLE: DESKTOP_DATABASE_DIR
# @INTERNAL
# @DESCRIPTION:
# Directory where .desktop files database is stored
: ${DESKTOP_DATABASE_DIR="/usr/share/applications"}
-# @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE
-# @INTERNAL
-# @DESCRIPTION:
-# Path to gtk-update-icon-cache
-: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"}
-
-# @ECLASS-VARIABLE: MIMEINFO_DATABASE_UPDATE_BIN
-# @INTERNAL
-# @DESCRIPTION:
-# Path to update-mime-database
-: ${MIMEINFO_DATABASE_UPDATE_BIN:="/usr/bin/update-mime-database"}
-
# @ECLASS-VARIABLE: MIMEINFO_DATABASE_DIR
# @INTERNAL
# @DESCRIPTION:
@@ -74,19 +56,17 @@ xdg_environment_reset() {
# Updates the .desktop files database.
# Generates a list of mimetypes linked to applications that can handle them
xdg_desktop_database_update() {
- local updater="${EROOT%/}${DESKTOP_DATABASE_UPDATE_BIN}"
-
if [[ ${EBUILD_PHASE} != post* ]] ; then
die "xdg_desktop_database_update must be used in pkg_post* phases."
fi
- if [[ ! -x "${updater}" ]] ; then
- debug-print "${updater} is not executable"
+ if ! type update-desktop-database &>/dev/null; then
+ debug-print "update-desktop-database is not found"
return
fi
ebegin "Updating .desktop files database"
- "${updater}" -q "${EROOT%/}${DESKTOP_DATABASE_DIR}"
+ update-desktop-database -q "${EROOT%/}${DESKTOP_DATABASE_DIR}"
eend $?
}
@@ -95,12 +75,15 @@ xdg_desktop_database_update() {
# Updates Gtk+ icon cache files under /usr/share/icons.
# This function should be called from pkg_postinst and pkg_postrm.
xdg_icon_cache_update() {
- has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
- local updater="${EROOT%/}${GTK_UPDATE_ICON_CACHE}"
- if [[ ! -x "${updater}" ]]; then
- debug-print "${updater} is not executable"
+ if [[ ${EBUILD_PHASE} != post* ]] ; then
+ die "xdg_icon_cache_update must be used in pkg_post* phases."
+ fi
+
+ if ! type gtk-update-icon-cache &>/dev/null; then
+ debug-print "gtk-update-icon-cache is not found"
return
fi
+
ebegin "Updating icons cache"
local retval=0
local fails=( )
@@ -108,7 +91,7 @@ xdg_icon_cache_update() {
do
if [[ -f "${dir}/index.theme" ]] ; then
local rv=0
- "${updater}" -qf "${dir}"
+ gtk-update-icon-cache -qf "${dir}"
rv=$?
if [[ ! $rv -eq 0 ]] ; then
debug-print "Updating cache failed on ${dir}"
@@ -136,18 +119,16 @@ xdg_icon_cache_update() {
# Update the mime database.
# Creates a general list of mime types from several sources
xdg_mimeinfo_database_update() {
- local updater="${EROOT%/}${MIMEINFO_DATABASE_UPDATE_BIN}"
-
if [[ ${EBUILD_PHASE} != post* ]] ; then
die "xdg_mimeinfo_database_update must be used in pkg_post* phases."
fi
- if [[ ! -x "${updater}" ]] ; then
- debug-print "${updater} is not executable"
+ if ! type update-mime-database &>/dev/null; then
+ debug-print "update-mime-database is not found"
return
fi
ebegin "Updating shared mime info database"
- "${updater}" "${EROOT%/}${MIMEINFO_DATABASE_DIR}"
+ update-mime-database "${EROOT%/}${MIMEINFO_DATABASE_DIR}"
eend $?
}