[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    [gentoo-dev] [PATCH 03/10] xdg-utils.eclass: make EAPI 7 ready
From:       "Marty E. Plummer" <hanetzer () startmail ! com>
Date:       2018-06-27 1:27:27
Message-ID: 20180627012734.1319-4-hanetzer () startmail ! com
[Download RAW message or body]

Use ${EROOT%/} whereever possible, as the tools and directories which
are used with it are already prefixed with a /
Use BROOT to specify path to update-mime-database and friends, setting
that to EROOT when not EAPI 7

Package-Manager: Portage-2.3.40, Repoman-2.3.9
---
 eclass/xdg-utils.eclass | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
index f9088d9c348..9e4d4638e38 100644
--- a/eclass/xdg-utils.eclass
+++ b/eclass/xdg-utils.eclass
@@ -72,7 +72,8 @@ 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}"
+	[[ ${EAPI:-0} == [0123456] ]] && BROOT=${EROOT}
+	local updater="${BROOT%/}${DESKTOP_DATABASE_UPDATE_BIN}"
 
 	if [[ ${EBUILD_PHASE} != post* ]] ; then
 		die "xdg_desktop_database_update must be used in pkg_post* phases."
@@ -84,7 +85,7 @@ xdg_desktop_database_update() {
 	fi
 
 	ebegin "Updating .desktop files database"
-	"${updater}" -q "${EROOT}${DESKTOP_DATABASE_DIR}"
+	"${updater}" -q "${EROOT%/}${DESKTOP_DATABASE_DIR}"
 	eend $?
 }
 
@@ -93,8 +94,8 @@ 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}"
+	[[ ${EAPI:-0} == [0123456] ]] && BROOT=${EROOT}
+	local updater="${BROOT%/}${GTK_UPDATE_ICON_CACHE}"
 
 	if [[ ! -x "${updater}" ]]; then
 		debug-print "${updater} is not executable"
@@ -145,7 +146,8 @@ 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}"
+	[[ ${EAPI:-0} == [0123456] ]] && BROOT=${EROOT}
+	local updater="${BROOT%/}${MIMEINFO_DATABASE_UPDATE_BIN}"
 
 	if [[ ${EBUILD_PHASE} != post* ]] ; then
 		die "xdg_mimeinfo_database_update must be used in pkg_post* phases."
@@ -157,6 +159,6 @@ xdg_mimeinfo_database_update() {
 	fi
 
 	ebegin "Updating shared mime info database"
-	"${updater}" "${EROOT}${MIMEINFO_DATABASE_DIR}"
+	"${updater}" "${EROOT%/}${MIMEINFO_DATABASE_DIR}"
 	eend $?
 }
-- 
2.17.1


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic