Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Fri, 02 Jul 2021 15:35:41
Message-Id: 1625239951.a0d070c292bfc9496d746664590fa5479a2ee7cd.floppym@gentoo
1 commit: a0d070c292bfc9496d746664590fa5479a2ee7cd
2 Author: David Michael <fedora.dm0 <AT> gmail <DOT> com>
3 AuthorDate: Fri Jun 25 16:21:37 2021 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 2 15:32:31 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a0d070c2
7
8 xdg-utils.eclass: EAPI 8 support
9
10 Also standardize on one conditional block spacing syntax, drop some
11 redundant local variables, and remove banned EAPIs.
12
13 Signed-off-by: David Michael <fedora.dm0 <AT> gmail.com>
14 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
15
16 eclass/xdg-utils.eclass | 38 +++++++++++++++++---------------------
17 1 file changed, 17 insertions(+), 21 deletions(-)
18
19 diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
20 index 738df865891..35084fc8164 100644
21 --- a/eclass/xdg-utils.eclass
22 +++ b/eclass/xdg-utils.eclass
23 @@ -1,4 +1,4 @@
24 -# Copyright 2004-2019 Gentoo Authors
25 +# Copyright 2004-2021 Gentoo Authors
26 # Distributed under the terms of the GNU General Public License v2
27
28 # @ECLASS: xdg-utils.eclass
29 @@ -7,7 +7,7 @@
30 # freedesktop-bugs@g.o
31 # @AUTHOR:
32 # Original author: Gilles Dartiguelongue <eva@g.o>
33 -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
34 +# @SUPPORTED_EAPIS: 5 6 7 8
35 # @BLURB: Auxiliary functions commonly used by XDG compliant packages.
36 # @DESCRIPTION:
37 # This eclass provides a set of auxiliary functions needed by most XDG
38 @@ -17,9 +17,9 @@
39 # * XDG .desktop files cache management
40 # * XDG mime information database management
41
42 -case "${EAPI:-0}" in
43 - 0|1|2|3|4|5|6|7) ;;
44 - *) die "EAPI=${EAPI} is not supported" ;;
45 +case ${EAPI} in
46 + 5|6|7|8) ;;
47 + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
48 esac
49
50 # @ECLASS-VARIABLE: DESKTOP_DATABASE_DIR
51 @@ -57,7 +57,7 @@ xdg_environment_reset() {
52 # Updates the .desktop files database.
53 # Generates a list of mimetypes linked to applications that can handle them
54 xdg_desktop_database_update() {
55 - if [[ ${EBUILD_PHASE} != post* ]] ; then
56 + if [[ ${EBUILD_PHASE} != post* ]]; then
57 die "xdg_desktop_database_update must be used in pkg_post* phases."
58 fi
59
60 @@ -76,7 +76,7 @@ xdg_desktop_database_update() {
61 # Updates icon theme cache files under /usr/share/icons.
62 # This function should be called from pkg_postinst and pkg_postrm.
63 xdg_icon_cache_update() {
64 - if [[ ${EBUILD_PHASE} != post* ]] ; then
65 + if [[ ${EBUILD_PHASE} != post* ]]; then
66 die "xdg_icon_cache_update must be used in pkg_post* phases."
67 fi
68
69 @@ -86,21 +86,17 @@ xdg_icon_cache_update() {
70 fi
71
72 ebegin "Updating icons cache"
73 - local dir f retval=0
74 - local fails=( )
75 - for dir in "${EROOT%/}"/usr/share/icons/*
76 - do
77 - if [[ -f "${dir}/index.theme" ]] ; then
78 - local rv=0
79 - gtk-update-icon-cache -qf "${dir}"
80 - rv=$?
81 - if [[ ! $rv -eq 0 ]] ; then
82 + local dir retval=0
83 + local fails=()
84 + for dir in "${EROOT%/}"/usr/share/icons/*; do
85 + if [[ -f ${dir}/index.theme ]]; then
86 + if ! gtk-update-icon-cache -qf "${dir}"; then
87 debug-print "Updating cache failed on ${dir}"
88 # Add to the list of failures
89 - fails+=( "${dir}" )
90 + fails+=("${dir}")
91 retval=2
92 fi
93 - elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then
94 + elif [[ $(ls "${dir}") = icon-theme.cache ]]; then
95 # Clear stale cache files after theme uninstallation
96 rm "${dir}/icon-theme.cache"
97 fi
98 @@ -110,8 +106,8 @@ xdg_icon_cache_update() {
99 fi
100 done
101 eend ${retval}
102 - for f in "${fails[@]}" ; do
103 - eerror "Failed to update cache with icon $f"
104 + for dir in "${fails[@]}"; do
105 + eerror "Failed to update cache with icon ${dir}"
106 done
107 }
108
109 @@ -120,7 +116,7 @@ xdg_icon_cache_update() {
110 # Update the mime database.
111 # Creates a general list of mime types from several sources
112 xdg_mimeinfo_database_update() {
113 - if [[ ${EBUILD_PHASE} != post* ]] ; then
114 + if [[ ${EBUILD_PHASE} != post* ]]; then
115 die "xdg_mimeinfo_database_update must be used in pkg_post* phases."
116 fi