Executing tools installed in ROOT will fail when cross-compiling, so this prints a warning about manually running the command instead in that case. The warning is copied from dev-libs/glib.
This also reorders the exception handling by increasing severity so that the "nothing to do" non-error returns first, otherwise the expected problem of unexecutable cross-compiled commands returns, otherwise the unexpected problem of missing commands returns. The immodule cache functions were updated to handle a different problem. They run native tools from BROOT, but they are not guaranteed to exist while cross-compiling (e.g. gtk+ can't BDEPEND on itself, so the cross-compiled gtk+ can be installed before the native gtk+, which fails from gtk-query-immodules not existing). Closes: https://bugs.gentoo.org/757483 Signed-off-by: David Michael <fedora....@gmail.com> --- Hi, Here is an eclass patch to fix bug #757483. I wasn't sure if the cross-compiling message should be a warning while everything else was a debug-print, but I left it matching what glib does. The message in the glib ebuilds should be dropped if this is applied. Thanks. David eclass/gnome2-utils.eclass | 98 +++++++++++++++++++++++++++++--------- 1 file changed, 75 insertions(+), 23 deletions(-) diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass index 06643db0f60..4abaf3a1a5c 100644 --- a/eclass/gnome2-utils.eclass +++ b/eclass/gnome2-utils.eclass @@ -16,8 +16,9 @@ [[ ${EAPI:-0} == [012345] ]] && inherit multilib # eutils.eclass: emktemp +# toolchain-funs.eclass: tc-is-cross-compiler # xdg-utils.eclass: xdg_environment_reset, xdg_icon_cache_update -inherit eutils xdg-utils +inherit eutils toolchain-funcs xdg-utils case "${EAPI:-0}" in 0|1|2|3|4|5|6|7) ;; @@ -125,13 +126,21 @@ gnome2_gconf_install() { has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" local updater="${EROOT%/}${GCONFTOOL_BIN}" - if [[ ! -x "${updater}" ]]; then - debug-print "${updater} is not executable" + if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then + debug-print "No GNOME 2 GConf schemas found" return fi - if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then - debug-print "No GNOME 2 GConf schemas found" + if tc-is-cross-compiler ; then + ewarn "Updating of GNOME 2 GConf schemas skipped due to cross-compilation." + ewarn "You might want to run gconftool-2 manually on the target for" + ewarn "your final image and re-run it when packages installing" + ewarn "GNOME 2 GConf schemas get upgraded or added to the image." + return + fi + + if [[ ! -x "${updater}" ]]; then + debug-print "${updater} is not executable" return fi @@ -166,13 +175,20 @@ gnome2_gconf_uninstall() { has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" local updater="${EROOT%/}${GCONFTOOL_BIN}" - if [[ ! -x "${updater}" ]]; then - debug-print "${updater} is not executable" + if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then + debug-print "No GNOME 2 GConf schemas found" return fi - if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then - debug-print "No GNOME 2 GConf schemas found" + if tc-is-cross-compiler ; then + ewarn "Removal of GNOME 2 GConf schemas skipped due to cross-compilation." + ewarn "You might want to run gconftool-2 manually on the target for" + ewarn "your final image to uninstall this package's schemas." + return + fi + + if [[ ! -x "${updater}" ]]; then + debug-print "${updater} is not executable" return fi @@ -269,13 +285,21 @@ gnome2_scrollkeeper_update() { has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" local updater="${EROOT%/}${SCROLLKEEPER_UPDATE_BIN}" - if [[ ! -x "${updater}" ]] ; then - debug-print "${updater} is not executable" + if [[ -z "${GNOME2_ECLASS_SCROLLS}" ]]; then + debug-print "No scroll cache to update" return fi - if [[ -z "${GNOME2_ECLASS_SCROLLS}" ]]; then - debug-print "No scroll cache to update" + if tc-is-cross-compiler ; then + ewarn "Updating of scrollkeeper database skipped due to cross-compilation." + ewarn "You might want to run scrollkeeper-update manually on the target" + ewarn "for your final image and re-run it when packages installing" + ewarn "scrollkeeper OMF files get upgraded or added to the image." + return + fi + + if [[ ! -x "${updater}" ]] ; then + debug-print "${updater} is not executable" return fi @@ -305,6 +329,14 @@ gnome2_schemas_update() { has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" local updater="${EROOT%/}${GLIB_COMPILE_SCHEMAS}" + if tc-is-cross-compiler ; then + ewarn "Updating of GSettings schemas skipped due to cross-compilation." + ewarn "You might want to run glib-compile-schemas manually on the target" + ewarn "for your final image and re-run it when packages installing" + ewarn "GSettings schemas get upgraded or added to the image." + return + fi + if [[ ! -x ${updater} ]]; then debug-print "${updater} is not executable" return @@ -334,18 +366,23 @@ gnome2_gdk_pixbuf_savelist() { gnome2_gdk_pixbuf_update() { has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" local updater="${EROOT%/}/usr/bin/${CHOST}-gdk-pixbuf-query-loaders" + [[ -x ${updater} ]] || updater="${EROOT%/}/usr/bin/gdk-pixbuf-query-loaders" - if [[ ! -x ${updater} ]]; then - 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 - if [[ ! -x ${updater} ]]; then - debug-print "${updater} is not executable" + if tc-is-cross-compiler ; then + ewarn "Updating of gdk-pixbuf loader cache skipped due to cross-compilation." + ewarn "You might want to run gdk-pixbuf-query-loaders manually on the target" + ewarn "for your final image and re-run it when packages installing" + ewarn "gdk-pixbuf loaders get upgraded or added to the image." return fi - if [[ -z ${GNOME2_ECLASS_GDK_PIXBUF_LOADERS} ]]; then - debug-print "gdk-pixbuf loader cache does not need an update" + if [[ ! -x ${updater} ]]; then + debug-print "${updater} is not executable" return fi @@ -363,7 +400,12 @@ gnome2_gdk_pixbuf_update() { # Updates gtk2 immodules/gdk-pixbuf loaders listing. gnome2_query_immodules_gtk2() { local updater=${EPREFIX}/usr/bin/${CHOST}-gtk-query-immodules-2.0 - [[ ! -x ${updater} ]] && updater=${EPREFIX}/usr/bin/gtk-query-immodules-2.0 + [[ -x ${updater} ]] || updater=${EPREFIX}/usr/bin/gtk-query-immodules-2.0 + + if [[ ! -x ${updater} ]]; then + debug-print "${updater} is not executable" + return + fi ebegin "Updating gtk2 input method module cache" GTK_IM_MODULE_FILE="${EROOT%/}/usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" \ @@ -376,7 +418,12 @@ gnome2_query_immodules_gtk2() { # Updates gtk3 immodules/gdk-pixbuf loaders listing. gnome2_query_immodules_gtk3() { local updater=${EPREFIX}/usr/bin/${CHOST}-gtk-query-immodules-3.0 - [[ ! -x ${updater} ]] && updater=${EPREFIX}/usr/bin/gtk-query-immodules-3.0 + [[ -x ${updater} ]] || updater=${EPREFIX}/usr/bin/gtk-query-immodules-3.0 + + if [[ ! -x ${updater} ]]; then + debug-print "${updater} is not executable" + return + fi ebegin "Updating gtk3 input method module cache" GTK_IM_MODULE_FILE="${EROOT%/}/usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache" \ @@ -391,9 +438,14 @@ gnome2_query_immodules_gtk3() { gnome2_giomodule_cache_update() { has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}" local updater="${EROOT%/}/usr/bin/${CHOST}-gio-querymodules" + [[ -x ${updater} ]] || updater="${EROOT%/}/usr/bin/gio-querymodules" - if [[ ! -x ${updater} ]]; then - updater="${EROOT%/}/usr/bin/gio-querymodules" + if tc-is-cross-compiler ; then + ewarn "Updating of GIO modules cache skipped due to cross-compilation." + ewarn "You might want to run gio-querymodules manually on the target for" + ewarn "your final image for performance reasons and re-run it when packages" + ewarn "installing GIO modules get upgraded or added to the image." + return fi if [[ ! -x ${updater} ]]; then -- 2.26.2