Also standardize on one conditional block spacing syntax and drop some redundant local variables.
Signed-off-by: David Michael <fedora....@gmail.com> --- Hi, Here are some EAPI updates for GNOMEy eclasses. This one in particular would benefit from IDEPEND as most of its functions run native programs at pkg_post* time. Thanks. David eclass/xdg-utils.eclass | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass index 738df865891..8b627d33cc6 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 @@ # freedesktop-b...@gentoo.org # @AUTHOR: # Original author: Gilles Dartiguelongue <e...@gentoo.org> -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7 +# @SUPPORTED_EAPIS: 0 1 2 3 4 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 + 0|1|2|3|4|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}" ) 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 -- 2.31.1