summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Michael <fedora.dm0@gmail.com>2021-06-25 12:21:37 -0400
committerMike Gilbert <floppym@gentoo.org>2021-07-02 11:32:31 -0400
commita0d070c292bfc9496d746664590fa5479a2ee7cd (patch)
tree2ce42097537e0a806fbec465e9c5405e40da0d51
parentudev.eclass: EAPI 8 support (diff)
downloadgentoo-a0d070c2.tar.gz
gentoo-a0d070c2.tar.bz2
gentoo-a0d070c2.zip
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@gmail.com> Signed-off-by: Mike Gilbert <floppym@gentoo.org>
-rw-r--r--eclass/xdg-utils.eclass38
1 files changed, 17 insertions, 21 deletions
diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
index 738df8658910..35084fc8164d 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-bugs@gentoo.org
# @AUTHOR:
# Original author: Gilles Dartiguelongue <eva@gentoo.org>
-# @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