[Ocfs2-test-devel] [PATCH 02/11] ocfs2-test: Add mbvendor.m4 pythondev.m4 and svnrev.guess files.
tristan.ye
tristan.ye at oracle.com
Thu Oct 30 19:54:20 PDT 2008
looks like the same as i saw in ocfs2-tools.
Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
On Thu, 2008-10-30 at 12:32 -0700, Marcos Matsunaga wrote:
> Signed-off-by: Marcos Matsunaga <Marcos.Matsunaga at oracle.com>
> ---
> mbvendor.m4 | 73 +++++++++++++++++++++++++++++
> pythondev.m4 | 27 +++++++++++
> svnrev.guess | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 244 insertions(+), 0 deletions(-)
> create mode 100644 mbvendor.m4
> create mode 100644 pythondev.m4
> create mode 100755 svnrev.guess
>
> diff --git a/mbvendor.m4 b/mbvendor.m4
> new file mode 100644
> index 0000000..4a3a35b
> --- /dev/null
> +++ b/mbvendor.m4
> @@ -0,0 +1,73 @@
> +# MB_VENDOR([VARIABLE])
> +# ---------------------
> +AC_DEFUN([MB_VENDOR],
> + [AC_MSG_CHECKING([for vendor])
> + AC_ARG_WITH(vendor, [ --with-vendor=VENDOR Vendor to tailor build defaults and packages to [common]],[
> + mb_vendor="$withval"
> + if test -x "vendor/${mb_vendor}/vendor.guess"; then
> + if "vendor/${mb_vendor}/vendor.guess" >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
> + AC_MSG_RESULT([$mb_vendor])
> + else
> + AC_MSG_RESULT([not found])
> + AC_MSG_ERROR([Vendor $mb_vendor not detected])
> + fi
> + else
> + AC_MSG_RESULT([not supported])
> + AC_MSG_ERROR([Vendor $mb_vendor not supported])
> + fi
> + ], [
> + mb_vendor=`./vendor.guess 2>&AS_MESSAGE_LOG_FD`
> + if test -z "$mb_vendor"; then
> + AC_MSG_RESULT([not found])
> + else
> + AC_MSG_RESULT([$mb_vendor])
> + fi
> + ])
> + dnl Use 2.13 safe ifelse()
> + ifelse([$1], [], [], [
> + $1="$mb_vendor"
> + AC_SUBST($1)
> + ])
> +]) # MB_VENDOR
> +
> +# MB_VENDOR_KERNEL([VARIABLE])
> +# ---------------------
> +AC_DEFUN([MB_VENDOR_KERNEL],
> + [AC_MSG_CHECKING([for vendor kernel])
> + AC_ARG_WITH(vendorkernel, [ --with-vendorkernel=KERNELVERSION Vendor kernel version to compile against [detected]], [
> + mb_vendorkernel="$withval"
> + if test -z "$mb_vendor"; then
> + AC_MSG_RESULT([no vendor])
> + AC_MSG_ERROR([No vendor specified or discovered])
> + fi
> + if test -x "vendor/${mb_vendor}/kernel.guess"; then
> + mb_vkinclude="`vendor/${mb_vendor}/kernel.guess build ${mb_vendorkernel} 2>&AS_MESSAGE_LOG_FD`"
> + if test -z "$mb_vkinclude"; then
> + AC_MSG_RESULT([not found])
> + AC_MSG_ERROR([Vendor kernel $mb_vendorkernel not detected])
> + else
> + AC_MSG_RESULT([$mb_vkinclude])
> + fi
> + else
> + AC_MSG_RESULT([not supported])
> + AC_MSG_ERROR([Vendor $mb_vendor does not support kernel detection])
> + fi
> + ], [
> + if test -x "vendor/${mb_vendor}/kernel.guess"; then
> + mb_vkinclude="`vendor/${mb_vendor}/kernel.guess build 2>&AS_MESSAGE_LOG_FD`"
> + if test -z "$mb_vkinclude"; then
> + AC_MSG_RESULT([not found])
> + else
> + AC_MSG_RESULT([$mb_vkinclude])
> + fi
> + else
> + mb_vkinclude=
> + AC_MSG_RESULT([not supported])
> + fi
> + ])
> + dnl Use 2.13 safe ifelse()
> + ifelse([$1], [], [], [
> + $1="$mb_vkinclude"
> + AC_SUBST($1)
> + ])
> +]) # MB_VENDOR_KERNEL
> diff --git a/pythondev.m4 b/pythondev.m4
> new file mode 100644
> index 0000000..532f418
> --- /dev/null
> +++ b/pythondev.m4
> @@ -0,0 +1,27 @@
> +## Find the install dirs for the python installation.
> +## By James Henstridge
> +
> +dnl a macro to check for ability to create python extensions
> +dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
> +dnl function also defines PYTHON_INCLUDES
> +AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
> +[AC_REQUIRE([AM_PATH_PYTHON])
> +AC_MSG_CHECKING(for headers required to compile python extensions)
> +dnl deduce PYTHON_INCLUDES
> +py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
> +py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
> +PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
> +if test "$py_prefix" != "$py_exec_prefix"; then
> + PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
> +fi
> +AC_SUBST(PYTHON_INCLUDES)
> +dnl check if the headers exist:
> +save_CPPFLAGS="$CPPFLAGS"
> +CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
> +AC_TRY_CPP([#include <Python.h>],dnl
> +[AC_MSG_RESULT(found)
> +$1],dnl
> +[AC_MSG_RESULT(not found)
> +$2])
> +CPPFLAGS="$save_CPPFLAGS"
> +])
> diff --git a/svnrev.guess b/svnrev.guess
> new file mode 100755
> index 0000000..2c23afc
> --- /dev/null
> +++ b/svnrev.guess
> @@ -0,0 +1,144 @@
> +#!/bin/sh
> +
> +#
> +# This script creates a package version for packages. The package
> +# version is the "release" or other version attached by the packaging
> +# software (eg, RPM or Dpkg) after the upstream software version.
> +#
> +# This software must be invoked like so:
> +#
> +# svnrev.guess <packagename>
> +#
> +# and it expects that release tags are of the form:
> +#
> +# /tags/<packagename>-<version>
> +#
> +# Note that release tag versioning expects a working connection to
> +# the repository (for SVN log), but all other branches don't require it.
> +#
> +# If there is no .svn directory or it cannot discover the repository
> +# version, the script sets a version of 0.local.
> +#
> +
> +if [ $# -lt 1 ]
> +then
> + echo "Usage: svnrev.guess <packagename>" >&2
> + exit 1
> +fi
> +PACKAGE="$1"
> +
> +getstat()
> +{
> + if [ ! -d .svn ]
> + then
> + return
> + fi
> + svn stat -v | awk 'BEGIN{modified = "false";lastrev = 0}
> + /Status against/{next}
> + /^\?/{next}
> + {
> + col1=substr($0, 0, 1);
> + if (col1 != " ") {modified = "true"}
> + sub(/^......../, "");
> + if ($1 > lastrev) { lastrev=$1 }
> + }
> + END{print modified,lastrev}'
> +}
> +
> +#
> +# Branches that are not releases get a work-in-progress package version.
> +# This is 0.<svn_revision>[m]. The 0. ensures that an upcoming real
> +# release, with an package version of 1, will supercede this package.
> +# The "m" is added if the working tree has modifications to distinguish
> +# it from a committed revision.
> +#
> +# If there is no repository or there is a problem getting the revision,
> +# the package version is 0.local.
> +#
> +workingrev()
> +{
> + STATINFO="$(getstat)"
> + MODIFIED=$(echo "$STATINFO" | cut -f1 -d" ")
> + LASTREV=$(echo "$STATINFO" | cut -f2 -d" ")
> +
> + if [ -z "$LASTREV" ]
> + then
> + PKG_VERSION=0.local
> + else
> + PKG_VERSION=0.${LASTREV}
> + if [ "$MODIFIED" = "true" ]
> + then
> + PKG_VERSION="${PKG_VERSION}m"
> + fi
> + fi
> + echo "$PKG_VERSION"
> +}
> +
> +#
> +# If the branch is a tag (tags/project-x.y), it needs a release-based
> +# package version (-1, -2, etc). Generally, it will be the tip of the
> +# branch (package version 1). However, if there is a slight release
> +# fixup, that warrants bumping the package version.
> +#
> +# The logic is pretty simple. Walk the history looking for the
> +# creation of the tag (A /tags/project-x.y). For each revsion later
> +# than the creation of the tag, bump the package version.
> +#
> +releaserev()
> +{
> + BRANCH="$1"
> + BRANCH_SEARCH="`echo "$BRANCH" | sed -e 's/\//\\\\\//g'`"
> + svn log -v 2>&1 |
> + awk 'BEGIN{rev=0}
> + /^r[0-9]+ \|/{rev += 1}
> + /^ +A \/'"$BRANCH_SEARCH"'$/{exit}
> + /^ +A \/'"$BRANCH_SEARCH"' (.*)$/{exit}
> + END{print rev}'
> +}
> +
> +
> +#
> +# Tag branches are releases, and need a release-style package version.
> +# All other branches are non-release, and get an obviously
> +# work-in-progress package version.
> +#
> +# guessbranch() expects the standard Subversion layout of
> +# /trunk
> +# /branches/<branchname>
> +# /tags/<tagname>
> +#
> +guessbranch()
> +{
> + if [ ! -d .svn ]
> + then
> + return
> + fi
> + svn info | awk '/URL: .*\/trunk\/?$/{print "trunk"; exit 0}
> + /URL: .*\/branches\/[^/]+\/?/{
> + gsub(/\/$/, "", $2);
> + sub(/^.*\/branches\//, "", $2);
> + print "branches/"$2;
> + exit 0;
> + }
> + /URL: .*\/tags\/[^/]+\/?/{
> + gsub(/\/$/, "", $2);
> + sub(/^.*\/tags\//, "", $2);
> + print "tags/"$2;
> + exit 0;
> + }'
> +}
> +
> +if ! which svn 1>/dev/null 2>&1
> +then
> + echo "0.local"
> +else
> + BRANCH=$(guessbranch)
> + case "$BRANCH" in
> + tags/${PACKAGE}*)
> + releaserev "$BRANCH"
> + ;;
> + *)
> + workingrev
> + ;;
> + esac
> +fi
More information about the Ocfs2-test-devel
mailing list