summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eclass/gnome2-python.eclass53
-rw-r--r--eclass/gnome2-utils.eclass522
-rw-r--r--eclass/multibuild.eclass282
3 files changed, 0 insertions, 857 deletions
diff --git a/eclass/gnome2-python.eclass b/eclass/gnome2-python.eclass
deleted file mode 100644
index a16e931e..00000000
--- a/eclass/gnome2-python.eclass
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-# @ECLASS: gnome2-python.eclass
-# @MAINTAINER:
-# Gentoo GNOME Project <gnome@gentoo.org>
-# Gentoo Python Project <python@gentoo.org>
-# @BLURB: Eclass for GNOME Python packages supporting installation for multiple Python ABIs
-# @DESCRIPTION:
-# The gnome2-python eclass defines phase functions for GNOME Python packages supporting
-# installation for multiple Python ABIs.
-
-inherit gnome2 python
-
-# Stolen from git.eclass
-EXPORTED_FUNCTIONS="pkg_setup src_compile src_test src_install"
-case "${EAPI:-0}" in
- 2|3|4) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;;
- 0|1) ;;
- *) die "Unknown EAPI, bug eclass maintainers." ;;
-esac
-
-EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
-
-gnome2-python_pkg_setup() {
- python_pkg_setup
-}
-
-gnome2-python_src_prepare() {
- gnome2_src_prepare
- python_clean_py-compile_files
- python_copy_sources
-}
-
-gnome2-python_src_configure() {
- configure() {
- gnome2_src_configure PYTHON=$(PYTHON -a) "$@"
- }
- python_execute_function -s configure
-}
-
-gnome2-python_src_compile() {
- python_execute_function -s gnome2_src_compile "$@"
-}
-
-gnome2-python_src_test() {
- python_execute_function -s -d
-}
-
-gnome2-python_src_install() {
- python_execute_function -s gnome2_src_install
- python_clean_installation_image
-}
diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass
deleted file mode 100644
index 9b4296c1..00000000
--- a/eclass/gnome2-utils.eclass
+++ /dev/null
@@ -1,522 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-# @ECLASS: gnome2-utils.eclass
-# @MAINTAINER:
-# gnome@gentoo.org
-# @BLURB: Auxiliary functions commonly used by Gnome packages.
-# @DESCRIPTION:
-# This eclass provides a set of auxiliary functions needed by most Gnome
-# packages. It may be used by non-Gnome packages as needed for handling various
-# Gnome stack related functions such as:
-# * Gtk+ icon cache management
-# * GSettings schemas management
-# * GConf schemas management
-# * scrollkeeper (old Gnome help system) management
-
-[[ ${EAPI:-0} == [012345] ]] && inherit multilib
-inherit eutils xdg-utils
-
-case "${EAPI:-0}" in
- 0|1|2|3|4|5|6) ;;
- *) die "EAPI=${EAPI} is not supported" ;;
-esac
-
-# @ECLASS-VARIABLE: GCONFTOOL_BIN
-# @INTERNAL
-# @DESCRIPTION:
-# Path to gconftool-2
-: ${GCONFTOOL_BIN:="/usr/bin/gconftool-2"}
-
-# @ECLASS-VARIABLE: SCROLLKEEPER_DIR
-# @INTERNAL
-# @DESCRIPTION:
-# Directory where scrollkeeper-update should do its work
-: ${SCROLLKEEPER_DIR:="/var/lib/scrollkeeper"}
-
-# @ECLASS-VARIABLE: SCROLLKEEPER_UPDATE_BIN
-# @INTERNAL
-# @DESCRIPTION:
-# Path to scrollkeeper-update
-: ${SCROLLKEEPER_UPDATE_BIN:="/usr/bin/scrollkeeper-update"}
-
-# @ECLASS-VARIABLE: GTK_UPDATE_ICON_CACHE
-# @INTERNAL
-# @DESCRIPTION:
-# Path to gtk-update-icon-cache
-: ${GTK_UPDATE_ICON_CACHE:="/usr/bin/gtk-update-icon-cache"}
-
-# @ECLASS-VARIABLE: GLIB_COMPILE_SCHEMAS
-# @INTERNAL
-# @DESCRIPTION:
-# Path to glib-compile-schemas
-: ${GLIB_COMPILE_SCHEMAS:="/usr/bin/glib-compile-schemas"}
-
-# @ECLASS-VARIABLE: GNOME2_ECLASS_SCHEMAS
-# @INTERNAL
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# List of GConf schemas provided by the package
-
-# @ECLASS-VARIABLE: GNOME2_ECLASS_ICONS
-# @INTERNAL
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# List of icons provided by the package
-
-# @ECLASS-VARIABLE: GNOME2_ECLASS_SCROLLS
-# @INTERNAL
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# List of scrolls (documentation files) provided by the package
-
-# @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
-# @INTERNAL
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# List of gdk-pixbuf loaders provided by the package
-
-DEPEND=">=sys-apps/sed-4"
-
-
-# @FUNCTION: gnome2_environment_reset
-# @DESCRIPTION:
-# Reset various variables inherited from root's evironment to a reasonable
-# default for ebuilds to help avoid access violations and test failures.
-gnome2_environment_reset() {
- xdg_environment_reset
-
- # Respected by >=glib-2.30.1-r1
- export G_HOME="${T}"
-
- # GST_REGISTRY is to work around gst utilities trying to read/write /root
- export GST_REGISTRY="${T}/registry.xml"
-
- # Ensure we don't rely on dconf/gconf while building, bug #511946
- export GSETTINGS_BACKEND="memory"
-
- if has ${EAPI:-0} 6; then
- # Try to cover the packages honoring this variable, bug #508124
- export GST_INSPECT="$(type -P true)"
-
- # Stop relying on random DISPLAY variable values, bug #534312
- unset DISPLAY
- fi
-}
-
-# @FUNCTION: gnome2_gconf_savelist
-# @DESCRIPTION:
-# Find the GConf schemas that are about to be installed and save their location
-# in the GNOME2_ECLASS_SCHEMAS environment variable.
-# This function should be called from pkg_preinst.
-gnome2_gconf_savelist() {
- has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
- pushd "${ED}" > /dev/null || die
- export GNOME2_ECLASS_SCHEMAS=$(find 'etc/gconf/schemas/' -name '*.schemas' 2> /dev/null)
- popd > /dev/null || die
-}
-
-# @FUNCTION: gnome2_gconf_install
-# @DESCRIPTION:
-# Applies any schema files installed by the current ebuild to Gconf's database
-# using gconftool-2.
-# This function should be called from pkg_postinst.
-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"
- return
- fi
-
- if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
- debug-print "No GNOME 2 GConf schemas found"
- return
- fi
-
- # 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};")"
-
- einfo "Installing GNOME 2 GConf schemas"
-
- local F
- for F in ${GNOME2_ECLASS_SCHEMAS}; do
- if [[ -e "${EROOT}${F}" ]]; then
- debug-print "Installing schema: ${F}"
- "${updater}" --makefile-install-rule "${EROOT}${F}" 1>/dev/null
- fi
- done
-
- # have gconf reload the new schemas
- pids=$(pgrep -x gconfd-2)
- if [[ $? == 0 ]] ; then
- ebegin "Reloading GConf schemas"
- kill -HUP ${pids}
- eend $?
- fi
-}
-
-# @FUNCTION: gnome2_gconf_uninstall
-# @DESCRIPTION:
-# Removes schema files previously installed by the current ebuild from Gconf's
-# database.
-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"
- return
- fi
-
- if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
- debug-print "No GNOME 2 GConf schemas found"
- return
- fi
-
- unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
- 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
- debug-print "Uninstalling gconf schema: ${F}"
- "${updater}" --makefile-uninstall-rule "${EROOT}${F}" 1>/dev/null
- fi
- done
-
- # have gconf reload the new schemas
- pids=$(pgrep -x gconfd-2)
- if [[ $? == 0 ]] ; then
- ebegin "Reloading GConf schemas"
- kill -HUP ${pids}
- eend $?
- fi
-}
-
-# @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 function should be called from pkg_preinst.
-gnome2_icon_savelist() {
- has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
- 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 if the current ebuild
-# have installed anything under that location.
-# This function should be called from pkg_postinst and pkg_postrm.
-gnome2_icon_cache_update() {
- has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
- local updater="${EROOT}${GTK_UPDATE_ICON_CACHE}"
-
- if [[ ! -x "${updater}" ]] ; then
- debug-print "${updater} is not executable"
- return
- fi
-
- ebegin "Updating icons cache"
-
- local retval=0
- local fails=( )
-
- for dir in "${EROOT%/}"/usr/share/icons/*
- do
- if [[ -f "${dir}/index.theme" ]] ; then
- local rv=0
-
- "${updater}" -qf "${dir}"
- rv=$?
-
- if [[ ! $rv -eq 0 ]] ; then
- debug-print "Updating cache failed on ${dir}"
-
- # Add to the list of failures
- fails+=( "${dir}" )
-
- retval=2
- fi
- elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then
- # Clear stale cache files after theme uninstallation
- rm "${dir}/icon-theme.cache"
- fi
-
- if [[ -z $(ls "${dir}") ]]; then
- # Clear empty theme directories after theme uninstallation
- rmdir "${dir}"
- fi
- done
-
- eend ${retval}
-
- for f in "${fails[@]}" ; do
- eerror "Failed to update cache with icon $f"
- done
-}
-
-# @FUNCTION: gnome2_omf_fix
-# @DESCRIPTION:
-# Workaround applied to Makefile rules in order to remove redundant
-# calls to scrollkeeper-update and sandbox violations.
-# This function should be called from src_prepare.
-gnome2_omf_fix() {
- local omf_makefiles filename
-
- omf_makefiles="$@"
-
- if [[ -f ${S}/omf.make ]] ; then
- omf_makefiles="${omf_makefiles} ${S}/omf.make"
- fi
-
- if [[ -f ${S}/gnome-doc-utils.make ]] ; then
- omf_makefiles="${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
-
- ebegin "Fixing OMF Makefiles"
-
- local retval=0
- local fails=( )
-
- for omf in ${omf_makefiles} ; do
- sed -i -e 's:scrollkeeper-update:true:' "${omf}"
- retval=$?
-
- if [[ $retval -ne 0 ]] ; then
- debug-print "updating of ${omf} failed"
-
- # Add to the list of failures
- fails[$(( ${#fails[@]} + 1 ))]=$omf
-
- retval=2
- fi
- done
-
- eend $retval
-
- for f in "${fails[@]}" ; do
- eerror "Failed to update OMF Makefile $f"
- done
-}
-
-# @FUNCTION: gnome2_scrollkeeper_savelist
-# @DESCRIPTION:
-# Find the scrolls that are about to be installed and save their location
-# in the GNOME2_ECLASS_SCROLLS environment variable.
-# This function should be called from pkg_preinst.
-gnome2_scrollkeeper_savelist() {
- has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
- pushd "${ED}" > /dev/null || die
- export GNOME2_ECLASS_SCROLLS=$(find 'usr/share/omf' -type f -name "*.omf" 2> /dev/null)
- popd > /dev/null || die
-}
-
-# @FUNCTION: gnome2_scrollkeeper_update
-# @DESCRIPTION:
-# Updates the global scrollkeeper database.
-# This function should be called from pkg_postinst and pkg_postrm.
-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"
- return
- fi
-
- if [[ -z "${GNOME2_ECLASS_SCROLLS}" ]]; then
- debug-print "No scroll cache to update"
- return
- fi
-
- ebegin "Updating scrollkeeper database ..."
- "${updater}" -q -p "${EROOT}${SCROLLKEEPER_DIR}"
- eend $?
-}
-
-# @FUNCTION: gnome2_schemas_savelist
-# @DESCRIPTION:
-# Find if there is any GSettings schema to install and save the list in
-# GNOME2_ECLASS_GLIB_SCHEMAS variable.
-# This function should be called from pkg_preinst.
-gnome2_schemas_savelist() {
- has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
- pushd "${ED}" > /dev/null || die
- export GNOME2_ECLASS_GLIB_SCHEMAS=$(find 'usr/share/glib-2.0/schemas' -name '*.gschema.xml' 2>/dev/null)
- popd > /dev/null || die
-}
-
-# @FUNCTION: gnome2_schemas_update
-# @USAGE: gnome2_schemas_update
-# @DESCRIPTION:
-# Updates GSettings schemas if GNOME2_ECLASS_GLIB_SCHEMAS has some.
-# This function should be called from pkg_postinst and pkg_postrm.
-gnome2_schemas_update() {
- has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
- local updater="${EROOT}${GLIB_COMPILE_SCHEMAS}"
-
- if [[ ! -x ${updater} ]]; then
- debug-print "${updater} is not executable"
- return
- fi
-
- ebegin "Updating GSettings schemas"
- ${updater} --allow-any-name "$@" "${EROOT%/}/usr/share/glib-2.0/schemas" &>/dev/null
- eend $?
-}
-
-# @FUNCTION: gnome2_gdk_pixbuf_savelist
-# @DESCRIPTION:
-# Find if there is any gdk-pixbuf loader to install and save the list in
-# GNOME2_ECLASS_GDK_PIXBUF_LOADERS variable.
-# This function should be called from pkg_preinst.
-gnome2_gdk_pixbuf_savelist() {
- has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
- pushd "${ED}" > /dev/null || die
- export GNOME2_ECLASS_GDK_PIXBUF_LOADERS=$(find usr/lib*/gdk-pixbuf-2.0 -type f 2>/dev/null)
- popd > /dev/null || die
-}
-
-# @FUNCTION: gnome2_gdk_pixbuf_update
-# @USAGE: gnome2_gdk_pixbuf_update
-# @DESCRIPTION:
-# 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() {
- has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
- local updater="${EROOT}/usr/bin/${CHOST}-gdk-pixbuf-query-loaders"
-
- if [[ ! -x ${updater} ]]; then
- updater="${EROOT}/usr/bin/gdk-pixbuf-query-loaders"
- fi
-
- if [[ ! -x ${updater} ]]; then
- debug-print "${updater} is not executable"
- return
- fi
-
- if [[ -z ${GNOME2_ECLASS_GDK_PIXBUF_LOADERS} ]]; then
- debug-print "gdk-pixbuf loader cache does not need an update"
- return
- fi
-
- ebegin "Updating gdk-pixbuf loader cache"
- local tmp_file=$(emktemp)
- ${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" &&
- rm "${tmp_file}" # don't replace this with mv, required for SELinux support
- eend $?
-}
-
-# @FUNCTION: gnome2_query_immodules_gtk2
-# @USAGE: gnome2_query_immodules_gtk2
-# @DESCRIPTION:
-# 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
-
- ebegin "Updating gtk2 input method module cache"
- GTK_IM_MODULE_FILE="${EROOT}usr/$(get_libdir)/gtk-2.0/2.10.0/immodules.cache" \
- "${updater}" --update-cache
- eend $?
-}
-
-# @FUNCTION: gnome2_query_immodules_gtk3
-# @USAGE: gnome2_query_immodules_gtk3
-# @DESCRIPTION:
-# 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
-
- ebegin "Updating gtk3 input method module cache"
- GTK_IM_MODULE_FILE="${EROOT}usr/$(get_libdir)/gtk-3.0/3.0.0/immodules.cache" \
- "${updater}" --update-cache
- eend $?
-}
-
-# @FUNCTION: gnome2_giomodule_cache_update
-# @USAGE: gnome2_giomodule_cache_update
-# @DESCRIPTION:
-# Updates glib's gio modules cache.
-# This function should be called from pkg_postinst and pkg_postrm.
-gnome2_giomodule_cache_update() {
- has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
- local updater="${EROOT}/usr/bin/${CHOST}-gio-querymodules"
-
- if [[ ! -x ${updater} ]]; then
- updater="${EROOT}/usr/bin/gio-querymodules"
- fi
-
- if [[ ! -x ${updater} ]]; then
- debug-print "${updater} is not executable"
- return
- fi
-
- ebegin "Updating GIO modules cache"
- ${updater} "${EROOT%/}"/usr/$(get_libdir)/gio/modules
- eend $?
-}
-
-# @FUNCTION: gnome2_disable_deprecation_warning
-# @DESCRIPTION:
-# Disable deprecation warnings commonly found in glib based packages.
-# Should be called from src_prepare.
-gnome2_disable_deprecation_warning() {
- local retval=0
- local fails=( )
- local makefile
-
- ebegin "Disabling deprecation warnings"
- # 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
- while read makefile ; do
- if ! grep -qE "(DISABLE_DEPRECATED|GSEAL_ENABLE)" "${makefile}"; then
- continue
- fi
-
- LC_ALL=C sed -r -i \
- -e 's:-D[A-Z_]+_DISABLE_DEPRECATED:$(/bin/true):g' \
- -e 's:-DGSEAL_ENABLE(=[A-Za-z0-9_]*)?:$(/bin/true):g' \
- -i "${makefile}"
-
- if [[ $? -ne 0 ]]; then
- # Add to the list of failures
- fails+=( "${makefile}" )
- retval=2
- fi
- done < <(find "${S}" -name "Makefile.in" \
- -o -name "Makefile.am" -o -name "Makefile.decl" \
- | sort; [[ -f "${S}"/configure ]] && echo configure)
-# TODO: sedding configure.ac can trigger maintainer mode; bug #439602
-# -o -name "configure.ac" -o -name "configure.in" \
-# | sort; echo configure)
- eend ${retval}
-
- for makefile in "${fails[@]}" ; do
- ewarn "Failed to disable deprecation warnings in ${makefile}"
- done
-}
diff --git a/eclass/multibuild.eclass b/eclass/multibuild.eclass
deleted file mode 100644
index c29f4d89..00000000
--- a/eclass/multibuild.eclass
+++ /dev/null
@@ -1,282 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-# @ECLASS: multibuild.eclass
-# @MAINTAINER:
-# Michał Górny <mgorny@gentoo.org>
-# @AUTHOR:
-# Author: Michał Górny <mgorny@gentoo.org>
-# @BLURB: A generic eclass for building multiple variants of packages.
-# @DESCRIPTION:
-# The multibuild eclass aims to provide a generic framework for building
-# multiple 'variants' of a package (e.g. multilib, Python
-# implementations).
-
-case "${EAPI:-0}" in
- 0|1|2|3)
- die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
- ;;
- 4|5|6)
- ;;
- *)
- die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
- ;;
-esac
-
-if [[ ! ${_MULTIBUILD} ]]; then
-
-# @ECLASS-VARIABLE: MULTIBUILD_VARIANTS
-# @DESCRIPTION:
-# An array specifying all enabled variants which multibuild_foreach*
-# can execute the process for.
-#
-# In ebuild, it can be set in global scope. Eclasses should set it
-# locally in function scope to support nesting properly.
-#
-# Example:
-# @CODE
-# python_foreach_impl() {
-# local MULTIBUILD_VARIANTS=( python{2_5,2_6,2_7} ... )
-# multibuild_foreach_variant python_compile
-# }
-# @CODE
-
-# @ECLASS-VARIABLE: MULTIBUILD_VARIANT
-# @DESCRIPTION:
-# The current variant which the function was executed for.
-#
-# If nested multibuilds are used, this value can be an array. In that
-# case, the first element will name the deepest multibuild, and the next
-# elements will go outwards.
-#
-# Example value:
-# @CODE
-# python2_6
-# @CODE
-
-# @ECLASS-VARIABLE: MULTIBUILD_ID
-# @DESCRIPTION:
-# The unique identifier for a multibuild run. In a simple run, it is
-# equal to MULTIBUILD_VARIANT. In a nested multibuild environment, it
-# contains the complete selection tree.
-#
-# It can be used to create variant-unique directories and files.
-#
-# If nested multibuilds are used, this value can be an array. In that
-# case, the first element will name the deepest multibuild, and the next
-# elements will go outwards.
-#
-# Example value:
-# @CODE
-# amd64-double
-# @CODE
-
-# @ECLASS-VARIABLE: BUILD_DIR
-# @DESCRIPTION:
-# The current build directory. In global scope, it is supposed
-# to contain an 'initial' build directory. If unset, ${S} is used.
-#
-# multibuild_foreach_variant() sets BUILD_DIR locally
-# to variant-specific build directories based on the initial value
-# of BUILD_DIR.
-#
-# If nested multibuilds are used, this value can be an array. In that
-# case, the first element will name the deepest multibuild, and the next
-# elements will go outwards.
-#
-# Example value:
-# @CODE
-# ${WORKDIR}/foo-1.3-python2_6
-# @CODE
-
-# @FUNCTION: multibuild_foreach_variant
-# @USAGE: [<argv>...]
-# @DESCRIPTION:
-# Run the passed command repeatedly for each of the enabled package
-# variants.
-#
-# Each of the runs will have variant-specific BUILD_DIR set, and output
-# teed to a separate log in ${T}.
-#
-# The function returns 0 if all commands return 0, or the first non-zero
-# exit status otherwise. However, it performs all the invocations
-# nevertheless. It is preferred to call 'die' inside of the passed
-# function.
-multibuild_foreach_variant() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${MULTIBUILD_VARIANTS} ]] \
- || die "MULTIBUILD_VARIANTS need to be set"
-
- local bdir=${BUILD_DIR:-${S}}
-
- # Avoid writing outside WORKDIR if S=${WORKDIR}.
- [[ ${bdir%%/} == ${WORKDIR%%/} ]] && bdir=${WORKDIR}/build
-
- local prev_id=${MULTIBUILD_ID:+${MULTIBUILD_ID}-}
- local ret=0 lret=0 v
-
- debug-print "${FUNCNAME}: initial build_dir = ${bdir}"
-
- for v in "${MULTIBUILD_VARIANTS[@]}"; do
- local MULTIBUILD_VARIANT=( "${v}" "${MULTIBUILD_VARIANT[@]}" )
- local MULTIBUILD_ID=( "${prev_id}${v}" "${MULTIBUILD_ID[@]}" )
- local BUILD_DIR=( "${bdir%%/}-${v}" "${BUILD_DIR[@]}" )
-
- _multibuild_run() {
- # find the first non-private command
- local i=1
- while [[ ${!i} == _* ]]; do
- (( i += 1 ))
- done
-
- [[ ${i} -le ${#} ]] && einfo "${v}: running ${@:${i}}"
- "${@}"
- }
-
- _multibuild_run "${@}" \
- > >(exec tee -a "${T}/build-${MULTIBUILD_ID}.log") 2>&1
- lret=${?}
- done
- [[ ${ret} -eq 0 && ${lret} -ne 0 ]] && ret=${lret}
-
- return ${ret}
-}
-
-# @FUNCTION: multibuild_parallel_foreach_variant
-# @USAGE: [<argv>...]
-# @DESCRIPTION:
-# Run the passed command repeatedly for each of the enabled package
-# variants. This used to run the commands in parallel but now it's
-# just a deprecated alias to multibuild_foreach_variant.
-#
-# The function returns 0 if all commands return 0, or the first non-zero
-# exit status otherwise. However, it performs all the invocations
-# nevertheless. It is preferred to call 'die' inside of the passed
-# function.
-multibuild_parallel_foreach_variant() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}"
-
- multibuild_foreach_variant "${@}"
-}
-
-# @FUNCTION: multibuild_for_best_variant
-# @USAGE: [<argv>...]
-# @DESCRIPTION:
-# Run the passed command once, for the best of the enabled package
-# variants.
-#
-# The run will have a proper, variant-specificBUILD_DIR set, and output
-# teed to a separate log in ${T}.
-#
-# The function returns command exit status.
-multibuild_for_best_variant() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${MULTIBUILD_VARIANTS} ]] \
- || die "MULTIBUILD_VARIANTS need to be set"
-
- # bash-4.1 can't handle negative subscripts
- local MULTIBUILD_VARIANTS=(
- "${MULTIBUILD_VARIANTS[$(( ${#MULTIBUILD_VARIANTS[@]} - 1 ))]}"
- )
- multibuild_foreach_variant "${@}"
-}
-
-# @FUNCTION: multibuild_copy_sources
-# @DESCRIPTION:
-# Create per-variant copies of source tree. The source tree is assumed
-# to be in ${BUILD_DIR}, or ${S} if the former is unset. The copies will
-# be placed in directories matching BUILD_DIRs used by
-# multibuild_foreach().
-multibuild_copy_sources() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local _MULTIBUILD_INITIAL_BUILD_DIR=${BUILD_DIR:-${S}}
-
- einfo "Will copy sources from ${_MULTIBUILD_INITIAL_BUILD_DIR}"
-
- local cp_args=()
- if cp --reflink=auto --version &>/dev/null; then
- # enable reflinking if possible to make this faster
- cp_args+=( --reflink=auto )
- fi
-
- _multibuild_create_source_copy() {
- einfo "${MULTIBUILD_VARIANT}: copying to ${BUILD_DIR}"
- cp -p -R "${cp_args[@]}" \
- "${_MULTIBUILD_INITIAL_BUILD_DIR}" "${BUILD_DIR}" || die
- }
-
- multibuild_foreach_variant _multibuild_create_source_copy
-}
-
-# @FUNCTION: run_in_build_dir
-# @USAGE: <argv>...
-# @DESCRIPTION:
-# Run the given command in the directory pointed by BUILD_DIR.
-run_in_build_dir() {
- debug-print-function ${FUNCNAME} "${@}"
- local ret
-
- [[ ${#} -ne 0 ]] || die "${FUNCNAME}: no command specified."
- [[ ${BUILD_DIR} ]] || die "${FUNCNAME}: BUILD_DIR not set."
-
- mkdir -p "${BUILD_DIR}" || die
- pushd "${BUILD_DIR}" >/dev/null || die
- "${@}"
- ret=${?}
- popd >/dev/null || die
-
- return ${ret}
-}
-
-# @FUNCTION: multibuild_merge_root
-# @USAGE: <src-root> <dest-root>
-# @DESCRIPTION:
-# Merge the directory tree (fake root) from <src-root> to <dest-root>
-# (the real root). Both directories have to be real, absolute paths
-# (i.e. including ${D}). Source root will be removed.
-multibuild_merge_root() {
- local src=${1}
- local dest=${2}
-
- local ret
-
- if use userland_BSD; then
- # Most of BSD variants fail to copy broken symlinks, #447370
- # also, they do not support --version
-
- tar -C "${src}" -f - -c . \
- | tar -x -f - -C "${dest}"
- [[ ${PIPESTATUS[*]} == '0 0' ]]
- ret=${?}
- else
- local cp_args=()
-
- if cp -a --version &>/dev/null; then
- cp_args+=( -a )
- else
- cp_args+=( -P -R -p )
- fi
-
- if cp --reflink=auto --version &>/dev/null; then
- # enable reflinking if possible to make this faster
- cp_args+=( --reflink=auto )
- fi
-
- cp "${cp_args[@]}" "${src}"/. "${dest}"/
- ret=${?}
- fi
-
- if [[ ${ret} -ne 0 ]]; then
- die "${MULTIBUILD_VARIANT:-(unknown)}: merging image failed."
- fi
-
- rm -rf "${src}"
-}
-
-_MULTIBUILD=1
-fi