public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] xdg-utils.eclass: execute tools from PATH
@ 2018-10-03 13:14 Mike Gilbert
  0 siblings, 0 replies; only message in thread
From: Mike Gilbert @ 2018-10-03 13:14 UTC (permalink / raw
  To: gentoo-dev; +Cc: freedesktop-bugs

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 <floppym@gentoo.org>
---
 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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-10-03 13:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-03 13:14 [gentoo-dev] [PATCH] xdg-utils.eclass: execute tools from PATH Mike Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox