Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/kde:master commit in: eclass/
Date: Tue, 05 Feb 2019 19:47:28
Message-Id: 1549396029.8b54ba0db1427637bc97955246696be3389afa23.asturm@gentoo
1 commit: 8b54ba0db1427637bc97955246696be3389afa23
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Tue Feb 5 18:37:52 2019 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 5 19:47:09 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/kde.git/commit/?id=8b54ba0d
7
8 gnome2-utils.eclass, xdg-utils.eclass, xdg.eclass: Drop obsolete
9
10 What we need is now in kde5.eclass.
11
12 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
13
14 eclass/gnome2-utils.eclass | 474 ---------------------------------------------
15 eclass/xdg-utils.eclass | 134 -------------
16 eclass/xdg.eclass | 110 -----------
17 3 files changed, 718 deletions(-)
18
19 diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass
20 deleted file mode 100644
21 index 41b3edbcd9..0000000000
22 --- a/eclass/gnome2-utils.eclass
23 +++ /dev/null
24 @@ -1,474 +0,0 @@
25 -# Copyright 1999-2019 Gentoo Authors
26 -# Distributed under the terms of the GNU General Public License v2
27 -
28 -# @ECLASS: gnome2-utils.eclass
29 -# @MAINTAINER:
30 -# gnome@g.o
31 -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6
32 -# @BLURB: Auxiliary functions commonly used by Gnome packages.
33 -# @DESCRIPTION:
34 -# This eclass provides a set of auxiliary functions needed by most Gnome
35 -# packages. It may be used by non-Gnome packages as needed for handling various
36 -# Gnome stack related functions such as:
37 -# * GSettings schemas management
38 -# * GConf schemas management
39 -# * scrollkeeper (old Gnome help system) management
40 -
41 -[[ ${EAPI:-0} == [012345] ]] && inherit multilib
42 -inherit eutils xdg-utils
43 -
44 -case "${EAPI:-0}" in
45 - 0|1|2|3|4|5|6) ;;
46 - *) die "EAPI=${EAPI} is not supported" ;;
47 -esac
48 -
49 -# @ECLASS-VARIABLE: GCONFTOOL_BIN
50 -# @INTERNAL
51 -# @DESCRIPTION:
52 -# Path to gconftool-2
53 -: ${GCONFTOOL_BIN:="/usr/bin/gconftool-2"}
54 -
55 -# @ECLASS-VARIABLE: SCROLLKEEPER_DIR
56 -# @INTERNAL
57 -# @DESCRIPTION:
58 -# Directory where scrollkeeper-update should do its work
59 -: ${SCROLLKEEPER_DIR:="/var/lib/scrollkeeper"}
60 -
61 -# @ECLASS-VARIABLE: SCROLLKEEPER_UPDATE_BIN
62 -# @INTERNAL
63 -# @DESCRIPTION:
64 -# Path to scrollkeeper-update
65 -: ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"}
66 -
67 -# @ECLASS-VARIABLE: GLIB_COMPILE_SCHEMAS
68 -# @INTERNAL
69 -# @DESCRIPTION:
70 -# Path to glib-compile-schemas
71 -: ${GLIB_COMPILE_SCHEMAS:="/usr/bin/glib-compile-schemas"}
72 -
73 -# @ECLASS-VARIABLE: GNOME2_ECLASS_SCHEMAS
74 -# @INTERNAL
75 -# @DEFAULT_UNSET
76 -# @DESCRIPTION:
77 -# List of GConf schemas provided by the package
78 -
79 -# @ECLASS-VARIABLE: GNOME2_ECLASS_ICONS
80 -# @INTERNAL
81 -# @DEFAULT_UNSET
82 -# @DESCRIPTION:
83 -# List of icons provided by the package
84 -
85 -# @ECLASS-VARIABLE: GNOME2_ECLASS_SCROLLS
86 -# @INTERNAL
87 -# @DEFAULT_UNSET
88 -# @DESCRIPTION:
89 -# List of scrolls (documentation files) provided by the package
90 -
91 -# @ECLASS-VARIABLE: GNOME2_ECLASS_GLIB_SCHEMAS
92 -# @INTERNAL
93 -# @DEFAULT_UNSET
94 -# @DESCRIPTION:
95 -# List of GSettings schemas provided by the package
96 -
97 -# @ECLASS-VARIABLE: GNOME2_ECLASS_GDK_PIXBUF_LOADERS
98 -# @INTERNAL
99 -# @DEFAULT_UNSET
100 -# @DESCRIPTION:
101 -# List of gdk-pixbuf loaders provided by the package
102 -
103 -DEPEND=">=sys-apps/sed-4"
104 -
105 -
106 -# @FUNCTION: gnome2_environment_reset
107 -# @DESCRIPTION:
108 -# Reset various variables inherited from root's evironment to a reasonable
109 -# default for ebuilds to help avoid access violations and test failures.
110 -gnome2_environment_reset() {
111 - xdg_environment_reset
112 -
113 - # Respected by >=glib-2.30.1-r1
114 - export G_HOME="${T}"
115 -
116 - # GST_REGISTRY is to work around gst utilities trying to read/write /root
117 - export GST_REGISTRY="${T}/registry.xml"
118 -
119 - # Ensure we don't rely on dconf/gconf while building, bug #511946
120 - export GSETTINGS_BACKEND="memory"
121 -
122 - if has ${EAPI:-0} 6; then
123 - # Try to cover the packages honoring this variable, bug #508124
124 - export GST_INSPECT="$(type -P true)"
125 -
126 - # Stop relying on random DISPLAY variable values, bug #534312
127 - unset DISPLAY
128 - fi
129 -}
130 -
131 -# @FUNCTION: gnome2_gconf_savelist
132 -# @DESCRIPTION:
133 -# Find the GConf schemas that are about to be installed and save their location
134 -# in the GNOME2_ECLASS_SCHEMAS environment variable.
135 -# This function should be called from pkg_preinst.
136 -gnome2_gconf_savelist() {
137 - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
138 - pushd "${ED}" > /dev/null || die
139 - export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null)
140 - popd > /dev/null || die
141 -}
142 -
143 -# @FUNCTION: gnome2_gconf_install
144 -# @DESCRIPTION:
145 -# Applies any schema files installed by the current ebuild to Gconf's database
146 -# using gconftool-2.
147 -# This function should be called from pkg_postinst.
148 -gnome2_gconf_install() {
149 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
150 - local updater="${EROOT}${GCONFTOOL_BIN}"
151 -
152 - if [[ ! -x "${updater}" ]]; then
153 - debug-print "${updater} is not executable"
154 - return
155 - fi
156 -
157 - if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
158 - debug-print "No GNOME 2 GConf schemas found"
159 - return
160 - fi
161 -
162 - # We are ready to install the GCONF Scheme now
163 - unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
164 - export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")"
165 -
166 - einfo "Installing GNOME 2 GConf schemas"
167 -
168 - local F
169 - for F in ${GNOME2_ECLASS_SCHEMAS}; do
170 - if [[ -e "${EROOT}${F}" ]]; then
171 - debug-print "Installing schema: ${F}"
172 - "${updater}" --makefile-install-rule "${EROOT}${F}" 1>/dev/null
173 - fi
174 - done
175 -
176 - # have gconf reload the new schemas
177 - pids=$(pgrep -x gconfd-2)
178 - if [[ $? == 0 ]] ; then
179 - ebegin "Reloading GConf schemas"
180 - kill -HUP ${pids}
181 - eend $?
182 - fi
183 -}
184 -
185 -# @FUNCTION: gnome2_gconf_uninstall
186 -# @DESCRIPTION:
187 -# Removes schema files previously installed by the current ebuild from Gconf's
188 -# database.
189 -gnome2_gconf_uninstall() {
190 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
191 - local updater="${EROOT}${GCONFTOOL_BIN}"
192 -
193 - if [[ ! -x "${updater}" ]]; then
194 - debug-print "${updater} is not executable"
195 - return
196 - fi
197 -
198 - if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
199 - debug-print "No GNOME 2 GConf schemas found"
200 - return
201 - fi
202 -
203 - unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
204 - export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT};")"
205 -
206 - einfo "Uninstalling GNOME 2 GConf schemas"
207 -
208 - local F
209 - for F in ${GNOME2_ECLASS_SCHEMAS}; do
210 - if [[ -e "${EROOT}${F}" ]]; then
211 - debug-print "Uninstalling gconf schema: ${F}"
212 - "${updater}" --makefile-uninstall-rule "${EROOT}${F}" 1>/dev/null
213 - fi
214 - done
215 -
216 - # have gconf reload the new schemas
217 - pids=$(pgrep -x gconfd-2)
218 - if [[ $? == 0 ]] ; then
219 - ebegin "Reloading GConf schemas"
220 - kill -HUP ${pids}
221 - eend $?
222 - fi
223 -}
224 -
225 -# @FUNCTION: gnome2_icon_savelist
226 -# @DESCRIPTION:
227 -# Find the icons that are about to be installed and save their location
228 -# in the GNOME2_ECLASS_ICONS environment variable. This is only
229 -# necessary for eclass implementations that call
230 -# gnome2_icon_cache_update conditionally.
231 -# This function should be called from pkg_preinst.
232 -gnome2_icon_savelist() {
233 - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
234 - pushd "${ED}" > /dev/null || die
235 - export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
236 - popd > /dev/null || die
237 -}
238 -
239 -# @FUNCTION: gnome2_icon_cache_update
240 -# @DESCRIPTION:
241 -# Updates Gtk+ icon cache files under /usr/share/icons.
242 -# Deprecated. Please use xdg_icon_cache_update from xdg-utils.eclass
243 -gnome2_icon_cache_update() {
244 - xdg_icon_cache_update
245 -}
246 -
247 -# @FUNCTION: gnome2_omf_fix
248 -# @DESCRIPTION:
249 -# Workaround applied to Makefile rules in order to remove redundant
250 -# calls to scrollkeeper-update and sandbox violations.
251 -# This function should be called from src_prepare.
252 -gnome2_omf_fix() {
253 - local omf_makefiles filename
254 -
255 - omf_makefiles="$@"
256 -
257 - if [[ -f ${S}/omf.make ]] ; then
258 - omf_makefiles="${omf_makefiles} ${S}/omf.make"
259 - fi
260 -
261 - if [[ -f ${S}/gnome-doc-utils.make ]] ; then
262 - omf_makefiles="${omf_makefiles} ${S}/gnome-doc-utils.make"
263 - fi
264 -
265 - # testing fixing of all makefiles found
266 - # The sort is important to ensure .am is listed before the respective .in for
267 - # maintainer mode regeneration not kicking in due to .am being newer than .in
268 - for filename in $(find "${S}" -name "Makefile.in" -o -name "Makefile.am" |sort) ; do
269 - omf_makefiles="${omf_makefiles} ${filename}"
270 - done
271 -
272 - ebegin "Fixing OMF Makefiles"
273 -
274 - local retval=0
275 - local fails=( )
276 -
277 - for omf in ${omf_makefiles} ; do
278 - sed -i -e 's:scrollkeeper-update:true:' "${omf}"
279 - retval=$?
280 -
281 - if [[ $retval -ne 0 ]] ; then
282 - debug-print "updating of ${omf} failed"
283 -
284 - # Add to the list of failures
285 - fails[$(( ${#fails[@]} + 1 ))]=$omf
286 -
287 - retval=2
288 - fi
289 - done
290 -
291 - eend $retval
292 -
293 - for f in "${fails[@]}" ; do
294 - eerror "Failed to update OMF Makefile $f"
295 - done
296 -}
297 -
298 -# @FUNCTION: gnome2_scrollkeeper_savelist
299 -# @DESCRIPTION:
300 -# Find the scrolls that are about to be installed and save their location
301 -# in the GNOME2_ECLASS_SCROLLS environment variable.
302 -# This function should be called from pkg_preinst.
303 -gnome2_scrollkeeper_savelist() {
304 - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
305 - pushd "${ED}" > /dev/null || die
306 - export GNOME2_ECLASS_SCROLLS=$(find 'usr/share/omf' -type f -name "*.omf" 2> /dev/null)
307 - popd > /dev/null || die
308 -}
309 -
310 -# @FUNCTION: gnome2_scrollkeeper_update
311 -# @DESCRIPTION:
312 -# Updates the global scrollkeeper database.
313 -# This function should be called from pkg_postinst and pkg_postrm.
314 -gnome2_scrollkeeper_update() {
315 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
316 - local updater="${EROOT}${SCROLLKEEPER_UPDATE_BIN}"
317 -
318 - if [[ ! -x "${updater}" ]] ; then
319 - debug-print "${updater} is not executable"
320 - return
321 - fi
322 -
323 - if [[ -z "${GNOME2_ECLASS_SCROLLS}" ]]; then
324 - debug-print "No scroll cache to update"
325 - return
326 - fi
327 -
328 - ebegin "Updating scrollkeeper database ..."
329 - "${updater}" -q -p "${EROOT}${SCROLLKEEPER_DIR}"
330 - eend $?
331 -}
332 -
333 -# @FUNCTION: gnome2_schemas_savelist
334 -# @DESCRIPTION:
335 -# Find if there is any GSettings schema to install and save the list in
336 -# GNOME2_ECLASS_GLIB_SCHEMAS variable. This is only necessary for eclass
337 -# implementations that call gnome2_schemas_update conditionally.
338 -# This function should be called from pkg_preinst.
339 -gnome2_schemas_savelist() {
340 - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
341 - pushd "${ED}" > /dev/null || die
342 - export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null)
343 - popd > /dev/null || die
344 -}
345 -
346 -# @FUNCTION: gnome2_schemas_update
347 -# @USAGE: gnome2_schemas_update
348 -# @DESCRIPTION:
349 -# Updates GSettings schemas.
350 -# This function should be called from pkg_postinst and pkg_postrm.
351 -gnome2_schemas_update() {
352 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
353 - local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}"
354 -
355 - if [[ ! -x ${updater} ]]; then
356 - debug-print "${updater} is not executable"
357 - return
358 - fi
359 -
360 - ebegin "Updating GSettings schemas"
361 - ${updater} --allow-any-name "$@" "${EROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null
362 - eend $?
363 -}
364 -
365 -# @FUNCTION: gnome2_gdk_pixbuf_savelist
366 -# @DESCRIPTION:
367 -# Find if there is any gdk-pixbuf loader to install and save the list in
368 -# GNOME2_ECLASS_GDK_PIXBUF_LOADERS variable.
369 -# This function should be called from pkg_preinst.
370 -gnome2_gdk_pixbuf_savelist() {
371 - has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
372 - pushd "${ED}" > /dev/null || die
373 - export GNOME2_ECLASS_GDK_PIXBUF_LOADERS=$(find usr/lib*/gdk-pixbuf-2.0 -type f 2>/dev/null)
374 - popd > /dev/null || die
375 -}
376 -
377 -# @FUNCTION: gnome2_gdk_pixbuf_update
378 -# @USAGE: gnome2_gdk_pixbuf_update
379 -# @DESCRIPTION:
380 -# Updates gdk-pixbuf loader cache if GNOME2_ECLASS_GDK_PIXBUF_LOADERS has some.
381 -# This function should be called from pkg_postinst and pkg_postrm.
382 -gnome2_gdk_pixbuf_update() {
383 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
384 - local updater="${EROOT}/usr/bin/${CHOST}-gdk-pixbuf-query-loaders"
385 -
386 - if [[ ! -x ${updater} ]]; then
387 - updater="${EROOT}/usr/bin/gdk-pixbuf-query-loaders"
388 - fi
389 -
390 - if [[ ! -x ${updater} ]]; then
391 - debug-print "${updater} is not executable"
392 - return
393 - fi
394 -
395 - if [[ -z ${GNOME2_ECLASS_GDK_PIXBUF_LOADERS} ]]; then
396 - debug-print "gdk-pixbuf loader cache does not need an update"
397 - return
398 - fi
399 -
400 - ebegin "Updating gdk-pixbuf loader cache"
401 - local tmp_file=$(emktemp)
402 - ${updater} 1> "${tmp_file}" &&
403 - chmod 0644 "${tmp_file}" &&
404 - cp -f "${tmp_file}" "${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache" &&
405 - rm "${tmp_file}" # don't replace this with mv, required for SELinux support
406 - eend $?
407 -}
408 -
409 -# @FUNCTION: gnome2_query_immodules_gtk2
410 -# @USAGE: gnome2_query_immodules_gtk2
411 -# @DESCRIPTION:
412 -# Updates gtk2 immodules/gdk-pixbuf loaders listing.
413 -gnome2_query_immodules_gtk2() {
414 - local updater=${EPREFIX}/usr/bin/${CHOST}-gtk-query-immodules-2.0
415 - [[ ! -x ${updater} ]] && updater=${EPREFIX}/usr/bin/gtk-query-immodules-2.0
416 -
417 - ebegin "Updating gtk2 input method module cache"
418 - GTK_IM_MODULE_FILE="${EROOT}usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" \
419 - "${updater}" --update-cache
420 - eend $?
421 -}
422 -
423 -# @FUNCTION: gnome2_query_immodules_gtk3
424 -# @USAGE: gnome2_query_immodules_gtk3
425 -# @DESCRIPTION:
426 -# Updates gtk3 immodules/gdk-pixbuf loaders listing.
427 -gnome2_query_immodules_gtk3() {
428 - local updater=${EPREFIX}/usr/bin/${CHOST}-gtk-query-immodules-3.0
429 - [[ ! -x ${updater} ]] && updater=${EPREFIX}/usr/bin/gtk-query-immodules-3.0
430 -
431 - ebegin "Updating gtk3 input method module cache"
432 - GTK_IM_MODULE_FILE="${EROOT}usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache" \
433 - "${updater}" --update-cache
434 - eend $?
435 -}
436 -
437 -# @FUNCTION: gnome2_giomodule_cache_update
438 -# @USAGE: gnome2_giomodule_cache_update
439 -# @DESCRIPTION:
440 -# Updates glib's gio modules cache.
441 -# This function should be called from pkg_postinst and pkg_postrm.
442 -gnome2_giomodule_cache_update() {
443 - has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
444 - local updater="${EROOT}/usr/bin/${CHOST}-gio-querymodules"
445 -
446 - if [[ ! -x ${updater} ]]; then
447 - updater="${EROOT}/usr/bin/gio-querymodules"
448 - fi
449 -
450 - if [[ ! -x ${updater} ]]; then
451 - debug-print "${updater} is not executable"
452 - return
453 - fi
454 -
455 - ebegin "Updating GIO modules cache"
456 - ${updater} "${EROOT%/}"/usr/$(get_libdir)/gio/modules
457 - eend $?
458 -}
459 -
460 -# @FUNCTION: gnome2_disable_deprecation_warning
461 -# @DESCRIPTION:
462 -# Disable deprecation warnings commonly found in glib based packages.
463 -# Should be called from src_prepare.
464 -gnome2_disable_deprecation_warning() {
465 - local retval=0
466 - local fails=( )
467 - local makefile
468 -
469 - ebegin "Disabling deprecation warnings"
470 - # The sort is important to ensure .am is listed before the respective .in for
471 - # maintainer mode regeneration not kicking in due to .am being newer than .in
472 - while read makefile ; do
473 - if ! grep -qE "(DISABLE_DEPRECATED|GSEAL_ENABLE)" "${makefile}"; then
474 - continue
475 - fi
476 -
477 - LC_ALL=C sed -r -i \
478 - -e 's:-D[A-Z_]+_DISABLE_DEPRECATED:$(/bin/true):g' \
479 - -e 's:-DGSEAL_ENABLE(=[A-Za-z0-9_]*)?:$(/bin/true):g' \
480 - -i "${makefile}"
481 -
482 - if [[ $? -ne 0 ]]; then
483 - # Add to the list of failures
484 - fails+=( "${makefile}" )
485 - retval=2
486 - fi
487 - done < <(find "${S}" -name "Makefile.in" \
488 - -o -name "Makefile.am" -o -name "Makefile.decl" \
489 - | sort; [[ -f "${S}"/configure ]] && echo configure)
490 -# TODO: sedding configure.ac can trigger maintainer mode; bug #439602
491 -# -o -name "configure.ac" -o -name "configure.in" \
492 -# | sort; echo configure)
493 - eend ${retval}
494 -
495 - for makefile in "${fails[@]}" ; do
496 - ewarn "Failed to disable deprecation warnings in ${makefile}"
497 - done
498 -}
499
500 diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
501 deleted file mode 100644
502 index c65c91c0cd..0000000000
503 --- a/eclass/xdg-utils.eclass
504 +++ /dev/null
505 @@ -1,134 +0,0 @@
506 -# Copyright 1999-2019 Gentoo Authors
507 -# Distributed under the terms of the GNU General Public License v2
508 -
509 -# @ECLASS: xdg-utils.eclass
510 -# @MAINTAINER:
511 -# gnome@g.o
512 -# @AUTHOR:
513 -# Original author: Gilles Dartiguelongue <eva@g.o>
514 -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
515 -# @BLURB: Auxiliary functions commonly used by XDG compliant packages.
516 -# @DESCRIPTION:
517 -# This eclass provides a set of auxiliary functions needed by most XDG
518 -# compliant packages.
519 -# It provides XDG stack related functions such as:
520 -# * Gtk+ icon cache management
521 -# * XDG .desktop files cache management
522 -# * XDG mime information database management
523 -
524 -case "${EAPI:-0}" in
525 - 0|1|2|3|4|5|6|7) ;;
526 - *) die "EAPI=${EAPI} is not supported" ;;
527 -esac
528 -
529 -# @ECLASS-VARIABLE: DESKTOP_DATABASE_DIR
530 -# @INTERNAL
531 -# @DESCRIPTION:
532 -# Directory where .desktop files database is stored
533 -: ${DESKTOP_DATABASE_DIR="/usr/share/applications"}
534 -
535 -# @ECLASS-VARIABLE: MIMEINFO_DATABASE_DIR
536 -# @INTERNAL
537 -# @DESCRIPTION:
538 -# Directory where .desktop files database is stored
539 -: ${MIMEINFO_DATABASE_DIR:="/usr/share/mime"}
540 -
541 -# @FUNCTION: xdg_environment_reset
542 -# @DESCRIPTION:
543 -# Clean up environment for clean builds.
544 -xdg_environment_reset() {
545 - # Prepare XDG base directories
546 - export XDG_DATA_HOME="${HOME}/.local/share"
547 - export XDG_CONFIG_HOME="${HOME}/.config"
548 - export XDG_CACHE_HOME="${HOME}/.cache"
549 - export XDG_RUNTIME_DIR="${T}/run"
550 - mkdir -p "${XDG_DATA_HOME}" "${XDG_CONFIG_HOME}" "${XDG_CACHE_HOME}" \
551 - "${XDG_RUNTIME_DIR}" || die
552 - # This directory needs to be owned by the user, and chmod 0700
553 - # https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
554 - chmod 0700 "${XDG_RUNTIME_DIR}" || die
555 -
556 - unset DBUS_SESSION_BUS_ADDRESS
557 -}
558 -
559 -# @FUNCTION: xdg_desktop_database_update
560 -# @DESCRIPTION:
561 -# Updates the .desktop files database.
562 -# Generates a list of mimetypes linked to applications that can handle them
563 -xdg_desktop_database_update() {
564 - if [[ ${EBUILD_PHASE} != post* ]] ; then
565 - die "xdg_desktop_database_update must be used in pkg_post* phases."
566 - fi
567 -
568 - if ! type update-desktop-database &>/dev/null; then
569 - debug-print "update-desktop-database is not found"
570 - return
571 - fi
572 -
573 - ebegin "Updating .desktop files database"
574 - update-desktop-database -q "${EROOT%/}${DESKTOP_DATABASE_DIR}"
575 - eend $?
576 -}
577 -
578 -# @FUNCTION: xdg_icon_cache_update
579 -# @DESCRIPTION:
580 -# Updates Gtk+ icon cache files under /usr/share/icons.
581 -# This function should be called from pkg_postinst and pkg_postrm.
582 -xdg_icon_cache_update() {
583 - if [[ ${EBUILD_PHASE} != post* ]] ; then
584 - die "xdg_icon_cache_update must be used in pkg_post* phases."
585 - fi
586 -
587 - if ! type gtk-update-icon-cache &>/dev/null; then
588 - debug-print "gtk-update-icon-cache is not found"
589 - return
590 - fi
591 -
592 - ebegin "Updating icons cache"
593 - local retval=0
594 - local fails=( )
595 - for dir in "${EROOT%/}"/usr/share/icons/*
596 - do
597 - if [[ -f "${dir}/index.theme" ]] ; then
598 - local rv=0
599 - gtk-update-icon-cache -qf "${dir}"
600 - rv=$?
601 - if [[ ! $rv -eq 0 ]] ; then
602 - debug-print "Updating cache failed on ${dir}"
603 - # Add to the list of failures
604 - fails+=( "${dir}" )
605 - retval=2
606 - fi
607 - elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then
608 - # Clear stale cache files after theme uninstallation
609 - rm "${dir}/icon-theme.cache"
610 - fi
611 - if [[ -z $(ls "${dir}") ]]; then
612 - # Clear empty theme directories after theme uninstallation
613 - rmdir "${dir}"
614 - fi
615 - done
616 - eend ${retval}
617 - for f in "${fails[@]}" ; do
618 - eerror "Failed to update cache with icon $f"
619 - done
620 -}
621 -
622 -# @FUNCTION: xdg_mimeinfo_database_update
623 -# @DESCRIPTION:
624 -# Update the mime database.
625 -# Creates a general list of mime types from several sources
626 -xdg_mimeinfo_database_update() {
627 - if [[ ${EBUILD_PHASE} != post* ]] ; then
628 - die "xdg_mimeinfo_database_update must be used in pkg_post* phases."
629 - fi
630 -
631 - if ! type update-mime-database &>/dev/null; then
632 - debug-print "update-mime-database is not found"
633 - return
634 - fi
635 -
636 - ebegin "Updating shared mime info database"
637 - update-mime-database "${EROOT%/}${MIMEINFO_DATABASE_DIR}"
638 - eend $?
639 -}
640
641 diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
642 deleted file mode 100644
643 index 219be712e8..0000000000
644 --- a/eclass/xdg.eclass
645 +++ /dev/null
646 @@ -1,110 +0,0 @@
647 -# Copyright 1999-2019 Gentoo Authors
648 -# Distributed under the terms of the GNU General Public License v2
649 -
650 -# @ECLASS: xdg.eclass
651 -# @MAINTAINER:
652 -# freedesktop-bugs@g.o
653 -# @AUTHOR:
654 -# Original author: Gilles Dartiguelongue <eva@g.o>
655 -# @SUPPORTED_EAPIS: 4 5 6 7
656 -# @BLURB: Provides phases for XDG compliant packages.
657 -# @DESCRIPTION:
658 -# Utility eclass to update the desktop, icon and shared mime info as laid
659 -# out in the freedesktop specs & implementations
660 -
661 -inherit xdg-utils
662 -
663 -case "${EAPI:-0}" in
664 - 4|5|6|7)
665 - EXPORT_FUNCTIONS src_prepare pkg_preinst pkg_postinst pkg_postrm
666 - ;;
667 - *) die "EAPI=${EAPI} is not supported" ;;
668 -esac
669 -
670 -# Avoid dependency loop as both depend on glib-2
671 -if [[ ${CATEGORY}/${P} != dev-libs/glib-2.* ]] ; then
672 -DEPEND="
673 - dev-util/desktop-file-utils
674 - x11-misc/shared-mime-info
675 -"
676 -fi
677 -
678 -# @FUNCTION: xdg_src_prepare
679 -# @DESCRIPTION:
680 -# Prepare sources to work with XDG standards.
681 -xdg_src_prepare() {
682 - xdg_environment_reset
683 -
684 - [[ ${EAPI:-0} != [45] ]] && default
685 -}
686 -
687 -# @FUNCTION: xdg_pkg_preinst
688 -# @DESCRIPTION:
689 -# Finds .desktop, icon and mime info files for later handling in pkg_postinst.
690 -# Locations are stored in XDG_ECLASS_DESKTOPFILES, XDG_ECLASS_ICONFILES
691 -# and XDG_ECLASS_MIMEINFOFILES respectively.
692 -xdg_pkg_preinst() {
693 - local f
694 -
695 - XDG_ECLASS_DESKTOPFILES=()
696 - while IFS= read -r -d '' f; do
697 - XDG_ECLASS_DESKTOPFILES+=( ${f} )
698 - done < <(cd "${ED}" && find 'usr/share/applications' -type f -print0 2>/dev/null)
699 -
700 - XDG_ECLASS_ICONFILES=()
701 - while IFS= read -r -d '' f; do
702 - XDG_ECLASS_ICONFILES+=( ${f} )
703 - done < <(cd "${ED}" && find 'usr/share/icons' -type f -print0 2>/dev/null)
704 -
705 - XDG_ECLASS_MIMEINFOFILES=()
706 - while IFS= read -r -d '' f; do
707 - XDG_ECLASS_MIMEINFOFILES+=( ${f} )
708 - done < <(cd "${ED}" && find 'usr/share/mime' -type f -print0 2>/dev/null)
709 -}
710 -
711 -# @FUNCTION: xdg_pkg_postinst
712 -# @DESCRIPTION:
713 -# Handle desktop, icon and mime info database updates.
714 -xdg_pkg_postinst() {
715 - if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
716 - xdg_desktop_database_update
717 - else
718 - debug-print "No .desktop files to add to database"
719 - fi
720 -
721 - if [[ ${#XDG_ECLASS_ICONFILES[@]} -gt 0 ]]; then
722 - xdg_icon_cache_update
723 - else
724 - debug-print "No icon files to add to cache"
725 - fi
726 -
727 - if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
728 - xdg_mimeinfo_database_update
729 - else
730 - debug-print "No mime info files to add to database"
731 - fi
732 -}
733 -
734 -# @FUNCTION: xdg_pkg_postrm
735 -# @DESCRIPTION:
736 -# Handle desktop, icon and mime info database updates.
737 -xdg_pkg_postrm() {
738 - if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
739 - xdg_desktop_database_update
740 - else
741 - debug-print "No .desktop files to add to database"
742 - fi
743 -
744 - if [[ ${#XDG_ECLASS_ICONFILES[@]} -gt 0 ]]; then
745 - xdg_icon_cache_update
746 - else
747 - debug-print "No icon files to add to cache"
748 - fi
749 -
750 - if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
751 - xdg_mimeinfo_database_update
752 - else
753 - debug-print "No mime info files to add to database"
754 - fi
755 -}
756 -