Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 4/6] virtualx.eclass: Inline XVFB
Date: Wed, 27 Jul 2022 07:18:50
Message-Id: 20220727071722.277530-5-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/6] virtualx.eclass: Use Xvfb -displayfd ... + cleanup by "Michał Górny"
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 eclass/virtualx.eclass | 15 +++++++--------
4 1 file changed, 7 insertions(+), 8 deletions(-)
5
6 diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass
7 index 05b89e814a42..d1c05e20b246 100644
8 --- a/eclass/virtualx.eclass
9 +++ b/eclass/virtualx.eclass
10 @@ -108,9 +108,8 @@ virtx() {
11 local i=0
12 local retval=0
13 local OLD_SANDBOX_ON="${SANDBOX_ON}"
14 - local XVFB XDISPLAY
15 + local XDISPLAY
16 local xvfbargs=( -screen 0 1280x1024x24 +extension RANDR )
17 - XVFB=$(type -p Xvfb) || die
18
19 debug-print "${FUNCNAME}: running Xvfb hack"
20 export XAUTHORITY=
21 @@ -133,24 +132,24 @@ virtx() {
22 # We really do not want SANDBOX enabled here
23 export SANDBOX_ON="0"
24
25 - debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs[*]}"
26 - ${XVFB} :${XDISPLAY} "${xvfbargs[@]}" &>/dev/null &
27 + debug-print "${FUNCNAME}: Xvfb :${XDISPLAY} ${xvfbargs[*]}"
28 + Xvfb :${XDISPLAY} "${xvfbargs[@]}" &>/dev/null &
29 sleep 2
30
31 local start=${XDISPLAY}
32 while [[ ! -f /tmp/.X${XDISPLAY}-lock ]]; do
33 # Stop trying after 15 tries
34 if ((XDISPLAY - start > 15)) ; then
35 - eerror "'${XVFB} :${XDISPLAY} ${xvfbargs[*]}' returns:"
36 + eerror "'Xvfb :${XDISPLAY} ${xvfbargs[*]}' returns:"
37 echo
38 - ${XVFB} :${XDISPLAY} "${xvfbargs[@]}"
39 + Xvfb :${XDISPLAY} "${xvfbargs[@]}"
40 echo
41 eerror "If possible, correct the above error and try your emerge again."
42 die "Unable to start Xvfb"
43 fi
44 ((XDISPLAY++))
45 - debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs[*]}"
46 - ${XVFB} :${XDISPLAY} "${xvfbargs[@]}" &>/dev/null &
47 + debug-print "${FUNCNAME}: Xvfb :${XDISPLAY} ${xvfbargs[*]}"
48 + Xvfb :${XDISPLAY} "${xvfbargs[@]}" &>/dev/null &
49 sleep 2
50 done
51
52 --
53 2.35.1