From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Christoph Egger" Subject: [PATCH] Portability patch for tools/check Date: Thu, 14 Dec 2006 16:47:19 +0100 Message-ID: <200612141647.19252.Christoph.Egger@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary-00=_HIXgF+Xm32fFQOA" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --Boundary-00=_HIXgF+Xm32fFQOA Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 --Boundary-00=_HIXgF+Xm32fFQOA Content-Type: text/x-diff; charset=us-ascii; name=xen_tools_check.diff Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=xen_tools_check.diff 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} --Boundary-00=_HIXgF+Xm32fFQOA Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Boundary-00=_HIXgF+Xm32fFQOA--