Re: [gentoo-dev] [PATCH 8/8] virtualx.eclass: Simplify API into single virtx()

2015-11-30 Thread Justin Lecher (jlec)
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On 30/11/15 18:40, Davide Pesavento wrote:
> 
> The scenario of bug 517976 is different. I think a minimized test
> case is the following (untested):
> 
> foo() { die "meh" return 0 }
> 
> src_test() { virtx foo }
> 

This example will still break the build, although the Xvfb session
wouldn't get killed. Let's move the discussion to the bug.

Justin

* Scanning for an open DISPLAY to start Xvfb ...
debug: virtx: XDISPLAY=0
debug: virtx: /usr/bin/Xvfb :0 -screen 0 1280x1024x24
 * Starting Xvfb on $DISPLAY=0 ...
debug: virtx: emake "foo"
 * ERROR: app-misc/dummy-1::dummy failed (test phase):
 *   meh
 *
 * Call stack:
 *   ebuild.sh, line  133:  Called src_test
 * environment, line 2076:  Called virtx 'foo'
 * environment, line 2699:  Called nonfatal 'foo'
 *   isolated-functions.sh, line  105:  Called foo
 * environment, line  987:  Called die
 * The specific snippet of code:
 *   die "meh";
 *
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0

iQJ8BAEBCgBmBQJWXUt6XxSAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ0QUU0N0I4NzFERUI0MTJFN0EyODE0NUFF
OTQwMkE3OUIwMzUyOUEyAAoJEOlAKnmwNSmiWGsQALjFU4Z+1yUOUWGyBf7n31hc
FUAq/ZnsFEd8ZPKRSyZVY+os/PjbwMCQQk0U7hUySLZ43mSfzC0aelKMAXx6BYoS
ss8jp2s5LoeIV+YdCIUiIE/y4GHvYwln61W+XrM6TslEaAMVbrKuKoa/TvzE6mrN
Et9ebl7E6LpwTMc72jdGd8KWtkLdl2Ddgt99pKcC9vA7IEZPGlci/Nz7AtHycP3m
YectPEzWVdirNlRcKCDxcCdHbYH1mKjd3kjtatb6nDXURhM4l4qL/OZEdx5mKpyp
EAu+7RzU7XOgyUMuvwWpPtmA/jaR6VSEWJY9W+EwYS3LwNRJczADfEGzE2EGCj+r
0iSOvF2b9DqgO800ENSPH7iUgvgw3pTLqMdUSHsvZg5dw1u08S1DCuB2T1/9Nfin
OUk/zsGELJQ5C0m7a1vugG1PNBmjKNlaKtW+bIDitPgL71GCeQ2QU0Oo5SKRH+bv
Qp2mguaR3nL1xm6MrnRT7bIKW92FRDT2P3eHTRylWg495/i8veaiUL/QBwnegOU5
En4kCyaBusujyT2l5DZnYb6RNOfUWlFQOquaKbK1yRtDsk7tG+HfRkSQR4s6Dlo4
sIdCrjhvgDeTy+6DwcXGWex1nG2ZUkLu36O6uIEFphTgbG3dlXYE1lvrGLwIHyZg
/5PC3gOTW6R0s/DfzDDh
=8pwz
-END PGP SIGNATURE-



Re: [gentoo-dev] [PATCH 8/8] virtualx.eclass: Simplify API into single virtx()

2015-11-30 Thread Davide Pesavento
On Sat, Nov 28, 2015 at 4:50 PM, Justin Lecher (jlec)  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA512
>
> On 28/11/15 16:28, Davide Pesavento wrote:
>>> else -   nonfatal ${VIRTUALX_COMMAND} "$@" +
>>> nonfatal "$@"
>>
>> Please take the opportunity to clean this up, possibly only in
>> EAPI=6 if you don't want to risk breaking existing ebuilds. See bug
>> 517976 for details.
>>
>>> retval=$?
>
> The return value is recorded and gets evaluated correctly.
>
> src_test() {
> virtx false
> }
>
[...]
>
> Am I missing something?

The scenario of bug 517976 is different. I think a minimized test case
is the following (untested):

foo() {
die "meh"
return 0
}

src_test() {
virtx foo
}



Re: [gentoo-dev] [PATCH 8/8] virtualx.eclass: Simplify API into single virtx()

2015-11-28 Thread Justin Lecher (jlec)
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On 28/11/15 16:28, Davide Pesavento wrote:
>> else -   nonfatal ${VIRTUALX_COMMAND} "$@" +
>> nonfatal "$@"
> 
> Please take the opportunity to clean this up, possibly only in
> EAPI=6 if you don't want to risk breaking existing ebuilds. See bug
> 517976 for details.
> 
>> retval=$?

The return value is recorded and gets evaluated correctly.

src_test() {
virtx false
}

results in

 * Scanning for an open DISPLAY to start Xvfb ...
debug: virtx: XDISPLAY=1
debug: virtx: /usr/bin/Xvfb :1 -screen 0 1280x1024x24
 * Starting Xvfb on $DISPLAY=1 ...
