commit: a0d070c292bfc9496d746664590fa5479a2ee7cd Author: David Michael <fedora.dm0 <AT> gmail <DOT> com> AuthorDate: Fri Jun 25 16:21:37 2021 +0000 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> CommitDate: Fri Jul 2 15:32:31 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a0d070c2
xdg-utils.eclass: EAPI 8 support Also standardize on one conditional block spacing syntax, drop some redundant local variables, and remove banned EAPIs. Signed-off-by: David Michael <fedora.dm0 <AT> gmail.com> Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org> eclass/xdg-utils.eclass | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass index 738df865891..35084fc8164 100644 --- a/eclass/xdg-utils.eclass +++ b/eclass/xdg-utils.eclass @@ -1,4 +1,4 @@ -# Copyright 2004-2019 Gentoo Authors +# Copyright 2004-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: xdg-utils.eclass @@ -7,7 +7,7 @@ # [email protected] # @AUTHOR: # Original author: Gilles Dartiguelongue <[email protected]> -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7 +# @SUPPORTED_EAPIS: 5 6 7 8 # @BLURB: Auxiliary functions commonly used by XDG compliant packages. # @DESCRIPTION: # This eclass provides a set of auxiliary functions needed by most XDG @@ -17,9 +17,9 @@ # * XDG .desktop files cache management # * XDG mime information database management -case "${EAPI:-0}" in - 0|1|2|3|4|5|6|7) ;; - *) die "EAPI=${EAPI} is not supported" ;; +case ${EAPI} in + 5|6|7|8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac # @ECLASS-VARIABLE: DESKTOP_DATABASE_DIR @@ -57,7 +57,7 @@ xdg_environment_reset() { # Updates the .desktop files database. # Generates a list of mimetypes linked to applications that can handle them xdg_desktop_database_update() { - if [[ ${EBUILD_PHASE} != post* ]] ; then + if [[ ${EBUILD_PHASE} != post* ]]; then die "xdg_desktop_database_update must be used in pkg_post* phases." fi @@ -76,7 +76,7 @@ xdg_desktop_database_update() { # Updates icon theme cache files under /usr/share/icons. # This function should be called from pkg_postinst and pkg_postrm. xdg_icon_cache_update() { - if [[ ${EBUILD_PHASE} != post* ]] ; then + if [[ ${EBUILD_PHASE} != post* ]]; then die "xdg_icon_cache_update must be used in pkg_post* phases." fi @@ -86,21 +86,17 @@ xdg_icon_cache_update() { fi ebegin "Updating icons cache" - local dir f retval=0 - local fails=( ) - for dir in "${EROOT%/}"/usr/share/icons/* - do - if [[ -f "${dir}/index.theme" ]] ; then - local rv=0 - gtk-update-icon-cache -qf "${dir}" - rv=$? - if [[ ! $rv -eq 0 ]] ; then + local dir retval=0 + local fails=() + for dir in "${EROOT%/}"/usr/share/icons/*; do + if [[ -f ${dir}/index.theme ]]; then + if ! gtk-update-icon-cache -qf "${dir}"; then debug-print "Updating cache failed on ${dir}" # Add to the list of failures - fails+=( "${dir}" ) + fails+=("${dir}") retval=2 fi - elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then + elif [[ $(ls "${dir}") = icon-theme.cache ]]; then # Clear stale cache files after theme uninstallation rm "${dir}/icon-theme.cache" fi @@ -110,8 +106,8 @@ xdg_icon_cache_update() { fi done eend ${retval} - for f in "${fails[@]}" ; do - eerror "Failed to update cache with icon $f" + for dir in "${fails[@]}"; do + eerror "Failed to update cache with icon ${dir}" done } @@ -120,7 +116,7 @@ xdg_icon_cache_update() { # Update the mime database. # Creates a general list of mime types from several sources xdg_mimeinfo_database_update() { - if [[ ${EBUILD_PHASE} != post* ]] ; then + if [[ ${EBUILD_PHASE} != post* ]]; then die "xdg_mimeinfo_database_update must be used in pkg_post* phases." fi
