From: Justin Lecher Date: Sat, 28 Nov 2015 10:53:53 +0000 (+0100) Subject: virtualx.eclass: Simplify API into single virtx() X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=161f0861de512991a879a50b2868c503f4715352;p=gentoo.git virtualx.eclass: Simplify API into single virtx() 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 --- diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass index 3df3fe161f22..7e78205e09c4 100644 --- a/eclass/virtualx.eclass +++ b/eclass/virtualx.eclass @@ -89,6 +89,40 @@ esac virtualmake() { debug-print-function ${FUNCNAME} "$@" + # backcompat for maketype + if [[ -n ${maketype} ]]; then + eqawarn "ebuild is exporting \$maketype=${maketype}" + eqawarn "Ebuild should be migrated to use 'virtx command' instead." + VIRTUALX_COMMAND=${maketype} + fi + + virtx "${VIRTUALX_COMMAND}" "${@}" +} + + +# @FUNCTION: virtx +# @USAGE: [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}" @@ -97,14 +131,6 @@ virtualmake() { XVFB=$(type -p Xvfb) || die XHOST=$(type -p xhost) || die - # backcompat for maketype - if [[ -n ${maketype} ]]; then - 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 - debug-print "${FUNCNAME}: running Xvfb hack" export XAUTHORITY= # The following is derived from Mandrake's hack to allow @@ -154,10 +180,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