Avoid calling binaries that may have been compiled against different
libraries or even cross-compiled for an incomatible arch.

Also drop the related eclass variables: these are currently unused by
any ebuild.

Signed-off-by: Mike Gilbert <[email protected]>
---
 eclass/xdg-utils.eclass | 28 ++++++----------------------
 1 file changed, 6 insertions(+), 22 deletions(-)

diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
index fe1eef213ea4..d46fe9b80759 100644
--- a/eclass/xdg-utils.eclass
+++ b/eclass/xdg-utils.eclass
@@ -20,24 +20,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: 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:
@@ -67,19 +55,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 $?
 }
 
@@ -88,18 +74,16 @@ xdg_desktop_database_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 $?
 }
-- 
2.19.0


Reply via email to