* [PATCH] Portability patch for tools/check
@ 2006-12-14 15:47 Christoph Egger
2006-12-14 16:03 ` Guillaume Rousse
2006-12-14 17:16 ` Ewan Mellor
0 siblings, 2 replies; 3+ messages in thread
From: Christoph Egger @ 2006-12-14 15:47 UTC (permalink / raw)
To: xen-devel
[-- Attachment #1: Type: text/plain, Size: 147 bytes --]
Hi!
I did a little off-list discussion with Jan.
Attached is a patch, which makes the non-portable scripts in tools/check
portable.
Christoph
[-- Attachment #2: xen_tools_check.diff --]
[-- Type: text/x-diff, Size: 3389 bytes --]
diff -r 360eb996fa38 tools/check/check_crypto_lib
--- a/tools/check/check_crypto_lib Wed Dec 13 16:13:26 2006 +0000
+++ b/tools/check/check_crypto_lib Thu Dec 14 15:42:00 2006 +0100
@@ -1,11 +1,14 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD CHECK-INSTALL
-function error {
- echo
- echo " *** Check for crypto library FAILED"
- exit 1
-}
+RC=0
set -e
-ldconfig -p | grep -q libcrypto.so || error
+ldconfig -v 2>&1 | grep -q libcrypto.so || RC=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for crypto library FAILED"
+fi
+
+exit ${RC}
diff -r 360eb996fa38 tools/check/check_openssl_devel
--- a/tools/check/check_openssl_devel Wed Dec 13 16:13:26 2006 +0000
+++ b/tools/check/check_openssl_devel Thu Dec 14 15:45:32 2006 +0100
@@ -1,11 +1,14 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD
-function error {
- echo
- echo " *** Check for openssl headers FAILED"
- exit 1
-}
+RC=0
set -e
-[ -e /usr/include/openssl/md5.h ] || error
+test -r /usr/include/openssl/md5.h || RC=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for openssl headers FAILED"
+fi
+
+exit ${RC}
diff -r 360eb996fa38 tools/check/check_python_devel
--- a/tools/check/check_python_devel Wed Dec 13 16:13:26 2006 +0000
+++ b/tools/check/check_python_devel Thu Dec 14 15:46:50 2006 +0100
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD
function error {
@@ -7,10 +7,19 @@ function error {
exit 1
}
+RC=0
+
python -c '
import os.path, sys
for p in sys.path:
if os.path.exists(p + "/config/Makefile"):
sys.exit(0)
sys.exit(1)
-' || error
+' || RC=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for python development environment FAILED"
+fi
+
+exit ${RC}
diff -r 360eb996fa38 tools/check/check_udev
--- a/tools/check/check_udev Wed Dec 13 16:13:26 2006 +0000
+++ b/tools/check/check_udev Thu Dec 14 16:28:56 2006 +0100
@@ -1,16 +1,33 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-INSTALL
-function error {
- echo
- echo ' *** Check for udev/hotplug FAILED'
- exit 1
-}
-[ -x "$(which udevinfo)" ] && \
- UDEV_VERSION=$(udevinfo -V | sed -e 's/^[^0-9]* \([0-9]\{1,\}\)[^0-9]\{0,\}/\1/')
+RC=0
-if [ -n "$UDEV_VERSION" ] && [ $UDEV_VERSION -ge 059 ]; then
- exit 0
+case ${OS} in
+OpenBSD|NetBSD|FreeBSD)
+ TOOL="vnconfig"
+ which ${TOOL} 1>/dev/null 2>&1 || RC=1
+ ;;
+Linux)
+ TOOL="udevinfo"
+ test -x "$(which ${TOOL})" && \
+ UDEV_VERSION=$(${TOOL} -V | sed -e 's/^[^0-9]* \([0-9]\{1,\}\)[^0-9]\{0,\}/\1/')
+ if test -n "${UDEV_VERSION}" -a ${UDEV_VERSION} -ge 059; then
+ RC=0
+ else
+ TOOL="hotplug"
+ which ${TOOL} 1>/dev/null 2>&1 || RC=1
+ fi
+ ;;
+*)
+ TOOL=""
+ echo "Unknown OS" && RC=1
+ ;;
+esac
+
+if test ${RC} -ne 0; then
+ echo
+ echo ' *** Check for ${TOOL} FAILED'
fi
-which hotplug 1>/dev/null 2>&1 || error
+exit ${RC}
diff -r 360eb996fa38 tools/check/check_x11_devel
--- a/tools/check/check_x11_devel Wed Dec 13 16:13:26 2006 +0000
+++ b/tools/check/check_x11_devel Thu Dec 14 15:50:22 2006 +0100
@@ -1,11 +1,15 @@
-#!/bin/bash
+#!/bin/sh
# CHECK-BUILD
-function error {
- echo
- echo " *** Check for x11 headers FAILED"
- exit 1
-}
+RC=0
set -e
-[ -e /usr/include/X11/keysymdef.h ] || error
+test -r /usr/include/X11/keysymdef.h || \
+test -r /usr/X11R6/include/X11/keysymdef.h || RC=1
+
+if test ${RC} -ne 0; then
+ echo
+ echo " *** Check for x11 headers FAILED"
+fi
+
+exit ${RC}
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Portability patch for tools/check
2006-12-14 15:47 [PATCH] Portability patch for tools/check Christoph Egger
@ 2006-12-14 16:03 ` Guillaume Rousse
2006-12-14 17:16 ` Ewan Mellor
1 sibling, 0 replies; 3+ messages in thread
From: Guillaume Rousse @ 2006-12-14 16:03 UTC (permalink / raw)
To: xen-devel
Christoph Egger wrote:
> Hi!
>
> I did a little off-list discussion with Jan.
>
> Attached is a patch, which makes the non-portable scripts in tools/check
> portable.
I know I'm risking a flame war here, but why reinvent the wheel instead
of using a dedicated build system (autotools, scons, cmake, whatever) ?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Portability patch for tools/check
2006-12-14 15:47 [PATCH] Portability patch for tools/check Christoph Egger
2006-12-14 16:03 ` Guillaume Rousse
@ 2006-12-14 17:16 ` Ewan Mellor
1 sibling, 0 replies; 3+ messages in thread
From: Ewan Mellor @ 2006-12-14 17:16 UTC (permalink / raw)
To: Christoph Egger; +Cc: xen-devel
On Thu, Dec 14, 2006 at 04:47:19PM +0100, Christoph Egger wrote:
>
> Hi!
>
> I did a little off-list discussion with Jan.
>
> Attached is a patch, which makes the non-portable scripts in tools/check
> portable.
>
> Christoph
>
> [Snip]
>
> diff -r 360eb996fa38 tools/check/check_python_devel
> --- a/tools/check/check_python_devel Wed Dec 13 16:13:26 2006 +0000
> +++ b/tools/check/check_python_devel Thu Dec 14 15:46:50 2006 +0100
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
> # CHECK-BUILD
>
> function error {
> @@ -7,10 +7,19 @@ function error {
> exit 1
> }
>
> +RC=0
> +
> python -c '
> import os.path, sys
> for p in sys.path:
> if os.path.exists(p + "/config/Makefile"):
> sys.exit(0)
> sys.exit(1)
> -' || error
> +' || RC=1
> +
> +if test ${RC} -ne 0; then
> + echo
> + echo " *** Check for python development environment FAILED"
> +fi
> +
> +exit ${RC}
So we now have an uncalled error function at the top of the script. Is this
intentional? What's non-portable about functions anyway? POSIX.1 defines a
function definition syntax
(http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html).
Ewan.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-12-14 17:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-14 15:47 [PATCH] Portability patch for tools/check Christoph Egger
2006-12-14 16:03 ` Guillaume Rousse
2006-12-14 17:16 ` Ewan Mellor
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.