Gentoo Archives: gentoo-dev

From: "Marty E. Plummer" <hanetzer@×××××××××.com>
To: gentoo-dev@l.g.o
Cc: "Marty E. Plummer" <hanetzer@×××××××××.com>
Subject: [gentoo-dev] [PATCH 01/10] gnome2-utils: move icon functions into xdg-utils
Date: Wed, 27 Jun 2018 01:29:07
Message-Id: 20180627012734.1319-2-hanetzer@startmail.com
In Reply to: [gentoo-dev] [PATCH 00/10] {gnome2,xdg}{,-utils}.eclass: EAPI 7 work by "Marty E. Plummer"
1 Kept some dummy stub functions in place in order to maintain
2 functionality of existing ebuilds.
3
4 Package-Manager: Portage-2.3.40, Repoman-2.3.9
5 ---
6 eclass/gnome2-utils.eclass | 56 ++---------------------------------
7 eclass/xdg-utils.eclass | 60 +++++++++++++++++++++++++++++++++++++-
8 2 files changed, 62 insertions(+), 54 deletions(-)
9
10 diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass
11 index 65076ae2d61..1597ac4ad08 100644
12 --- a/eclass/gnome2-utils.eclass
13 +++ b/eclass/gnome2-utils.eclass
14 @@ -1,4 +1,4 @@
15 -# Copyright 1999-2015 Gentoo Foundation
16 +# Copyright 1999-2018 Gentoo Foundation
17 # Distributed under the terms of the GNU General Public License v2
18
19 # @ECLASS: gnome2-utils.eclass
20 @@ -40,12 +40,6 @@ esac
21 # Path to scrollkeeper-update
22 : ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"}
23
24 -# @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE
25 -# @INTERNAL
26 -# @DESCRIPTION:
27 -# Path to gtk-update-icon-cache
28 -: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"}
29 -
30 # @ECLASS-VARIABLE: GLIB_COMPILE_SCHEMAS
31 # @INTERNAL
32 # @DESCRIPTION:
33 @@ -221,53 +215,9 @@ gnome2_icon_savelist() {
34 # @FUNCTION: gnome2_icon_cache_update
35 # @DESCRIPTION:
36 # Updates Gtk+ icon cache files under /usr/share/icons.
37 -# This function should be called from pkg_postinst and pkg_postrm.
38 +# Deprecated. Please use xdg_icon_cache_update from xdg-utils.eclass
39 gnome2_icon_cache_update() {
40 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
41 - local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}"
42 -
43 - if [[ ! -x "${updater}" ]] ; then
44 - debug-print "${updater} is not executable"
45 - return
46 - fi
47 -
48 - ebegin "Updating icons cache"
49 -
50 - local retval=0
51 - local fails=( )
52 -
53 - for dir in "${EROOT%/}"/usr/share/icons/*
54 - do
55 - if [[ -f "${dir}/index.theme" ]] ; then
56 - local rv=0
57 -
58 - "${updater}" -qf "${dir}"
59 - rv=$?
60 -
61 - if [[ ! $rv -eq 0 ]] ; then
62 - debug-print "Updating cache failed on ${dir}"
63 -
64 - # Add to the list of failures
65 - fails+=( "${dir}" )
66 -
67 - retval=2
68 - fi
69 - elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then
70 - # Clear stale cache files after theme uninstallation
71 - rm "${dir}/icon-theme.cache"
72 - fi
73 -
74 - if [[ -z $(ls "${dir}") ]]; then
75 - # Clear empty theme directories after theme uninstallation
76 - rmdir "${dir}"
77 - fi
78 - done
79 -
80 - eend ${retval}
81 -
82 - for f in "${fails[@]}" ; do
83 - eerror "Failed to update cache with icon $f"
84 - done
85 + xdg_icon_cache_update
86 }
87
88 # @FUNCTION: gnome2_omf_fix
89 diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
90 index ac075185d8e..f9088d9c348 100644
91 --- a/eclass/xdg-utils.eclass
92 +++ b/eclass/xdg-utils.eclass
93 @@ -1,4 +1,4 @@
94 -# Copyright 1999-2017 Gentoo Foundation
95 +# Copyright 1999-2018 Gentoo Foundation
96 # Distributed under the terms of the GNU General Public License v2
97
98 # @ECLASS: xdg-utils.eclass
99 @@ -31,6 +31,12 @@ esac
100 # Directory where .desktop files database is stored
101 : ${DESKTOP_DATABASE_DIR="/usr/share/applications"}
102
103 +# @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE
104 +# @INTERNAL
105 +# @DESCRIPTION:
106 +# Path to gtk-update-icon-cache
107 +: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"}
108 +
109 # @ECLASS-VARIABLE: MIMEINFO_DATABASE_UPDATE_BIN
110 # @INTERNAL
111 # @DESCRIPTION:
112 @@ -82,6 +88,58 @@ xdg_desktop_database_update() {
113 eend $?
114 }
115
116 +# @FUNCTION: xdg_icon_cache_update
117 +# @DESCRIPTION:
118 +# Updates Gtk+ icon cache files under /usr/share/icons.
119 +# This function should be called from pkg_postinst and pkg_postrm.
120 +xdg_icon_cache_update() {
121 + has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
122 + local updater="${EROOT%/}${GTK_UPDATE_ICON_CACHE}"
123 +
124 + if [[ ! -x "${updater}" ]]; then
125 + debug-print "${updater} is not executable"
126 + return
127 + fi
128 +
129 + ebegin "Updating icons cache"
130 +
131 + local retval=0
132 + local fails=( )
133 +
134 + for dir in "${EROOT%/}"/usr/share/icons/*
135 + do
136 + if [[ -f "${dir}/index.theme" ]] ; then
137 + local rv=0
138 +
139 + "${updater}" -qf "${dir}"
140 + rv=$?
141 +
142 + if [[ ! $rv -eq 0 ]] ; then
143 + debug-print "Updating cache failed on ${dir}"
144 +
145 + # Add to the list of failures
146 + fails+=( "${dir}" )
147 +
148 + retval=2
149 + fi
150 + elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then
151 + # Clear stale cache files after theme uninstallation
152 + rm "${dir}/icon-theme.cache"
153 + fi
154 +
155 + if [[ -z $(ls "${dir}") ]]; then
156 + # Clear empty theme directories after theme uninstallation
157 + rmdir "${dir}"
158 + fi
159 + done
160 +
161 + eend ${retval}
162 +
163 + for f in "${fails[@]}" ; do
164 + eerror "Failed to update cache with icon $f"
165 + done
166 +}
167 +
168 # @FUNCTION: xdg_mimeinfo_database_update
169 # @DESCRIPTION:
170 # Update the mime database.
171 --
172 2.17.1

Replies