Gentoo Archives: gentoo-commits

From: Mart Raudsepp <leio@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Mon, 11 Feb 2019 17:18:56
Message-Id: 1549905234.a506c07df071f68613099e8b7e2b1f81c9ef97a1.leio@gentoo
1 commit: a506c07df071f68613099e8b7e2b1f81c9ef97a1
2 Author: Marty E. Plummer <hanetzer <AT> startmail <DOT> com>
3 AuthorDate: Tue Jan 1 22:19:06 2019 +0000
4 Commit: Mart Raudsepp <leio <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 11 17:13:54 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a506c07d
7
8 gnome2-utils: move icon functions into xdg-utils
9
10 Kept some dummy stub functions in place in order to maintain
11 functionality of existing ebuilds.
12
13 Package-Manager: Portage-2.3.51, Repoman 2.3.11
14 Signed-off-by: Marty E. Plummer <hanetzer <AT> startmail.com>
15 Signed-off-by: Mart Raudsepp <leio <AT> gentoo.org>
16
17 eclass/gnome2-utils.eclass | 57 +++-------------------------------------------
18 eclass/xdg-utils.eclass | 50 +++++++++++++++++++++++++++++++++++++++-
19 2 files changed, 52 insertions(+), 55 deletions(-)
20
21 diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass
22 index b2f536a45e9..41b3edbcd9b 100644
23 --- a/eclass/gnome2-utils.eclass
24 +++ b/eclass/gnome2-utils.eclass
25 @@ -1,4 +1,4 @@
26 -# Copyright 1999-2015 Gentoo Foundation
27 +# Copyright 1999-2019 Gentoo Authors
28 # Distributed under the terms of the GNU General Public License v2
29
30 # @ECLASS: gnome2-utils.eclass
31 @@ -10,7 +10,6 @@
32 # This eclass provides a set of auxiliary functions needed by most Gnome
33 # packages. It may be used by non-Gnome packages as needed for handling various
34 # Gnome stack related functions such as:
35 -# * Gtk+ icon cache management
36 # * GSettings schemas management
37 # * GConf schemas management
38 # * scrollkeeper (old Gnome help system) management
39 @@ -41,12 +40,6 @@ esac
40 # Path to scrollkeeper-update
41 : ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"}
42
43 -# @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE
44 -# @INTERNAL
45 -# @DESCRIPTION:
46 -# Path to gtk-update-icon-cache
47 -: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"}
48 -
49 # @ECLASS-VARIABLE: GLIB_COMPILE_SCHEMAS
50 # @INTERNAL
51 # @DESCRIPTION:
52 @@ -222,53 +215,9 @@ gnome2_icon_savelist() {
53 # @FUNCTION: gnome2_icon_cache_update
54 # @DESCRIPTION:
55 # Updates Gtk+ icon cache files under /usr/share/icons.
56 -# This function should be called from pkg_postinst and pkg_postrm.
57 +# Deprecated. Please use xdg_icon_cache_update from xdg-utils.eclass
58 gnome2_icon_cache_update() {
59 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
60 - local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}"
61 -
62 - if [[ ! -x "${updater}" ]] ; then
63 - debug-print "${updater} is not executable"
64 - return
65 - fi
66 -
67 - ebegin "Updating icons cache"
68 -
69 - local retval=0
70 - local fails=( )
71 -
72 - for dir in "${EROOT%/}"/usr/share/icons/*
73 - do
74 - if [[ -f "${dir}/index.theme" ]] ; then
75 - local rv=0
76 -
77 - "${updater}" -qf "${dir}"
78 - rv=$?
79 -
80 - if [[ ! $rv -eq 0 ]] ; then
81 - debug-print "Updating cache failed on ${dir}"
82 -
83 - # Add to the list of failures
84 - fails+=( "${dir}" )
85 -
86 - retval=2
87 - fi
88 - elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then
89 - # Clear stale cache files after theme uninstallation
90 - rm "${dir}/icon-theme.cache"
91 - fi
92 -
93 - if [[ -z $(ls "${dir}") ]]; then
94 - # Clear empty theme directories after theme uninstallation
95 - rmdir "${dir}"
96 - fi
97 - done
98 -
99 - eend ${retval}
100 -
101 - for f in "${fails[@]}" ; do
102 - eerror "Failed to update cache with icon $f"
103 - done
104 + xdg_icon_cache_update
105 }
106
107 # @FUNCTION: gnome2_omf_fix
108
109 diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
110 index fe1eef213ea..3c3a3e8227c 100644
111 --- a/eclass/xdg-utils.eclass
112 +++ b/eclass/xdg-utils.eclass
113 @@ -1,4 +1,4 @@
114 -# Copyright 1999-2017 Gentoo Foundation
115 +# Copyright 1999-2019 Gentoo Authors
116 # Distributed under the terms of the GNU General Public License v2
117
118 # @ECLASS: xdg-utils.eclass
119 @@ -12,6 +12,7 @@
120 # This eclass provides a set of auxiliary functions needed by most XDG
121 # compliant packages.
122 # It provides XDG stack related functions such as:
123 +# * Gtk+ icon cache management
124 # * XDG .desktop files cache management
125 # * XDG mime information database management
126
127 @@ -32,6 +33,12 @@ esac
128 # Directory where .desktop files database is stored
129 : ${DESKTOP_DATABASE_DIR="/usr/share/applications"}
130
131 +# @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE
132 +# @INTERNAL
133 +# @DESCRIPTION:
134 +# Path to gtk-update-icon-cache
135 +: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"}
136 +
137 # @ECLASS-VARIABLE: MIMEINFO_DATABASE_UPDATE_BIN
138 # @INTERNAL
139 # @DESCRIPTION:
140 @@ -83,6 +90,47 @@ xdg_desktop_database_update() {
141 eend $?
142 }
143
144 +# @FUNCTION: xdg_icon_cache_update
145 +# @DESCRIPTION:
146 +# Updates Gtk+ icon cache files under /usr/share/icons.
147 +# This function should be called from pkg_postinst and pkg_postrm.
148 +xdg_icon_cache_update() {
149 + has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
150 + local updater="${EROOT%/}${GTK_UPDATE_ICON_CACHE}"
151 + if [[ ! -x "${updater}" ]]; then
152 + debug-print "${updater} is not executable"
153 + return
154 + fi
155 + ebegin "Updating icons cache"
156 + local retval=0
157 + local fails=( )
158 + for dir in "${EROOT%/}"/usr/share/icons/*
159 + do
160 + if [[ -f "${dir}/index.theme" ]] ; then
161 + local rv=0
162 + "${updater}" -qf "${dir}"
163 + rv=$?
164 + if [[ ! $rv -eq 0 ]] ; then
165 + debug-print "Updating cache failed on ${dir}"
166 + # Add to the list of failures
167 + fails+=( "${dir}" )
168 + retval=2
169 + fi
170 + elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then
171 + # Clear stale cache files after theme uninstallation
172 + rm "${dir}/icon-theme.cache"
173 + fi
174 + if [[ -z $(ls "${dir}") ]]; then
175 + # Clear empty theme directories after theme uninstallation
176 + rmdir "${dir}"
177 + fi
178 + done
179 + eend ${retval}
180 + for f in "${fails[@]}" ; do
181 + eerror "Failed to update cache with icon $f"
182 + done
183 +}
184 +
185 # @FUNCTION: xdg_mimeinfo_database_update
186 # @DESCRIPTION:
187 # Update the mime database.