From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id D91AA1384B4 for ; Sun, 29 Nov 2015 12:27:49 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 106BB21C154; Sun, 29 Nov 2015 12:24:57 +0000 (UTC) Received: from hetzner3.not-your-server.de (hetzner3.not-your-server.de [144.76.31.203]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 830EB21C08F for ; Sun, 29 Nov 2015 12:24:53 +0000 (UTC) Received: from localhost (localhost [IPv6:::1]) by hetzner3.not-your-server.de (Postfix) with ESMTP id 53A541057C2; Sun, 29 Nov 2015 13:24:51 +0100 (CET) X-Virus-Scanned: amavisd-new at not-your-server.de Received: from hetzner3.not-your-server.de ([127.0.0.1]) by localhost (hetzner3.not-your-server.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id m2PqdwKh641c; Sun, 29 Nov 2015 13:24:50 +0100 (CET) Received: from leo.ics.kfa-juelich.de (static-2-1006.not-your-server.de [IPv6:2a01:4f8:191:22ca::2:1006]) by hetzner3.not-your-server.de (Postfix) with ESMTP id EE5091057C6; Sun, 29 Nov 2015 13:24:49 +0100 (CET) From: Justin Lecher To: gentoo-dev@lists.gentoo.org Cc: Justin Lecher Subject: [gentoo-dev] [PATCH 6/8] virtualx.eclass: Simplify API into single virtx() Date: Sun, 29 Nov 2015 13:24:42 +0100 Message-Id: <1448799884-29158-7-git-send-email-jlec@gentoo.org> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1448799884-29158-1-git-send-email-jlec@gentoo.org> References: <565AE956.5060602@gentoo.org> <1448799884-29158-1-git-send-email-jlec@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: fe000766-7ff2-48de-a826-c6bd48c54a69 X-Archives-Hash: d11b121b4b71bd32da9c9f8d55f0f651 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 --- 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 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