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 763241384B4 for ; Sat, 28 Nov 2015 16:23:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 21EAE21C10A; Sat, 28 Nov 2015 16:21:17 +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 D74A421C0EA for ; Sat, 28 Nov 2015 16:21:14 +0000 (UTC) Received: from localhost (localhost [IPv6:::1]) by hetzner3.not-your-server.de (Postfix) with ESMTP id D1044105828; Sat, 28 Nov 2015 17:21:12 +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 13TpWtb_wTcQ; Sat, 28 Nov 2015 17:21:11 +0100 (CET) Received: from leo.ics.kfa-juelich.de (static-2-1002.not-your-server.de [IPv6:2a01:4f8:191:22ca::2:1002]) by hetzner3.not-your-server.de (Postfix) with ESMTP id 3996310582A; Sat, 28 Nov 2015 17:21:10 +0100 (CET) From: Justin Lecher To: gentoo-dev@lists.gentoo.org Cc: Justin Lecher Subject: [gentoo-dev] [PATCH 7/8] virtualx.eclass: Simplify API into single virtx() Date: Sat, 28 Nov 2015 17:21:03 +0100 Message-Id: <1448727664-25886-7-git-send-email-jlec@gentoo.org> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1448727664-25886-1-git-send-email-jlec@gentoo.org> References: <5E6CCF53-839B-4BBD-B9BB-BFF4D70612A0@gentoo.org> <1448727664-25886-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: a6f0bf96-5403-42cd-8cc0-0eb5e2d17e78 X-Archives-Hash: 9fd26d196e0abedd2da1ccd9dce1fdad 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 | 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 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