1 |
W dniu śro, 20.06.2018 o godzinie 02∶10 -0500, użytkownik Marty E. |
2 |
Plummer napisał: |
3 |
> Kept some dummy stub functions in place in order to maintain |
4 |
> functionality of existing ebuilds, along with a QA warning to migrate |
5 |
> from one eclass to the other. |
6 |
> --- |
7 |
> eclass/gnome2-utils.eclass | 73 ++++++---------------------------- |
8 |
> eclass/xdg-utils.eclass | 80 ++++++++++++++++++++++++++++++++++++++ |
9 |
> 2 files changed, 91 insertions(+), 62 deletions(-) |
10 |
> |
11 |
> diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass |
12 |
> index 14fb9e7420c..a355f0f4f13 100644 |
13 |
> --- a/eclass/gnome2-utils.eclass |
14 |
> +++ b/eclass/gnome2-utils.eclass |
15 |
> @@ -40,12 +40,6 @@ esac |
16 |
> # Path to scrollkeeper-update |
17 |
> : ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"} |
18 |
> |
19 |
> -# @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE |
20 |
> -# @INTERNAL |
21 |
> -# @DESCRIPTION: |
22 |
> -# Path to gtk-update-icon-cache |
23 |
> -: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"} |
24 |
> - |
25 |
> # @ECLASS-VARIABLE: GLIB_COMPILE_SCHEMAS |
26 |
> # @INTERNAL |
27 |
> # @DESCRIPTION: |
28 |
> @@ -203,68 +197,23 @@ gnome2_gconf_uninstall() { |
29 |
> |
30 |
> # @FUNCTION: gnome2_icon_savelist |
31 |
> # @DESCRIPTION: |
32 |
> -# Find the icons that are about to be installed and save their location |
33 |
> -# in the GNOME2_ECLASS_ICONS environment variable. This is only |
34 |
> -# necessary for eclass implementations that call |
35 |
> -# gnome2_icon_cache_update conditionally. |
36 |
> -# This function should be called from pkg_preinst. |
37 |
> +# Deprecated. Use xdg_icon_savelist from xdg-utils.eclass instead. |
38 |
> gnome2_icon_savelist() { |
39 |
> - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}" |
40 |
> - pushd "${ED}" > /dev/null || die |
41 |
> - export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null) |
42 |
> - popd > /dev/null || die |
43 |
> + eqawarn "QA warning: gnome2_icon_savelist has been moved to xdg-utils.eclass" |
44 |
> + eqawarn "and is now called xdg_icon_savelist. Please migrate your ebuild and" |
45 |
> + eqawarn "eclasses to use it" |
46 |
> + xdg_icon_savelist |
47 |
> + GNOME2_ECLASS_ICONS="${XDG_ECLASS_ICONS}" |
48 |
> } |
49 |
> |
50 |
> # @FUNCTION: gnome2_icon_cache_update |
51 |
> # @DESCRIPTION: |
52 |
> -# Updates Gtk+ icon cache files under /usr/share/icons. |
53 |
> -# This function should be called from pkg_postinst and pkg_postrm. |
54 |
> +# Deprecated. Use xdg_icon_cache_update from xdg-utils.eclass instead. |
55 |
> gnome2_icon_cache_update() { |
56 |
> - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" |
57 |
> - local updater="${EROOT%/}${GTK_UPDATE_ICON_CACHE}" |
58 |
> - |
59 |
> - if [[ ! -x "${updater}" ]] ; then |
60 |
> - debug-print "${updater} is not executable" |
61 |
> - return |
62 |
> - fi |
63 |
> - |
64 |
> - ebegin "Updating icons cache" |
65 |
> - |
66 |
> - local retval=0 |
67 |
> - local fails=( ) |
68 |
> - |
69 |
> - for dir in "${EROOT%/}"/usr/share/icons/* |
70 |
> - do |
71 |
> - if [[ -f "${dir}/index.theme" ]] ; then |
72 |
> - local rv=0 |
73 |
> - |
74 |
> - "${updater}" -qf "${dir}" |
75 |
> - rv=$? |
76 |
> - |
77 |
> - if [[ ! $rv -eq 0 ]] ; then |
78 |
> - debug-print "Updating cache failed on ${dir}" |
79 |
> - |
80 |
> - # Add to the list of failures |
81 |
> - fails+=( "${dir}" ) |
82 |
> - |
83 |
> - retval=2 |
84 |
> - fi |
85 |
> - elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then |
86 |
> - # Clear stale cache files after theme uninstallation |
87 |
> - rm "${dir}/icon-theme.cache" |
88 |
> - fi |
89 |
> - |
90 |
> - if [[ -z $(ls "${dir}") ]]; then |
91 |
> - # Clear empty theme directories after theme uninstallation |
92 |
> - rmdir "${dir}" |
93 |
> - fi |
94 |
> - done |
95 |
> - |
96 |
> - eend ${retval} |
97 |
> - |
98 |
> - for f in "${fails[@]}" ; do |
99 |
> - eerror "Failed to update cache with icon $f" |
100 |
> - done |
101 |
> + eqawarn "QA warning: gnome2_icon_cache_update has been moved to xdg-utils.eclass" |
102 |
> + eqawarn "and is now called xdg_icon_cache_update. Please migrate your ebuild and" |
103 |
> + eqawarn "eclasses to use it" |
104 |
> + xdg_icon_cache_update |
105 |
> } |
106 |
> |
107 |
> # @FUNCTION: gnome2_omf_fix |
108 |
|
109 |
1. Why not make those two fatal in EAPI 7? |
110 |
|
111 |
2. I don't think suddenly having a lot of ebuilds eqawarn about this |
112 |
in existing EAPIs is going to be productive. |
113 |
|
114 |
> diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass |
115 |
> index 8dba5ed6861..37e1893a701 100644 |
116 |
> --- a/eclass/xdg-utils.eclass |
117 |
> +++ b/eclass/xdg-utils.eclass |
118 |
> @@ -31,6 +31,12 @@ esac |
119 |
> # Directory where .desktop files database is stored |
120 |
> : ${DESKTOP_DATABASE_DIR="/usr/share/applications"} |
121 |
> |
122 |
> +# @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE |
123 |
> +# @INTERNAL |
124 |
> +# @DESCRIPTION: |
125 |
> +# Path to gtk-update-icon-cache |
126 |
> +: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"} |
127 |
> + |
128 |
> # @ECLASS-VARIABLE: MIMEINFO_DATABASE_UPDATE_BIN |
129 |
> # @INTERNAL |
130 |
> # @DESCRIPTION: |
131 |
> @@ -43,6 +49,12 @@ esac |
132 |
> # Directory where .desktop files database is stored |
133 |
> : ${MIMEINFO_DATABASE_DIR:="/usr/share/mime"} |
134 |
> |
135 |
> +# @ECLASS-VARIABLE: XDG_ECLASS_ICONS |
136 |
> +# @INTERNAL |
137 |
> +# @DEFAULT_UNSET |
138 |
> +# @DESCRIPTION: |
139 |
> +# List of icons provided by the package |
140 |
> + |
141 |
> # @FUNCTION: xdg_environment_reset |
142 |
> # @DESCRIPTION: |
143 |
> # Clean up environment for clean builds. |
144 |
> @@ -82,6 +94,74 @@ xdg_desktop_database_update() { |
145 |
> eend $? |
146 |
> } |
147 |
> |
148 |
> +# @FUNCTION: xdg_icon_savelist |
149 |
> +# @DESCRIPTION: |
150 |
> +# Find the icons that are about to be installed and save their location |
151 |
> +# in the XDG_ECLASS_ICONS environment variable. This is only |
152 |
> +# necessary for eclass implementations that call |
153 |
> +# xdg_icon_cache_update conditionally. |
154 |
> +# This function should be called from pkg_preinst. |
155 |
> +xdg_icon_savelist() { |
156 |
> + XDG_ECLASS_ICONS=() |
157 |
> + while IFS= read -r -d '' f; do |
158 |
> + XDG_ECLASS_ICONS+=( ${f} ) |
159 |
> + done < <(cd "${D}" && find 'usr/share/icons' -type f -print0 2>/dev/null) |
160 |
> + |
161 |
> + export XDG_ECLASS_ICONS |
162 |
> +} |
163 |
> + |
164 |
> +# @FUNCTION: xdg_icon_cache_update |
165 |
> +# @DESCRIPTION: |
166 |
> +# Updates Gtk+ icon cache files under /usr/share/icons. |
167 |
> +# This function should be called from pkg_postinst and pkg_postrm. |
168 |
> +xdg_icon_cache_update() { |
169 |
> + has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" |
170 |
> + local updater="${EROOT%/}${GTK_UPDATE_ICON_CACHE}" |
171 |
> + |
172 |
> + if [[ ! -x "${updater}" ]] ; then |
173 |
> + debug-print "${updater} is not executable" |
174 |
> + return |
175 |
> + fi |
176 |
> + |
177 |
> + ebegin "Updating icons cache" |
178 |
> + |
179 |
> + local retval=0 |
180 |
> + local fails=( ) |
181 |
> + |
182 |
> + for dir in "${EROOT%/}"/usr/share/icons/* |
183 |
> + do |
184 |
> + if [[ -f "${dir}/index.theme" ]] ; then |
185 |
> + local rv=0 |
186 |
> + |
187 |
> + "${updater}" -qf "${dir}" |
188 |
> + rv=$? |
189 |
> + |
190 |
> + if [[ ! $rv -eq 0 ]] ; then |
191 |
> + debug-print "Updating cache failed on ${dir}" |
192 |
> + |
193 |
> + # Add to the list of failures |
194 |
> + fails+=( "${dir}" ) |
195 |
> + |
196 |
> + retval=2 |
197 |
> + fi |
198 |
> + elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then |
199 |
> + # Clear stale cache files after theme uninstallation |
200 |
> + rm "${dir}/icon-theme.cache" |
201 |
> + fi |
202 |
> + |
203 |
> + if [[ -z $(ls "${dir}") ]]; then |
204 |
> + # Clear empty theme directories after theme uninstallation |
205 |
> + rmdir "${dir}" |
206 |
> + fi |
207 |
> + done |
208 |
> + |
209 |
> + eend ${retval} |
210 |
> + |
211 |
> + for f in "${fails[@]}" ; do |
212 |
> + eerror "Failed to update cache with icon $f" |
213 |
> + done |
214 |
> +} |
215 |
> + |
216 |
> # @FUNCTION: xdg_mimeinfo_database_update |
217 |
> # @DESCRIPTION: |
218 |
> # Update the mime database. |
219 |
|
220 |
-- |
221 |
Best regards, |
222 |
Michał Górny |