From: "Tomas Chvatal" <scarabeus@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/x11:master commit in: eclass/
Date: Fri, 18 Feb 2011 13:19:37 +0000 (UTC) [thread overview]
Message-ID: <aa5bc2471592baebcee90c9851af4cff31124617.scarabeus@gentoo> (raw)
commit: aa5bc2471592baebcee90c9851af4cff31124617
Author: Tomas Chvatal <scarabeus <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 18 13:18:50 2011 +0000
Commit: Tomas Chvatal <scarabeus <AT> gentoo <DOT> org>
CommitDate: Fri Feb 18 13:18:50 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/x11.git;a=commit;h=aa5bc247
virtualx.eclass cleanups
---
eclass/virtualx.eclass | 105 +++++++++++++++++++++++++----------------------
1 files changed, 56 insertions(+), 49 deletions(-)
diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass
index 52d1284..5312f77 100644
--- a/eclass/virtualx.eclass
+++ b/eclass/virtualx.eclass
@@ -6,28 +6,32 @@
# @ECLASS: virtualx.eclass
# @MAINTAINER:
-# x11@gentoo.org
+# x11@gentoo.org
# @BLURB: This eclass can be used for packages that needs a working X environment to build.
# @ECLASS-VARIABLE: VIRTUALX_REQUIRED
# @DESCRIPTION:
-# Is a dependency on xorg-server and xhost needed?
-# Valid values are "always", "optional", and "manual".
-# "tests" is a synonym for "optional".
+# Is a dependency on xorg-server and xhost needed?
+# Valid values are "always", "optional", and "manual".
+# "tests" is a synonym for "optional".
: ${VIRTUALX_REQUIRED:=optional}
# @ECLASS-VARIABLE: VIRTUALX_USE
# @DESCRIPTION:
-# If VIRTUALX_REQUIRED=optional, what USE flag should control
-# the dependency?
+# If VIRTUALX_REQUIRED=optional, what USE flag should control
+# the dependency?
: ${VIRTUALX_USE:=test}
# @ECLASS-VARIABLE: VIRTUALX_DEPEND
# @DESCRIPTION:
-# Dep string available for use outside of eclass, in case a more
-# complicated dep is needed.
-VIRTUALX_DEPEND="!prefix? ( x11-base/xorg-server )
- x11-apps/xhost"
+# Dep string available for use outside of eclass, in case a more
+# complicated dep is needed.
+VIRTUALX_DEPEND="
+ !prefix? ( x11-base/xorg-server[-minimal] )
+ x11-apps/xhost
+"
+
+has "${EAPI:-0}" 0 1 && die "virtualx eclass require EAPI=2 or newer."
case ${VIRTUALX_REQUIRED} in
always)
@@ -51,68 +55,61 @@ case ${VIRTUALX_REQUIRED} in
;;
esac
+# @FUNCTION: Xmake
+# @DESCRIPTION:
+# Function which attach to running X session or start new Xvfb session
+# where the $maketype variable content gets executed.
virtualmake() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local i=0
local retval=0
local OLD_SANDBOX_ON="${SANDBOX_ON}"
local XVFB=$(type -p Xvfb)
local XHOST=$(type -p xhost)
+ local xvfbargs="-screen 0 800x600x24"
# If $DISPLAY is not set, or xhost cannot connect to an X
# display, then do the Xvfb hack.
if [[ -n ${XVFB} && -n ${XHOST} ]] && \
- ( [[ -z ${DISPLAY} ]] || ! (${XHOST} &>/dev/null) ) ; then
+ ( [[ -z ${DISPLAY} ]] || ! (${XHOST} &>/dev/null) ) ; then
+ debug-print "${FUNCNAME}: running Xvfb hack"
export XAUTHORITY=
# The following is derived from Mandrake's hack to allow
# compiling without the X display
einfo "Scanning for an open DISPLAY to start Xvfb ..."
-
- # We really do not want SANDBOX enabled here
- export SANDBOX_ON="0"
-
- local i=0
- XDISPLAY=$(i=0; while [[ -f /tmp/.X${i}-lock ]] ; do ((i++));done; echo ${i})
-
# If we are in a chrooted environment, and there is already a
# X server started outside of the chroot, Xvfb will fail to start
# on the same display (most cases this is :0 ), so make sure
# Xvfb is started, else bump the display number
#
# Azarah - 5 May 2002
- #
- # Changed the mode from 800x600x32 to 800x600x24 because the mfb
- # support has been dropped in Xvfb in the xorg-x11 pre-releases.
- # For now only depths up to 24-bit are supported.
- #
- # Sven Wegener <swegener@gentoo.org> - 22 Aug 2004
- #
- # Use "-fp built-ins" because it's only part of the default font path
- # for Xorg but not the other DDXs (Xvfb, Kdrive, etc). Temporarily fixes
- # bug 278487 until xorg-server is properly patched
- #
- # Rémi Cardona <remi@gentoo.org> (10 Aug 2009)
- ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24 &>/dev/null &
+ XDISPLAY=$(i=0; while [[ -f /tmp/.X${i}-lock ]] ; do ((i++));done; echo ${i})
+ debug-print "${FUNCNAME}: XDISPLAY=${XDISPLAY}"
+
+ # We really do not want SANDBOX enabled here
+ export SANDBOX_ON="0"
+
+ debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs}"
+ ${XVFB} :${XDISPLAY} ${xvfbargs} &>/dev/null &
sleep 2
local start=${XDISPLAY}
- while [[ ! -f /tmp/.X${XDISPLAY}-lock ]] ; do
+ while [[ ! -f /tmp/.X${XDISPLAY}-lock ]]; do
# Stop trying after 15 tries
if ((XDISPLAY - start > 15)) ; then
-
- eerror ""
- eerror "Unable to start Xvfb."
- eerror ""
- eerror "'${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24' returns:"
- eerror ""
- ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24
- eerror ""
+ eerror "'${XVFB} :${XDISPLAY} ${xvfbargs}' returns:"
+ echo
+ ${XVFB} :${XDISPLAY} ${xvfbargs}
+ echo
eerror "If possible, correct the above error and try your emerge again."
- eerror ""
- die
+ die "Unable to start Xvfb"
fi
((XDISPLAY++))
- ${XVFB} :${XDISPLAY} -fp built-ins -screen 0 800x600x24 &>/dev/null &
+ debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs}"
+ ${XVFB} :${XDISPLAY} ${xvfbargs} &>/dev/null &
sleep 2
done
@@ -122,15 +119,16 @@ virtualmake() {
einfo "Starting Xvfb on \$DISPLAY=${XDISPLAY} ..."
export DISPLAY=:${XDISPLAY}
- #Do not break on error, but setup $retval, as we need
- #to kill Xvfb
+ # Do not break on error, but setup $retval, as we need
+ # to kill Xvfb
${maketype} "$@"
retval=$?
- #Now kill Xvfb
+ # Now kill Xvfb
kill $(cat /tmp/.X${XDISPLAY}-lock)
else
- #Normal make if we can connect to an X display
+ debug-print "${FUNCNAME}: attaching to running X display"
+ # Normal make if we can connect to an X display
${maketype} "$@"
retval=$?
fi
@@ -140,16 +138,23 @@ virtualmake() {
# @FUNCTION: Xmake
# @DESCRIPTION:
-# Same as "make", but set up the Xvfb hack if needed.
+# Same as "make", but set up the Xvfb hack if needed.
+# Deprecated call.
Xmake() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ ewarn "QA: you should not execute make directly"
+ ewarn "QA: rather execute emake -j1 if you have issues with parallel make"
export maketype="make"
virtualmake "$@"
}
# @FUNCTION: Xemake
# @DESCRIPTION:
-# Same as "emake", but set up the Xvfb hack if needed.
+# Same as "emake", but set up the Xvfb hack if needed.
Xemake() {
+ debug-print-function ${FUNCNAME} "$@"
+
export maketype="emake"
virtualmake "$@"
}
@@ -158,6 +163,8 @@ Xemake() {
# @DESCRIPTION:
# Same as "econf", but set up the Xvfb hack if needed.
Xeconf() {
+ debug-print-function ${FUNCNAME} "$@"
+
export maketype="econf"
virtualmake "$@"
}
next reply other threads:[~2011-02-18 13:19 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-18 13:19 Tomas Chvatal [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-04-20 12:49 [gentoo-commits] proj/x11:master commit in: eclass/ Michał Górny
2011-04-20 11:06 Tomas Chvatal
2011-04-17 20:47 Tomas Chvatal
2011-04-15 19:05 Michał Górny
2011-04-15 17:21 Michał Górny
2011-04-15 17:21 Michał Górny
2011-04-15 17:21 Michał Górny
2011-03-09 13:52 Tomas Chvatal
2011-03-01 18:57 Tomas Chvatal
2011-02-24 14:31 Tomas Chvatal
2011-02-22 13:28 Tomas Chvatal
2011-02-21 19:48 Tomas Chvatal
2011-02-21 19:39 Tomas Chvatal
2011-02-21 19:07 Tomas Chvatal
2011-02-21 18:30 Tomas Chvatal
2011-02-21 18:22 Tomas Chvatal
2011-02-21 18:20 Tomas Chvatal
2011-02-19 13:50 Tomas Chvatal
2011-02-18 14:48 Tomas Chvatal
2011-02-18 13:26 Tomas Chvatal
2011-02-18 13:19 Tomas Chvatal
2011-02-06 15:49 Michał Górny
2011-02-06 15:49 Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aa5bc2471592baebcee90c9851af4cff31124617.scarabeus@gentoo \
--to=scarabeus@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox