summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Lecher <jlec@gentoo.org>2015-11-28 11:53:53 +0100
committerJustin Lecher <jlec@gentoo.org>2015-12-07 10:11:54 +0100
commit161f0861de512991a879a50b2868c503f4715352 (patch)
tree4abd964fa04f1203339906237bbf33ef924314da /eclass/virtualx.eclass
parentvirtualx.eclass: Add missing die (diff)
downloadgentoo-161f0861de512991a879a50b2868c503f4715352.tar.gz
gentoo-161f0861de512991a879a50b2868c503f4715352.tar.bz2
gentoo-161f0861de512991a879a50b2868c503f4715352.zip
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 <jlec@gentoo.org>
Diffstat (limited to 'eclass/virtualx.eclass')
-rw-r--r--eclass/virtualx.eclass46
1 files changed, 36 insertions, 10 deletions
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> [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