debug: virtx: emake "false"
 * ERROR: app-misc/dummy-1::dummy failed (test phase):
 *   virtx: the emake failed.
 *
 * Call stack:
 * ebuild.sh, line  133:  Called src_test
 *   environment, line 2072:  Called virtx 'false'
 *   environment, line 2700:  Called die
 * The specific snippet of code:
 *   [[ ${retval} -ne 0 ]] && die "${FUNCNAME}: the
${VIRTUALX_COMMAND} failed.";
 *

Am I missing something?
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0

iQJ8BAEBCgBmBQJWWc1jXxSAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ0QUU0N0I4NzFERUI0MTJFN0EyODE0NUFF
OTQwMkE3OUIwMzUyOUEyAAoJEOlAKnmwNSmiWGcQAK6VSEgzlaUaJ+AEC/I+M+Rz
uHOmaEE005MsTpUf8GoRY35fnMNkICES9QLZjaSjliBJ6H/WdGDGcqm7rg5yx0j5
v12vv3LMrFX2D/+2SkTurMlGj0gOz+F27ted/p9tmJJLf0KcbusPiJvmjybNjNH+
5ksLdZEdnAj1p9qmXfoJ8IlKHO82GUn2cNS9O0XFW9WhSzmOaE+WOp2hQtX0HzUE
Y6vcVjl5ZD+RDvc2+7oFptOQxGyEZdP43JikAEsfISHnjA4AtYHMLjIHvItaVdoD
8qbG5WAwp0fg1BwqNM6G9neAbknKeGIBLXNBx1QxVj3toz3j3QR88RB1nyovGNp2
7LZjEWYW9/jLpXVTLTg+vwsM6IgvehFdErlXEcWR/q/Gk5Q7C86o3oN4RPaQ93HV
ElxL24u/j1CW1mFzXTgKbM4rxlD8G/aROxiKAh5+66ywSrW1SRhpHSYJxriioco3
iwUyZmBtfCB40+DAHl3cX+yxQ/pKMiR7oN67fsx3F8LEalorcONq5w2e1d0bVbgs
EqdlUqxZKyI6fUK67+rI6Nd2ZBduUpm9mTvJHovPMQ3gK2hyRiE6FkhLf53aMR4S
9cmq1Bmqqw3KGTlIu45gKP6NxUr/+n1dg2LYpZF72eKKhPkNOO68YogKS073VEWc
DJGgOFCpJQIV+BLid0VF
=Nh/f
-END PGP SIGNATURE-



Re: [gentoo-dev] [PATCH 8/8] virtualx.eclass: Simplify API into single virtx()

2015-11-28 Thread Davide Pesavento
On Sat, Nov 28, 2015 at 2:24 PM, Justin Lecher  wrote:
> 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 | 42 --
>  1 file changed, 32 insertions(+), 10 deletions(-)
>
> diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass
> index f9fa879..ca6a1f9 100644
> --- a/eclass/virtualx.eclass
> +++ b/eclass/virtualx.eclass
> @@ -90,22 +90,38 @@ 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:  [comman arguments]

typo comman -> command

> +# @DESCRIPTION:
> +# Function which start new Xvfb session where the command gets executed.

I'd drop "Function which" from the description.

> +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
> @@ -155,10 +171,10 @@ virtualmake() {
> # to kill Xvfb
> debug-print "${FUNCNAME}: ${VIRTUALX_COMMAND} \"$@\""
> if has "${EAPI}" 2 3; then
> -   ${VIRTUALX_COMMAND} "$@"
> +   "$@"
> retval=$?
> else
> -   nonfatal ${VIRTUALX_COMMAND} "$@"
> +   nonfatal "$@"

Please take the opportunity to clean this up, possibly only in EAPI=6
if you don't want to risk breaking existing ebuilds. See bug 517976
for details.

> retval=$?
> fi
>
> @@ -179,7 +195,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"
> @@ -192,6 +208,9 @@ Xmake() {
>  Xemake() {
> debug-print-function ${FUNCNAME} "$@"
>
> +   [[ ${EAPI} == [2345] ]] \
> +   || die "${FUNCNAME} is unsupported in EAPI > 5, please use 
> 'virtx emake '"
> +
> VIRTUALX_COMMAND="emake" virtualmake "$@"
>  }
>
> @@ -201,6 +220,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
>
>



[gentoo-dev] [PATCH 8/8] virtualx.eclass: Simplify API into single virtx()

2015-11-28 Thread Justin Lecher
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 | 42 --
 1 file changed, 32 insertions(+), 10 deletions(-)

diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass
index f9fa879..ca6a1f9 100644
--- a/eclass/virtualx.eclass
+++ b/eclass/virtualx.eclass
@@ -90,22 +90,38 @@ 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:  [comman arguments]
+# @DESCRIPTION:
+# Function which start new Xvfb session where the command gets executed.
+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
@@ -155,10 +171,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
 
@@ -179,7 +195,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"
@@ -192,6 +208,9 @@ Xmake() {
 Xemake() {
debug-print-function ${FUNCNAME} "$@"
 
+   [[ ${EAPI} == [2345] ]] \
+   || die "${FUNCNAME} is unsupported in EAPI > 5, please use 
'virtx emake '"
+
VIRTUALX_COMMAND="emake" virtualmake "$@"
 }
 
@@ -201,6 +220,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