Gentoo Archives: gentoo-dev

From: David Michael <fedora.dm0@×××××.com>
To: gentoo-dev@l.g.o
Cc: gnome@g.o, freedesktop-bugs@g.o
Subject: [gentoo-dev] [PATCH 1/2] xdg-utils.eclass: EAPI 8 support
Date: Fri, 25 Jun 2021 16:34:04
Message-Id: 87fsx5ucng.fsf@gmail.com
1 Also standardize on one conditional block spacing syntax and drop
2 some redundant local variables.
3
4 Signed-off-by: David Michael <fedora.dm0@×××××.com>
5 ---
6
7 Hi,
8
9 Here are some EAPI updates for GNOMEy eclasses. This one in particular
10 would benefit from IDEPEND as most of its functions run native programs
11 at pkg_post* time.
12
13 Thanks.
14
15 David
16
17 eclass/xdg-utils.eclass | 36 ++++++++++++++++--------------------
18 1 file changed, 16 insertions(+), 20 deletions(-)
19
20 diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
21 index 738df865891..8b627d33cc6 100644
22 --- a/eclass/xdg-utils.eclass
23 +++ b/eclass/xdg-utils.eclass
24 @@ -1,4 +1,4 @@
25 -# Copyright 2004-2019 Gentoo Authors
26 +# Copyright 2004-2021 Gentoo Authors
27 # Distributed under the terms of the GNU General Public License v2
28
29 # @ECLASS: xdg-utils.eclass
30 @@ -7,7 +7,7 @@
31 # freedesktop-bugs@g.o
32 # @AUTHOR:
33 # Original author: Gilles Dartiguelongue <eva@g.o>
34 -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
35 +# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7 8
36 # @BLURB: Auxiliary functions commonly used by XDG compliant packages.
37 # @DESCRIPTION:
38 # This eclass provides a set of auxiliary functions needed by most XDG
39 @@ -17,9 +17,9 @@
40 # * XDG .desktop files cache management
41 # * XDG mime information database management
42
43 -case "${EAPI:-0}" in
44 - 0|1|2|3|4|5|6|7) ;;
45 - *) die "EAPI=${EAPI} is not supported" ;;
46 +case ${EAPI} in
47 + 0|1|2|3|4|5|6|7|8) ;;
48 + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
49 esac
50
51 # @ECLASS-VARIABLE: DESKTOP_DATABASE_DIR
52 @@ -57,7 +57,7 @@ xdg_environment_reset() {
53 # Updates the .desktop files database.
54 # Generates a list of mimetypes linked to applications that can handle them
55 xdg_desktop_database_update() {
56 - if [[ ${EBUILD_PHASE} != post* ]] ; then
57 + if [[ ${EBUILD_PHASE} != post* ]]; then
58 die "xdg_desktop_database_update must be used in pkg_post* phases."
59 fi
60
61 @@ -76,7 +76,7 @@ xdg_desktop_database_update() {
62 # Updates icon theme cache files under /usr/share/icons.
63 # This function should be called from pkg_postinst and pkg_postrm.
64 xdg_icon_cache_update() {
65 - if [[ ${EBUILD_PHASE} != post* ]] ; then
66 + if [[ ${EBUILD_PHASE} != post* ]]; then
67 die "xdg_icon_cache_update must be used in pkg_post* phases."
68 fi
69
70 @@ -86,21 +86,17 @@ xdg_icon_cache_update() {
71 fi
72
73 ebegin "Updating icons cache"
74 - local dir f retval=0
75 - local fails=( )
76 - for dir in "${EROOT%/}"/usr/share/icons/*
77 - do
78 - if [[ -f "${dir}/index.theme" ]] ; then
79 - local rv=0
80 - gtk-update-icon-cache -qf "${dir}"
81 - rv=$?
82 - if [[ ! $rv -eq 0 ]] ; then
83 + local dir retval=0
84 + local fails=()
85 + for dir in "${EROOT%/}"/usr/share/icons/*; do
86 + if [[ -f ${dir}/index.theme ]]; then
87 + if ! gtk-update-icon-cache -qf "${dir}"; then
88 debug-print "Updating cache failed on ${dir}"
89 # Add to the list of failures
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
117
118 --
119 2.31.1

Replies

Subject Author
[gentoo-dev] Re: [PATCH 1/2] xdg-utils.eclass: EAPI 8 support David Michael <fedora.dm0@×××××.com>