[prev in list] [next in list] [prev in thread] [next in thread]
List: gentoo-dev
Subject: [gentoo-dev] [PATCH 6/8] virtualx.eclass: Simplify API into single virtx()
From: Justin Lecher <jlec () gentoo ! org>
Date: 2015-11-29 12:24:42
Message-ID: 1448799884-29158-7-git-send-email-jlec () gentoo ! org
[Download RAW message or body]
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>
---
eclass/virtualx.eclass | 47 +++++++++++++++++++++++++++++++++++++----------
1 file changed, 37 insertions(+), 10 deletions(-)
diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass
index 3df3fe1..bdecda6 100644
--- a/eclass/virtualx.eclass
+++ b/eclass/virtualx.eclass
@@ -89,14 +89,6 @@ 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
-
# backcompat for maketype
if [[ -n ${maketype} ]]; then
eqawarn "ebuild is exporting \$maketype=${maketype}"
@@ -105,6 +97,41 @@ virtualmake() {
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
@@ -154,10 +181,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
--
2.6.3
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic