The new API runs all specified arguments to virtx() inside an XFVB, instead of defining VIRTUALX_COMMAND and running that in virtualmake.
Xemake and Xeconf should be replaced by "virtx emake" and "virtx econf". Signed-off-by: Justin Lecher <j...@gentoo.org> --- eclass/virtualx.eclass | 56 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass index d10dbb2..b124034 100644 --- a/eclass/virtualx.eclass +++ b/eclass/virtualx.eclass @@ -91,22 +91,52 @@ esac virtualmake() { debug-print-function ${FUNCNAME} "$@" - local i=0 - local retval=0 - local OLD_SANDBOX_ON="${SANDBOX_ON}" - local XVFB XHOST XDISPLAY - local xvfbargs="-screen 0 1280x1024x24" - XVFB=$(type -p Xvfb) || die - XHOST=$(type -p xhost) || die + [[ ${EAPI} == [2345] ]] || die "${FUNCNAME} is unsupported in EAPI > 5, please use virtx" # backcompat for maketype if [[ -n ${maketype} ]]; then + [[ ${EAPI} == [2345] ]] || die "maketype is banned in EAPI > 5" eqawarn "ebuild is exporting \$maketype=${maketype}" eqawarn "Ebuild should be migrated to use VIRTUALX_COMMAND=${maketype} instead." eqawarn "Setting VIRTUALX_COMMAND to \$maketype conveniently for now." VIRTUALX_COMMAND=${maketype} fi + virtx "${VIRTUALX_COMMAND}" "${@}" +} + + +# @FUNCTION: virtx +# @USAGE: <command> [command arguments] +# @DESCRIPTION: +# Start new Xvfb session and run commands in it. +# +# Example: +# +# @CODE +# src_test() { +# virtx default +# } +# @CODE +# +# @CODE +# python_test() { +# virtx py.test --verbose +# } +# @CODE +virtx() { + debug-print-function ${FUNCNAME} "$@" + + [[ $# -lt 1 ]] && die "${FUNCNAME} needs at least one argument" + + local i=0 + local retval=0 + local OLD_SANDBOX_ON="${SANDBOX_ON}" + local XVFB XHOST XDISPLAY + local xvfbargs="-screen 0 1280x1024x24" + XVFB=$(type -p Xvfb) || die + XHOST=$(type -p xhost) || die + debug-print "${FUNCNAME}: running Xvfb hack" export XAUTHORITY= # The following is derived from Mandrake's hack to allow @@ -156,10 +186,10 @@ virtualmake() { # to kill Xvfb debug-print "${FUNCNAME}: ${VIRTUALX_COMMAND} \"$@\"" if has "${EAPI}" 2 3; then - ${VIRTUALX_COMMAND} "$@" + "$@" retval=$? else - nonfatal ${VIRTUALX_COMMAND} "$@" + nonfatal "$@" retval=$? fi @@ -180,7 +210,7 @@ Xmake() { debug-print-function ${FUNCNAME} "$@" [[ ${EAPI} == [2345] ]] \ - || die "${FUNCNAME} is removed in EAPI > 5; use Xemake -j1 instead" + || die "${FUNCNAME} is unsupported in EAPI > 5, please use 'virtx emake -j1 ....'" eqawarn "you should not execute make directly" eqawarn "rather execute Xemake -j1 if you have issues with parallel make" @@ -193,6 +223,9 @@ Xmake() { Xemake() { debug-print-function ${FUNCNAME} "$@" + [[ ${EAPI} == [2345] ]] \ + || die "${FUNCNAME} is unsupported in EAPI > 5, please use 'virtx emake ....'" + VIRTUALX_COMMAND="emake" virtualmake "$@" } @@ -202,6 +235,9 @@ Xemake() { Xeconf() { debug-print-function ${FUNCNAME} "$@" + [[ ${EAPI} == [2345] ]] \ + || die "${FUNCNAME} is unsupported in EAPI > 5, please use 'virtx econf ....'" + VIRTUALX_COMMAND="econf" virtualmake "$@" } -- 2.6.3