public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mike Gilbert <floppym@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: freedesktop-bugs@gentoo.org
Subject: [gentoo-dev] [PATCH] xdg-utils.eclass: execute tools from PATH
Date: Wed,  3 Oct 2018 09:14:04 -0400	[thread overview]
Message-ID: <20181003131404.3397-1-floppym@gentoo.org> (raw)

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



                 reply	other threads:[~2018-10-03 13:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181003131404.3397-1-floppym@gentoo.org \
    --to=floppym@gentoo.org \
    --cc=freedesktop-bugs@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox