mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-10 06:26:57 +02:00
eclass/gnome2-utils: Sync with Gentoo
It's from Gentoo commit 522ff35dae0aa2ee48111d7c4ffad9e749e72cde.
This commit is contained in:
parent
05a03a1d9b
commit
3f14fa91b7
@ -1,10 +1,10 @@
|
||||
# Copyright 1999-2021 Gentoo Authors
|
||||
# Copyright 1999-2024 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# @ECLASS: gnome2-utils.eclass
|
||||
# @MAINTAINER:
|
||||
# gnome@gentoo.org
|
||||
# @SUPPORTED_EAPIS: 5 6 7 8
|
||||
# @SUPPORTED_EAPIS: 7 8
|
||||
# @PROVIDES: xdg-utils
|
||||
# @BLURB: Auxiliary functions commonly used by Gnome packages.
|
||||
# @DESCRIPTION:
|
||||
@ -15,65 +15,68 @@
|
||||
# * GConf schemas management
|
||||
# * scrollkeeper (old Gnome help system) management
|
||||
|
||||
[[ ${EAPI} == 5 ]] && inherit multilib
|
||||
# toolchain-funs.eclass: tc-is-cross-compiler
|
||||
# xdg-utils.eclass: xdg_environment_reset, xdg_icon_cache_update
|
||||
inherit toolchain-funcs xdg-utils
|
||||
|
||||
case ${EAPI} in
|
||||
5|6|7|8) ;;
|
||||
7|8) ;;
|
||||
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
|
||||
esac
|
||||
|
||||
# @ECLASS-VARIABLE: GCONFTOOL_BIN
|
||||
# @ECLASS_VARIABLE: GCONFTOOL_BIN
|
||||
# @INTERNAL
|
||||
# @DESCRIPTION:
|
||||
# Path to gconftool-2
|
||||
: ${GCONFTOOL_BIN:="/usr/bin/gconftool-2"}
|
||||
: "${GCONFTOOL_BIN:="/usr/bin/gconftool-2"}"
|
||||
|
||||
# @ECLASS-VARIABLE: SCROLLKEEPER_DIR
|
||||
# @ECLASS_VARIABLE: SCROLLKEEPER_DIR
|
||||
# @INTERNAL
|
||||
# @DESCRIPTION:
|
||||
# Directory where scrollkeeper-update should do its work
|
||||
: ${SCROLLKEEPER_DIR:="/var/lib/scrollkeeper"}
|
||||
: "${SCROLLKEEPER_DIR:="/var/lib/scrollkeeper"}"
|
||||
|
||||
# @ECLASS-VARIABLE: SCROLLKEEPER_UPDATE_BIN
|
||||
# @ECLASS_VARIABLE: SCROLLKEEPER_UPDATE_BIN
|
||||
# @INTERNAL
|
||||
# @DESCRIPTION:
|
||||
# Path to scrollkeeper-update
|
||||
: ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"}
|
||||
: "${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"}"
|
||||
|
||||
# @ECLASS-VARIABLE: GLIB_COMPILE_SCHEMAS
|
||||
# @INTERNAL
|
||||
# @ECLASS_VARIABLE: GLIB_COMPILE_RESOURCES
|
||||
# @DESCRIPTION:
|
||||
# Path to glib-compile-resources
|
||||
: "${GLIB_COMPILE_RESOURCES:="/usr/bin/glib-compile-resources"}"
|
||||
|
||||
# @ECLASS_VARIABLE: GLIB_COMPILE_SCHEMAS
|
||||
# @DESCRIPTION:
|
||||
# Path to glib-compile-schemas
|
||||
: ${GLIB_COMPILE_SCHEMAS:="/usr/bin/glib-compile-schemas"}
|
||||
: "${GLIB_COMPILE_SCHEMAS:="/usr/bin/glib-compile-schemas"}"
|
||||
|
||||
# @ECLASS-VARIABLE: GNOME2_ECLASS_SCHEMAS
|
||||
# @ECLASS_VARIABLE: GNOME2_ECLASS_SCHEMAS
|
||||
# @INTERNAL
|
||||
# @DEFAULT_UNSET
|
||||
# @DESCRIPTION:
|
||||
# List of GConf schemas provided by the package
|
||||
|
||||
# @ECLASS-VARIABLE: GNOME2_ECLASS_ICONS
|
||||
# @ECLASS_VARIABLE: GNOME2_ECLASS_ICONS
|
||||
# @INTERNAL
|
||||
# @DEFAULT_UNSET
|
||||
# @DESCRIPTION:
|
||||
# List of icons provided by the package
|
||||
|
||||
# @ECLASS-VARIABLE: GNOME2_ECLASS_SCROLLS
|
||||
# @ECLASS_VARIABLE: GNOME2_ECLASS_SCROLLS
|
||||
# @INTERNAL
|
||||
# @DEFAULT_UNSET
|
||||
# @DESCRIPTION:
|
||||
# List of scrolls (documentation files) provided by the package
|
||||
|
||||
# @ECLASS-VARIABLE: GNOME2_ECLASS_GLIB_SCHEMAS
|
||||
# @ECLASS_VARIABLE: GNOME2_ECLASS_GLIB_SCHEMAS
|
||||
# @INTERNAL
|
||||
# @DEFAULT_UNSET
|
||||
# @DESCRIPTION:
|
||||
# List of GSettings schemas provided by the package
|
||||
|
||||
# @ECLASS-VARIABLE: GNOME2_ECLASS_GDK_PIXBUF_LOADERS
|
||||
# @ECLASS_VARIABLE: GNOME2_ECLASS_GDK_PIXBUF_LOADERS
|
||||
# @INTERNAL
|
||||
# @DEFAULT_UNSET
|
||||
# @DESCRIPTION:
|
||||
@ -82,7 +85,7 @@ esac
|
||||
|
||||
# @FUNCTION: gnome2_environment_reset
|
||||
# @DESCRIPTION:
|
||||
# Reset various variables inherited from root's evironment to a reasonable
|
||||
# Reset various variables inherited from root's environment to a reasonable
|
||||
# default for ebuilds to help avoid access violations and test failures.
|
||||
gnome2_environment_reset() {
|
||||
xdg_environment_reset
|
||||
@ -96,7 +99,7 @@ gnome2_environment_reset() {
|
||||
# Ensure we don't rely on dconf/gconf while building, bug #511946
|
||||
export GSETTINGS_BACKEND="memory"
|
||||
|
||||
if has ${EAPI} 6 7; then
|
||||
if [[ ${EAPI} == 7 ]]; then
|
||||
# Try to cover the packages honoring this variable, bug #508124
|
||||
export GST_INSPECT="$(type -P true)"
|
||||
|
||||
@ -122,7 +125,7 @@ gnome2_gconf_savelist() {
|
||||
# using gconftool-2.
|
||||
# This function should be called from pkg_postinst.
|
||||
gnome2_gconf_install() {
|
||||
local updater="${EROOT%/}${GCONFTOOL_BIN}"
|
||||
local updater="${EROOT}${GCONFTOOL_BIN}"
|
||||
|
||||
if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
|
||||
debug-print "No GNOME 2 GConf schemas found"
|
||||
@ -144,15 +147,15 @@ gnome2_gconf_install() {
|
||||
|
||||
# We are ready to install the GCONF Scheme now
|
||||
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
|
||||
export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT%/}/;")"
|
||||
export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT}/;")"
|
||||
|
||||
einfo "Installing GNOME 2 GConf schemas"
|
||||
|
||||
local F
|
||||
for F in ${GNOME2_ECLASS_SCHEMAS}; do
|
||||
if [[ -e "${EROOT%/}/${F}" ]]; then
|
||||
if [[ -e "${EROOT}/${F}" ]]; then
|
||||
debug-print "Installing schema: ${F}"
|
||||
"${updater}" --makefile-install-rule "${EROOT%/}/${F}" 1>/dev/null
|
||||
"${updater}" --makefile-install-rule "${EROOT}/${F}" 1>/dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
@ -170,7 +173,7 @@ gnome2_gconf_install() {
|
||||
# Removes schema files previously installed by the current ebuild from Gconf's
|
||||
# database.
|
||||
gnome2_gconf_uninstall() {
|
||||
local updater="${EROOT%/}${GCONFTOOL_BIN}"
|
||||
local updater="${EROOT}${GCONFTOOL_BIN}"
|
||||
|
||||
if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
|
||||
debug-print "No GNOME 2 GConf schemas found"
|
||||
@ -190,15 +193,15 @@ gnome2_gconf_uninstall() {
|
||||
fi
|
||||
|
||||
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
|
||||
export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT%/}/;")"
|
||||
export GCONF_CONFIG_SOURCE="$("${updater}" --get-default-source | sed "s;:/;:${ROOT}/;")"
|
||||
|
||||
einfo "Uninstalling GNOME 2 GConf schemas"
|
||||
|
||||
local F
|
||||
for F in ${GNOME2_ECLASS_SCHEMAS}; do
|
||||
if [[ -e "${EROOT%/}/${F}" ]]; then
|
||||
if [[ -e "${EROOT}/${F}" ]]; then
|
||||
debug-print "Uninstalling gconf schema: ${F}"
|
||||
"${updater}" --makefile-uninstall-rule "${EROOT%/}/${F}" 1>/dev/null
|
||||
"${updater}" --makefile-uninstall-rule "${EROOT}/${F}" 1>/dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
@ -217,31 +220,29 @@ gnome2_gconf_uninstall() {
|
||||
# calls to scrollkeeper-update and sandbox violations.
|
||||
# This function should be called from src_prepare.
|
||||
gnome2_omf_fix() {
|
||||
local omf_makefiles filename
|
||||
|
||||
omf_makefiles="$@"
|
||||
local omf_makefiles=( "$@" )
|
||||
|
||||
if [[ -f ${S}/omf.make ]] ; then
|
||||
omf_makefiles="${omf_makefiles} ${S}/omf.make"
|
||||
omf_makefiles+=( "${S}"/omf.make )
|
||||
fi
|
||||
|
||||
if [[ -f ${S}/gnome-doc-utils.make ]] ; then
|
||||
omf_makefiles="${omf_makefiles} ${S}/gnome-doc-utils.make"
|
||||
omf_makefiles+=( "${S}"/gnome-doc-utils.make )
|
||||
fi
|
||||
|
||||
# testing fixing of all makefiles found
|
||||
# The sort is important to ensure .am is listed before the respective .in for
|
||||
# maintainer mode regeneration not kicking in due to .am being newer than .in
|
||||
for filename in $(find "${S}" -name "Makefile.in" -o -name "Makefile.am" |sort) ; do
|
||||
omf_makefiles="${omf_makefiles} ${filename}"
|
||||
done
|
||||
local filename
|
||||
while IFS="" read -r filename ; do
|
||||
omf_makefiles+=( "${filename}" )
|
||||
done < <(find "${S}" -name "Makefile.in" -o -name "Makefile.am" | sort)
|
||||
|
||||
ebegin "Fixing OMF Makefiles"
|
||||
|
||||
local retval=0
|
||||
local omf retval=0
|
||||
local fails=( )
|
||||
|
||||
for omf in ${omf_makefiles} ; do
|
||||
for omf in "${omf_makefiles[@]}" ; do
|
||||
sed -i -e 's:scrollkeeper-update:true:' "${omf}"
|
||||
retval=$?
|
||||
|
||||
@ -249,7 +250,7 @@ gnome2_omf_fix() {
|
||||
debug-print "updating of ${omf} failed"
|
||||
|
||||
# Add to the list of failures
|
||||
fails[$(( ${#fails[@]} + 1 ))]=$omf
|
||||
fails+=( "${omf}" )
|
||||
|
||||
retval=2
|
||||
fi
|
||||
@ -257,6 +258,7 @@ gnome2_omf_fix() {
|
||||
|
||||
eend $retval
|
||||
|
||||
local f
|
||||
for f in "${fails[@]}" ; do
|
||||
eerror "Failed to update OMF Makefile $f"
|
||||
done
|
||||
@ -278,7 +280,7 @@ gnome2_scrollkeeper_savelist() {
|
||||
# Updates the global scrollkeeper database.
|
||||
# This function should be called from pkg_postinst and pkg_postrm.
|
||||
gnome2_scrollkeeper_update() {
|
||||
local updater="${EROOT%/}${SCROLLKEEPER_UPDATE_BIN}"
|
||||
local updater="${EROOT}${SCROLLKEEPER_UPDATE_BIN}"
|
||||
|
||||
if [[ -z "${GNOME2_ECLASS_SCROLLS}" ]]; then
|
||||
debug-print "No scroll cache to update"
|
||||
@ -299,7 +301,7 @@ gnome2_scrollkeeper_update() {
|
||||
fi
|
||||
|
||||
ebegin "Updating scrollkeeper database ..."
|
||||
"${updater}" -q -p "${EROOT%/}${SCROLLKEEPER_DIR}"
|
||||
"${updater}" -q -p "${EROOT}${SCROLLKEEPER_DIR}"
|
||||
eend $?
|
||||
}
|
||||
|
||||
@ -320,7 +322,7 @@ gnome2_schemas_savelist() {
|
||||
# Updates GSettings schemas.
|
||||
# This function should be called from pkg_postinst and pkg_postrm.
|
||||
gnome2_schemas_update() {
|
||||
local updater="${EROOT%/}${GLIB_COMPILE_SCHEMAS}"
|
||||
local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}"
|
||||
|
||||
if tc-is-cross-compiler ; then
|
||||
ewarn "Updating of GSettings schemas skipped due to cross-compilation."
|
||||
@ -336,7 +338,7 @@ gnome2_schemas_update() {
|
||||
fi
|
||||
|
||||
ebegin "Updating GSettings schemas"
|
||||
${updater} --allow-any-name "$@" "${EROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null
|
||||
${updater} --allow-any-name "$@" "${EROOT}/usr/share/glib-2.0/schemas" &>/dev/null
|
||||
eend $?
|
||||
}
|
||||
|
||||
@ -356,13 +358,8 @@ gnome2_gdk_pixbuf_savelist() {
|
||||
# Updates gdk-pixbuf loader cache if GNOME2_ECLASS_GDK_PIXBUF_LOADERS has some.
|
||||
# This function should be called from pkg_postinst and pkg_postrm.
|
||||
gnome2_gdk_pixbuf_update() {
|
||||
local updater="${EROOT%/}/usr/bin/${CHOST}-gdk-pixbuf-query-loaders"
|
||||
[[ -x ${updater} ]] || updater="${EROOT%/}/usr/bin/gdk-pixbuf-query-loaders"
|
||||
|
||||
if [[ -z ${GNOME2_ECLASS_GDK_PIXBUF_LOADERS} ]]; then
|
||||
debug-print "gdk-pixbuf loader cache does not need an update"
|
||||
return
|
||||
fi
|
||||
local updater="${EROOT}/usr/bin/${CHOST}-gdk-pixbuf-query-loaders"
|
||||
[[ -x ${updater} ]] || updater="${EROOT}/usr/bin/gdk-pixbuf-query-loaders"
|
||||
|
||||
if tc-is-cross-compiler ; then
|
||||
ewarn "Updating of gdk-pixbuf loader cache skipped due to cross-compilation."
|
||||
@ -381,7 +378,7 @@ gnome2_gdk_pixbuf_update() {
|
||||
local tmp_file=$(mktemp "${T}"/tmp.XXXXXXXXXX) || die "Failed to create temporary file"
|
||||
${updater} 1> "${tmp_file}" &&
|
||||
chmod 0644 "${tmp_file}" &&
|
||||
cp -f "${tmp_file}" "${EROOT%/}/usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache" &&
|
||||
cp -f "${tmp_file}" "${EROOT}/usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache" &&
|
||||
rm "${tmp_file}" # don't replace this with mv, required for SELinux support
|
||||
eend $?
|
||||
}
|
||||
@ -399,7 +396,7 @@ gnome2_query_immodules_gtk2() {
|
||||
fi
|
||||
|
||||
ebegin "Updating gtk2 input method module cache"
|
||||
GTK_IM_MODULE_FILE="${EROOT%/}/usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" \
|
||||
GTK_IM_MODULE_FILE="${EROOT}/usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" \
|
||||
"${updater}" --update-cache
|
||||
eend $?
|
||||
}
|
||||
@ -417,7 +414,7 @@ gnome2_query_immodules_gtk3() {
|
||||
fi
|
||||
|
||||
ebegin "Updating gtk3 input method module cache"
|
||||
GTK_IM_MODULE_FILE="${EROOT%/}/usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache" \
|
||||
GTK_IM_MODULE_FILE="${EROOT}/usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache" \
|
||||
"${updater}" --update-cache
|
||||
eend $?
|
||||
}
|
||||
@ -427,8 +424,8 @@ gnome2_query_immodules_gtk3() {
|
||||
# Updates glib's gio modules cache.
|
||||
# This function should be called from pkg_postinst and pkg_postrm.
|
||||
gnome2_giomodule_cache_update() {
|
||||
local updater="${EROOT%/}/usr/bin/${CHOST}-gio-querymodules"
|
||||
[[ -x ${updater} ]] || updater="${EROOT%/}/usr/bin/gio-querymodules"
|
||||
local updater="${EROOT}/usr/bin/${CHOST}-gio-querymodules"
|
||||
[[ -x ${updater} ]] || updater="${EROOT}/usr/bin/gio-querymodules"
|
||||
|
||||
if tc-is-cross-compiler ; then
|
||||
ewarn "Updating of GIO modules cache skipped due to cross-compilation."
|
||||
@ -444,7 +441,7 @@ gnome2_giomodule_cache_update() {
|
||||
fi
|
||||
|
||||
ebegin "Updating GIO modules cache"
|
||||
${updater} "${EROOT%/}"/usr/$(get_libdir)/gio/modules
|
||||
${updater} "${EROOT}"/usr/$(get_libdir)/gio/modules
|
||||
eend $?
|
||||
}
|
||||
|
||||
@ -487,30 +484,3 @@ gnome2_disable_deprecation_warning() {
|
||||
ewarn "Failed to disable deprecation warnings in ${makefile}"
|
||||
done
|
||||
}
|
||||
|
||||
case ${EAPI} in
|
||||
5|6)
|
||||
|
||||
# @FUNCTION: gnome2_icon_savelist
|
||||
# @DESCRIPTION:
|
||||
# Find the icons that are about to be installed and save their location
|
||||
# in the GNOME2_ECLASS_ICONS environment variable. This is only
|
||||
# necessary for eclass implementations that call
|
||||
# gnome2_icon_cache_update conditionally.
|
||||
# This function should be called from pkg_preinst.
|
||||
gnome2_icon_savelist() {
|
||||
pushd "${ED}" > /dev/null || die
|
||||
export GNOME2_ECLASS_ICONS=$(find 'usr/share/icons' -maxdepth 1 -mindepth 1 -type d 2> /dev/null)
|
||||
popd > /dev/null || die
|
||||
}
|
||||
|
||||
# @FUNCTION: gnome2_icon_cache_update
|
||||
# @DESCRIPTION:
|
||||
# Updates Gtk+ icon cache files under /usr/share/icons.
|
||||
# Deprecated. Please use xdg_icon_cache_update from xdg-utils.eclass
|
||||
gnome2_icon_cache_update() {
|
||||
xdg_icon_cache_update
|
||||
}
|
||||
|
||||
;;
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user