dist-hook: cannot-dist
else
dist-hook:
- csh "$(top_srcdir)/config/distscript.csh" "$(top_srcdir)" "$(distdir)" "$(HWLOC_VERSION)" "$(HWLOC_SVN_R)"
+ csh "$(top_srcdir)/config/distscript.csh" "$(top_srcdir)" "$(distdir)" "$(HWLOC_VERSION)"
endif HWLOC_BUILD_README
endif HWLOC_BUILD_DOXYGEN
endif HWLOC_BUILD_STANDALONE
# of hwloc in this distribution. The various components of the version
# number below are combined to form a single version number string.
+# If snapshot=1, then use the value from snapshot_version as the
+# entire hwloc version (i.e., ignore major, minor, release, and
+# greek). This is only set to 1 when making snapshot tarballs.
+snapshot=1
+snapshot_version=gitclone
+
# major, minor, and release are generally combined in the form
# <major>.<minor>.<release>. If release is zero, then it is omitted.
greek=a1
-# If want_repo_rev=1, then the SVN r number will be included in the overall
-# hwloc version number in some form.
-
-want_repo_rev=1
-
-# If repo_rev=-1, then the repository version number will be obtained
-# dynamically at run time, either:
-#
-# 1) via the "svnversion" command (if this is a Subversion checkout)
-# in the form "r<svn_r>", or
-# 2) via the "hg -v -R tip" command (if this is a Mercurial clone)
-# in the form of "hg<hash>", using the hash tag at the tip
-# 3) via the "git log -1" command (if this is a Git clone) in the form
-# of "git<hash>", using the hash tag at the HEAD
-# 4) with the date (if none of the above work) in the form of
-# "date<date>".
-#
-# Alternatively, if repo_rev is not -1, the value of repo_rev_r will
-# be directly appended to the version string. This happens during
-# "make dist", for example: if the distribution tarball is being made
-# from an SVN checkout, if repo_rev=-1, then its value is replaced
-# with the output of "svnversion".
-
-repo_rev=-1
-
# The date when this release was created
date="Unreleased developer copy"
# chapter from the GNU Libtool documentation. Notes:
# 1. Since version numbers are associated with *releases*, the version
-# number maintained on the hwloc SVN trunk (and developer branches) is
-# always 0:0:0.
+# number maintained on the hwloc git master (and developer branches)
+# is always 0:0:0.
# 2. Version numbers are described in the Libtool current:revision:age
# format.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright © 2010 inria. All rights reserved.
-# Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
+# Copyright © 2009-2013 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
set distdir="$builddir/$2"
set HWLOC_VERSION="$3"
-set HWLOC_REPO_REV="$4"
if ("$distdir" == "") then
echo "Must supply relative distdir as argv[2] -- aborting"
set vpath_msg=no
endif
-# We can catch some hard (but possible) to do mistakes by looking at
-# our tree's revision number, but only if we are in the source tree.
-# Otherwise, use what configure told us, at the cost of allowing one
-# or two corner cases in (but otherwise VPATH builds won't work).
-set repo_rev=$HWLOC_REPO_REV
-if (-d .svn) then
- set repo_rev="r`svnversion .`"
+# Check the VERSION file. If snapshot=1 and snapshot_version is
+# empty, then ensure that we're in a source tree and fill in
+# snapshot_version with an appropriate value (note: this case happens
+# when a developer just does "make dist" from a git clone/developer
+# tree, and doesn't use the contrib/nightly/make_nightly_snapshot
+# script, which will edit VERSION before running "make dist").
+if (-d .git || -d ../.git) then
+ set snapshot="`grep '^snapshot\s*=' ${distdir}/VERSION | cut -d= -f2`"
+ set snapshot_version="`grep '^snapshot_version\s*=' ${distdir}/VERSION | cut -d= -f2`"
+
+ # Update VERSION is $snapshot==1 and $snapshot_version is empty.
+ if ("$snapshot" == "1" && "$snapshot_version" == "") then
+ set describe=`git describe --always | sed -e s/^hwloc-// | grep -v fatal`
+ # Safety: if git describe failed, then assign "unknown" (I'm
+ # not sure how this can happen; just being defensive)
+ if ("$describe" == "") then
+ describe="unknown"
+ endif
+
+ sed -e 's/^snapshot_version\s*=.*/snapshot_version='$describe'/' "${distdir}/VERSION" > "${distdir}/version.new"
+ cp "${distdir}/version.new" "${distdir}/VERSION"
+ rm -f "${distdir}/version.new"
+ # Reset the timestamp to preserve AM dependencies
+ touch -r "${srcdir}/VERSION" "${distdir}/VERSION"
+ echo "*** Updated VERSION file with snapshot version: $describe"
+ endif
endif
set start=`date`
exit 1
endif
-#
-# See if we need to update the version file with the current repo
-# revision number. Do this *before* entering the distribution tree to
-# solve a whole host of problems with VPATH (since srcdir may be
-# relative or absolute)
-#
-set cur_repo_rev="`grep '^repo_rev' ${distdir}/VERSION | cut -d= -f2`"
-if ("$cur_repo_rev" == "-1") then
- sed -e 's/^repo_rev=.*/repo_rev='$repo_rev'/' "${distdir}/VERSION" > "${distdir}/version.new"
- cp "${distdir}/version.new" "${distdir}/VERSION"
- rm -f "${distdir}/version.new"
- # need to reset the timestamp to not annoy AM dependencies
- touch -r "${srcdir}/VERSION" "${distdir}/VERSION"
- echo "*** Updated VERSION file with repo rev number: $repo_rev"
-else
- echo "*** Did NOT update VERSION file with repo rev number"
-endif
-
#
# VPATH builds only work if the srcdir has valid docs already built.
# If we're VPATH and the srcdir doesn't have valid docs, then fail.
echo "*** Removing latex source from dist tree"
rm -rf doc/doxygen-doc/latex
-#
-# Get the latest config.guess and config.sub from ftp.gnu.org
-#
-
-echo "*** Downloading latest config.sub/config.guess from ftp.gnu.org..."
-cd config
-set configdir="`pwd`"
-mkdir tmp.$$
-cd tmp.$$
-# Official HTTP git mirrors for config.guess / config.sub
-wget -t 1 -T 10 -O config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=master'
-wget -t 1 -T 10 -O config.sub 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=master'
-chmod +x config.guess config.sub
-
-# Recently, ftp.gnu.org has had zero-legnth config.guess / config.sub
-# files, which causes the automated nightly SVN snapshot tarball to
-# fail to be made correctly. This is a primitive attempt to fix that.
-# If we got zero-length files from wget, use a config.guess /
-# config.sub from a known location that is more recent than what ships
-# in the current generation of auto* tools. Also check to ensure that
-# the resulting scripts are runnable (Jan 2009: there are un-runnable
-# scripts available right now because of some git vulnerability).
-
-# Before you complain about this too loudly, remember that we're using
-# unreleased software...
-
-set happy=0
-if (! -f config.guess || ! -s config.guess) then
- echo " - WARNING: Got bad config.guess from ftp.gnu.org (non-existent or empty)"
-else
- ./config.guess >& /dev/null
- if ($status != 0) then
- echo " - WARNING: Got bad config.guess from ftp.gnu.org (not executable)"
- else
- if (! -f config.sub || ! -s config.sub) then
- echo " - WARNING: Got bad config.sub from ftp.gnu.org (non-existent or empty)"
- else
- ./config.sub `./config.guess` >& /dev/null
- if ($status != 0) then
- echo " - WARNING: Got bad config.sub from ftp.gnu.org (not executable)"
- else
- echo " - Got good config.guess and config.sub from ftp.gnu.org"
- chmod +w ../config.sub ../config.guess
- cp config.sub config.guess ..
- set happy=1
- endif
- endif
- endif
-endif
-
-if ("$happy" == "0") then
- echo " - WARNING: using included versions for both config.sub and config.guess"
-endif
-cd ..
-rm -rf tmp.$$
-cd ..
-
#
# All done
#
#!/bin/sh
#
-# hwloc_get_version is created from hwloc_get_version.m4 and hwloc_get_version.m4sh.
-#
# Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
-# Copyright © 2008-2010 Cisco Systems, Inc. All rights reserved.
+# Copyright © 2008-2013 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
# $HEADER$
#
-# 11 September 2009: this file was copied from PLPA's SVN trunk as of
-# r251 on 11 September 2009. The only change made to it was
-# s/PLPA/hwloc/ig.
-
-
-# HWLOC_GET_VERSION(version_file, variable_prefix)
-# -----------------------------------------------
-# parse version_file for version information, setting
-# the following shell variables:
-#
-# prefix_VERSION
-# prefix_BASE_VERSION
-# prefix_MAJOR_VERSION
-# prefix_MINOR_VERSION
-# prefix_RELEASE_VERSION
-# prefix_GREEK_VERSION
-# prefix_WANT_REPO_REV
-# prefix_REPO_REV
-# prefix_RELEASE_DATE
-
-
-
srcfile="$1"
option="$2"
-case "$option" in
- # svnversion can take a while to run. If we don't need it, don't run it.
- --major|--minor|--release|--greek|--base|--help)
- ompi_ver_need_repo_rev=0
- ;;
- *)
- ompi_ver_need_repo_rev=1
-esac
-
-
if test -z "$srcfile"; then
option="--help"
else
-
- : ${ompi_ver_need_repo_rev=1}
: ${srcdir=.}
- : ${svnversion_result=-1}
- if test -f "$srcfile"; then
+ if test -f "$srcfile"; then
ompi_vers=`sed -n "
t clear
: clear
s/^minor/HWLOC_MINOR_VERSION/
s/^release/HWLOC_RELEASE_VERSION/
s/^greek/HWLOC_GREEK_VERSION/
- s/^want_repo_rev/HWLOC_WANT_REPO_REV/
- s/^repo_rev/HWLOC_REPO_REV/
s/^date/HWLOC_RELEASE_DATE/
+ s/^snapshot_version/HWLOC_SNAPSHOT_VERSION/
+ s/^snapshot/HWLOC_SNAPSHOT/
t print
b
: print
p" < "$srcfile"`
eval "$ompi_vers"
- # Only print release version if it isn't 0
+ # Only include the release version if it isn't 0
if test $HWLOC_RELEASE_VERSION -ne 0 ; then
HWLOC_VERSION="$HWLOC_MAJOR_VERSION.$HWLOC_MINOR_VERSION.$HWLOC_RELEASE_VERSION"
else
HWLOC_VERSION="$HWLOC_MAJOR_VERSION.$HWLOC_MINOR_VERSION"
fi
HWLOC_VERSION="${HWLOC_VERSION}${HWLOC_GREEK_VERSION}"
- HWLOC_BASE_VERSION=$HWLOC_VERSION
-
- if test $HWLOC_WANT_REPO_REV -eq 1 && test $ompi_ver_need_repo_rev -eq 1 ; then
- if test "$svnversion_result" != "-1" ; then
- HWLOC_REPO_REV=$svnversion_result
- fi
- if test "$HWLOC_REPO_REV" = "-1" ; then
-
- if test -d "$srcdir/.svn" ; then
- HWLOC_REPO_REV=r`svnversion "$srcdir"`
- elif test -d "$srcdir/.hg" ; then
- HWLOC_REPO_REV=hg`hg -v -R "$srcdir" tip | grep changeset | cut -d: -f3`
- elif test -d "$srcdir/.git" ; then
- HWLOC_REPO_REV=git`git log -1 "$srcdir" | grep commit | awk '{ print $2 }'`
- fi
- if test "HWLOC_REPO_REV" = ""; then
- HWLOC_REPO_REV=date`date '+%m%d%Y'`
- fi
+ # If HWLOC_SNAPSHOT=1, then use HWLOC_SNAPSHOT_VERSION
+ if test "$HWLOC_SNAPSHOT" = "1"; then
+ # First, verify that HWLOC_SNAPSHOT_VERSION isn't empty.
+ if test -z "$HWLOC_SNAPSHOT_VERSION"; then
+ echo "*** ERROR: $1 contains snapshot=1, but an empty value for snapshot_version" 1>&2
+ exit 1
fi
- HWLOC_VERSION="${HWLOC_VERSION}${HWLOC_REPO_REV}"
+ HWLOC_VERSION=$HWLOC_SNAPSHOT_VERSION
fi
fi
-
if test "$option" = ""; then
- option="--full"
+ option="--version"
fi
fi
case "$option" in
- --full|-v|--version)
+ --version)
echo $HWLOC_VERSION
;;
- --major)
- echo $HWLOC_MAJOR_VERSION
- ;;
- --minor)
- echo $HWLOC_MINOR_VERSION
- ;;
- --release)
- echo $HWLOC_RELEASE_VERSION
- ;;
- --greek)
- echo $HWLOC_GREEK_VERSION
- ;;
- --repo-rev)
- echo $HWLOC_REPO_REV
- ;;
- --base)
- echo $HWLOC_BASE_VERSION
- ;;
--release-date)
echo $HWLOC_RELEASE_DATE
;;
- --all)
- echo ${HWLOC_VERSION} ${HWLOC_MAJOR_VERSION} ${HWLOC_MINOR_VERSION} ${HWLOC_RELEASE_VERSION} ${HWLOC_GREEK_VERSION} ${HWLOC_REPO_REV}
+ --snapshot)
+ echo $HWLOC_SNAPSHOT
;;
-h|--help)
cat <<EOF
<srcfile> - Text version file
<option> - One of:
- --full - Full version number
- --major - Major version number
- --minor - Minor version number
- --release - Release version number
- --greek - Greek (alpha, beta, etc) version number
- --repo-rev - Repository version number
- --all - Show all version numbers, separated by :
- --base - Show base version number (no repo version number)
+ --version - Show version number
--release-date - Show the release date
+ --snapshot - Show whether this is a snapshot release or not
--help - This message
EOF
;;
EOF
AC_MSG_CHECKING([if this is a developer build])
- AS_IF([test ! -d "$srcdir/.svn" -a ! -d "$srcdir/.hg" -a ! -d "$srcdir/.git"],
+ AS_IF([test ! -d "$srcdir/.hg" -a ! -d "$srcdir/.git"],
[AC_MSG_RESULT([no (doxygen generation is optional)])],
[AC_MSG_RESULT([yes])])
AC_MSG_CHECKING([whether to enable "picky" compiler mode])
hwloc_want_picky=0
AS_IF([test "$hwloc_c_vendor" = "gnu"],
- [AS_IF([test -d "$srcdir/.svn" -o -d "$srcdir/.hg" -o -d "$srcdir/.git"],
+ [AS_IF([test -d "$srcdir/.hg" -o -d "$srcdir/.git"],
[hwloc_want_picky=1])])
if test "$enable_picky" = "yes"; then
if test "$GCC" = "yes"; then
# HWLOC_PKG_PROG_PKG_CONFIG([MIN-VERSION])
# ----------------------------------
-# hwloc note: Per https://svn.open-mpi.org/trac/hwloc/ticket/55, keep
+# hwloc note: Per https://git.open-mpi.org/trac/hwloc/ticket/55, keep
# the environment variable $PKG_CONFIG (vs. renaming it
# $HWLOC_PKG_CONFIG). Short explanation: $PKG_CONFIG is a well-known
# environment variable that can be set by users to override what these
#
AC_INIT([hwloc],
- [m4_normalize(esyscmd([config/hwloc_get_version.sh VERSION --base]))],
+ [m4_normalize(esyscmd([config/hwloc_get_version.sh VERSION --version]))],
[http://www.open-mpi.org/projects/hwloc/], [hwloc])
AC_PREREQ(2.63)
AC_CONFIG_AUX_DIR(./config)
# Get the version of hwloc that we are installing
AC_MSG_CHECKING([for hwloc version])
HWLOC_VERSION="`$srcdir/config/hwloc_get_version.sh $srcdir/VERSION`"
-HWLOC_MAJOR_VERSION="`$srcdir/config/hwloc_get_version.sh $srcdir/VERSION --major`"
-HWLOC_MINOR_VERSION="`$srcdir/config/hwloc_get_version.sh $srcdir/VERSION --minor`"
-HWLOC_RELEASE_VERSION="`$srcdir/config/hwloc_get_version.sh $srcdir/VERSION --release`"
-HWLOC_REPO_REV="`$srcdir/config/hwloc_get_version.sh $srcdir/VERSION --repo-rev`"
+if test "$?" != "0"; then
+ AC_MSG_ERROR([Cannot continue])
+fi
HWLOC_RELEASE_DATE="`$srcdir/config/hwloc_get_version.sh $srcdir/VERSION --release-date`"
AC_SUBST(HWLOC_VERSION)
-AC_SUBST(HWLOC_SVN_R)
AC_SUBST(HWLOC_RELEASE_DATE)
-AC_DEFINE_UNQUOTED([HWLOC_MAJOR_VERSION], [$HWLOC_MAJOR_VERSION],
- [Major version of hwloc])
-AC_DEFINE_UNQUOTED([HWLOC_MINOR_VERSION], [$HWLOC_MINOR_VERSION],
- [Minor version of hwloc])
-AC_DEFINE_UNQUOTED([HWLOC_RELEASE_VERSION], [$HWLOC_RELEASE_VERSION],
- [Release version of hwloc])
AC_MSG_RESULT([$HWLOC_VERSION])
# Override/fixup the version numbers set by AC_INIT, since on
# developer builds, there's no good way to know what the version is
# before running configure :(. We only use the base version number
-# (ie, no svn r numbers) for the version set in AC_INIT. This will
-# always match reality because we add the VERSION file (the only way
-# to change the major.minor.release{greek}) into the configure
-# dependencies.
+# for the version set in AC_INIT. This will always match reality
+# because we add the VERSION file (the only way to change the
+# major.minor.release{greek}) into the configure dependencies.
PACKAGE_VERSION="$HWLOC_VERSION"
PACKAGE_STRING="${PACKAGE_NAME} ${PACKAGE_VERSION}"
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
-# Copyright © 2008-2010 Cisco Systems, Inc. All rights reserved.
+# Copyright © 2008-2013 Cisco Systems, Inc. All rights reserved.
# Copyright © 2012-2013 Inria. All rights reserved.
# $COPYRIGHT$
#
# $HEADER$
#
+#########################################################################
+# Make greek and non-greek distribution (i.e., non-snapshot) tarballs
+#########################################################################
+
#
# Version of auto tools that we want
#
# Verify that we're in a top hwloc dir
#
echo "*** Checking to ensure in top-level HWLOC directory..."
-if test -f VERSION -a -f configure.ac -a -f config/hwloc.m4; then
+if test -f VERSION -a -f configure.ac -a -f config/hwloc.m4 -a -d .git; then
happy=1
else
- echo "Do not appear to be in a hwloc top directory. Abort!"
+ echo "Do not appear to be in a hwloc git clone top directory. Abort!"
exit 1
fi
-if test -d .svn ; then
- #
- # Do svn up and all that
- #
- echo "*** Removing old VERSION files..."
- find . -name VERSION -exec rm -f {} \; -print
-
- echo "*** Running svn up..."
- svn up
- if test ! "$?" = "0"; then
- echo "SVN update failed. Aborting"
- exit 1
- fi
-else if test -d .git ; then
- echo "*** Git reverting VERSION files..."
- find . -name VERSION | xargs git diff | patch -p1 -R
-else
- echo "*** Cannot revert VERSION files outside of svn/git"
-fi fi
+#
+# Set VERSION to not build a snapshot
+#
+echo "*** Git reverting VERSION files..."
+git diff VERSION | patch -p1 -R
#
-# Ditch "svn/git" from all version numbers
+# Substitute in the release date and disable snapshot build
#
-echo "*** Removing svn version numbers..."
-if test -d .svn ; then
- rev="r`svnversion .`"
-else if test -d .git ; then
- rev=git
-fi fi
-version_files="`find . -name VERSION`"
+echo "*** Substituting in release date and disabling snapshot..."
release_date=`export LANG=; export LC_ALL=; export LC_TIME=; date '+%b %d, %Y'`
-for file in $version_files; do
- echo " - $file"
- sed -e 's/^want_repo_rev=.*/want_repo_rev=0/' \
- -e "s/^date=.*/date=\"$release_date\"/" \
- -e 's/^repo_rev=.*/'repo_rev=$rev/ $file > $file.new
- cp -f $file.new $file
- rm $file.new
-done
+sed -e "s/^date=.*/date=\"$release_date\"/" \
+ -e "s/^snapshot=.*/snapshot=0/" \
+ VERSION > VERSION.new
+cp -f VERSION.new VERSION
+rm -f VERSION.new
#
# Make 2 tarballs:
# unless the user specifically said --greekonly, then only make the
# greek tarball. Making both tarballs at once allows us to guarantee
# to have two tarballs -- one greek and one not -- that have exactly
-# the same SVN r number (as opposed to, for example, running this
+# the same git describe (as opposed to, for example, running this
# script to make a greek tarball, then running it again to make a
# non-greek tarball -- there is a race condition that someone could
-# commit in the meantime and change the SVN r number in the 2nd
+# commit in the meantime and change the git describe number in the 2nd
# tarball)
#
if test "$1" != "-greekonly" -a "$1" != "--greekonly"; then
echo "*** REMOVING ALL GREEK FROM VERSION NUMBERS!!"
- for file in $version_files; do
- echo " - $file"
- sed -e 's/^greek=.*/greek=/' $file > $file.new
- cp -f $file.new $file
- rm $file.new
- done
+ sed -e 's/^greek=.*/greek=/' VERSION > VERSION.new
+ cp -f VERSION.new VERSION
+ rm -f VERSION.new
echo "Making non-greek tarball"
make_tarball
fi
# Put the VERSION and README files back the way they were
-if test -d .svn ; then
- svn revert VERSION README
-else if test -d .git ; then
- git diff VERSION README | patch -p1 -R
-else
- echo "*** Cannot revert VERSION and README files changes ***"
-fi
- echo
- echo "*** Remember that these tarballs weren't generated from SVN ***"
-fi
+echo "*** Reverting VERSION and README files"
+git diff VERSION README | patch -p1 -R
+++ /dev/null
-#!/bin/sh
-#
-# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
-# University Research and Technology
-# Corporation. All rights reserved.
-# Copyright (c) 2004-2005 The University of Tennessee and The University
-# of Tennessee Research Foundation. All rights
-# reserved.
-# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
-# University of Stuttgart. All rights reserved.
-# Copyright (c) 2004-2005 The Regents of the University of California.
-# All rights reserved.
-# Copyright © 2006-2011 Cisco Systems, Inc. All rights reserved.
-# $COPYRIGHT$
-#
-# Additional copyrights may follow
-#
-# $HEADER$
-#
-# This script is used to create a nightly snapshot tarball of hwloc.
-#
-# $1: scratch root
-# $2: e-mail address for destination
-# $3: SVN root
-# $4: dest dir
-# $5: version string for error e-mails, eg. trunk, v1.2, etc. (optional)
-#
-
-scratch_root="$1"
-email="$2"
-svnroot="$3"
-destdir="$4"
-
-# Set this to any value for additional output; typically only when
-# debugging
-debug=
-
-# do you want a success mail?
-want_success_mail=1
-
-# max length of logfile to send in an e-mail
-max_log_len=50
-
-# how many snapshots to keep in the destdir?
-max_snapshots=5
-
-############################################################################
-# Shouldn't need to change below this line
-############################################################################
-
-start_time="`date`"
-
-# Sanity checks
-if test -z "$scratch_root" -o -z "$email" -o -z "$svnroot" \
- -o -z "$destdir"; then
- echo "Must specify scratch root directory, e-mail address, SVN root, and destination directory"
- exit 1
-fi
-
-# Get a version string to use if there is an error.
-# It will get replaced upon succesful "make distcheck" with the real version.
-# Extract (from the SVN root) a version string if one wasn't supplied.
-if test -n "$5"; then
- version="$5"
-else
- version=`basename $svnroot`
-fi
-
-# send a mail
-# should only be called after logdir is set
-send_error_mail() {
- outfile="$scratch_root/output.txt"
- rm -f "$outfile"
- touch "$outfile"
- for file in `/bin/ls $logdir/* | sort`; do
- len="`wc -l $file | awk '{ print $1}'`"
- if test "`expr $len \> $max_log_len`" = "1"; then
- echo "[... previous lines snipped ...]" >> "$outfile"
- tail -n $max_log_len "$file" >> "$outfile"
- else
- cat "$file" >> "$outfile"
- fi
- done
- Mail -s "=== CREATE FAILURE ($version) ===" "$email" < "$outfile"
- rm -f "$outfile"
-}
-
-# send output error message
-die() {
- msg="$*"
- cat > "$logdir/00_announce.txt" <<EOF
-Creating the nightly hwloc tarball ended in error:
-
-$msg
-EOF
- send_error_mail
- exit 1
-}
-
-# do the work
-# should only be called after logdir is set
-do_command() {
- cmd="$*"
- logfile="$logdir/20-command.txt"
- rm -f "$logfile"
- if test -n "$debug"; then
- echo "*** Running command: $cmd"
- eval $cmd > "$logfile" 2>&1
- st=$?
- echo "*** Command complete: exit status: $st"
- else
- eval $cmd > "$logfile" 2>&1
- st=$?
- fi
- if test "$st" != "0"; then
- cat > "$logdir/15-error.txt" <<EOF
-
-ERROR: Command returned a non-zero exist status ($version):
- $cmd
-
-Start time: $start_time
-End time: `date`
-
-=======================================================================
-EOF
- cat > "$logdir/25-error.txt" <<EOF
-=======================================================================
-
-Your friendly daemon,
-Cyrador
-EOF
- send_error_mail
- exit 1
- fi
- rm -f "$logfile"
-}
-
-# see if the destination directory exists
-if test ! -d "$destdir"; then
- mkdir -p "$destdir"
-fi
-if test ! -d "$destdir"; then
- die "Could not cd to dest dir: $destdir"
-fi
-
-# if there's a $destdir/latest_snapshot.txt, see if anything has
-# happened since that r number.
-desired_r=
-if test -f "$destdir/latest_snapshot.txt"; then
- # $r will be just an integer (not "r12345")
- r=`cat $destdir/latest_snapshot.txt | sed -e 's/.*r\([0-9]*\)/\1/'`
- if test -n "$debug"; then
- echo "** last snapshot r: $r"
- fi
-
- # If the current HEAD is on this $svnroot, then we'll get a log
- # message. Otherwise, we'll get a single line of dashes.
- file=/tmp/svn-log.txt.$$
- svn log -r HEAD $svnroot > $file
- # if we got more than 1 line, then extract the r number from the
- # log message.
- need_build=0
- if test "`wc -l $file | awk '{ print $1}'`" != "1"; then
- # $head_r will be "rXXXXX"
- head_r=`head -n 2 $file | tail -n 1 | awk '{ print $1 }'`
- if test -n "$debug"; then
- echo "** found HEAD r: $head_r"
- fi
-
- # If the head r is the same as the last_snapshot r, then exit
- # nicely
- rm -f /tmp/svn-log.txt.$$
- if test "r$r" = "$head_r"; then
- if test -n "$debug"; then
- echo "** svn HEAD r is same as last_snapshot -- not doing anything"
- fi
- exit 0
- fi
-
- # If we get here, it means the head r is different than the
- # last_snapshot r, and therefore we need to build.
- need_build=1
- desired_r=$head_r
- fi
-
- # If need_build still = 0, we know the r's are different. But has
- # anything happened on this branch since then?
- if test "$need_build" = "0"; then
- svn log -r HEAD:$r $svnroot > $file
-
- # We'll definitely have at least one log message because we
- # included the last snapshot number in the svn log command
- # (i.e., we'll at least see the log message for that commit).
- # So there's no need to check for a single line of dashes
- # here.
-
- # $last_commit_r will be "rXXXXX"
- last_commit_r=`head -n 2 $file | tail -n 1 | awk '{ print $1 }'`
- if test -n "$debug"; then
- echo "** found last commit r: $last_commit_r"
- fi
-
- # If the head r is the same as the last_snapshot r, then exit
- # nicely
- rm -f $file
- if test "r$r" = "$last_commit_r"; then
- if test -n "$debug"; then
- echo "** Last commit is same r as last_snapshot -- not doing anything"
- fi
- exit 0
- fi
-
- # If we get here, the r numbers didn't match, and we therefore
- # need a new snapshot.
- desired_r=$last_commit_r
- fi
-fi
-if test -n "$debug"; then
- echo "** we need a new snapshot"
-fi
-
-# move into the scratch directory and ensure we have an absolute
-# pathname for it
-if test ! -d "$scratch_root"; then
- mkdir -p "$scratch_root"
-fi
-if test ! -d "$scratch_root"; then
- die "Could not cd to scratch root: $scratch_root"
-fi
-cd "$scratch_root"
-scratch_root="`pwd`"
-
-if test -n "$desired_r"; then
- # we got a desired r number from above, so use that
- # $svnr will be rXXXXX
- svnr=$desired_r
-else
- # we don't have a desired r number, so get the last r number of a
- # commit
- svn co -N "$svnroot" hwloc > /dev/null 2>&1
- cd hwloc
- # $svnr will be rXXXXX
- svnr="r`svn info . | egrep '^Last Changed Rev: [0-9]+' | awk '{ print $4 }'`"
- cd ..
- rm -rf hwloc
-fi
-if test -n "$debug"; then
- echo "** making snapshot for r: $svnr"
-fi
-root="$scratch_root/create-$svnr"
-rm -rf "$root"
-mkdir "$root"
-cd "$root"
-
-# startup the logfile
-logdir="$root/logs"
-mkdir "$logdir"
-
-# checkout a clean version
-r=`echo $svnr | cut -c2-`
-do_command "svn co $svnroot -r $r hwloc"
-
-# ensure that we append the SVN number on the official version number
-cd hwloc
-svnversion="r`svnversion .`"
-version_files="`find . -name VERSION`"
-for file in $version_files; do
- sed -e 's/^want_repo_rev=.*/want_repo_rev=1/' \
- -e 's/^repo_rev=.*/repo_rev='$svnversion/ $file > $file.new
- cp -f $file.new $file
- rm -f $file.new
-done
-
-# autogen is our friend
-do_command "./autogen.sh"
-
-# do config
-do_command "./configure"
-
-# do make dist
-# distcheck does many things; we need to ensure it doesn't pick up any
-# other installs via LD_LIBRARY_PATH. It may be a bit Draconian
-# to totally clean LD_LIBRARY_PATH (i.e., we may need something in there),
-# but at least in the current building setup, we don't. But be advised
-# that this may need to change in the future...
-save=$LD_LIBRARY_PATH
-LD_LIBRARY_PATH=
-do_command "make distcheck"
-LD_LIBRARY_PATH=$save
-save=
-
-# chmod the whole directory, so that core files are accessible by others
-chmod a+rX -R .
-
-# move the resulting tarballs to the destdir
-gz="`/bin/ls hwloc*tar.gz`"
-bz2="`/bin/ls hwloc*tar.bz2`"
-mv $gz $bz2 $destdir
-cd $destdir
-
-# make the latest_snapshot.txt file containing the last version
-version="`echo $gz | sed -e 's/hwloc-\(.*\)\.tar\.gz/\1/g'`"
-rm -f latest_snapshot.txt
-echo $version > latest_snapshot.txt
-
-# trim the destdir to $max_snapshots
-for ext in gz bz2; do
- count="`ls hwloc*.tar.$ext | wc -l | awk '{ print $1 }'`"
- if test "`expr $count \> $max_snapshots`" = "1"; then
- num_old="`expr $count - $max_snapshots`"
- old="`ls -rt hwloc*.tar.$ext | head -n $num_old`"
- rm -f $old
- fi
-done
-
-# generate md5 and sha1 sums
-rm -f md5sums.txt sha1sums.txt
-touch md5sums.txt sha1sums.txt
-for file in `/bin/ls *gz *bz2 | grep -v latest`; do
- md5sum $file >> md5sums.txt
- sha1sum $file >> sha1sums.txt
-done
-
-# remove temp dirs
-cd "$scratch_root"
-rm -rf "$root"
-
-# send success mail
-if test "$want_success_mail" = "1"; then
- Mail -s "Create success (hwloc r$version)" "$email" <<EOF
-Creating nightly hwloc snapshot SVN tarball was a success.
-
-Snapshot: hwloc $version
-Start time: $start_time
-End time: `date`
-
-Your friendly daemon,
-Cyrador
-EOF
-fi
--- /dev/null
+#!/bin/sh
+#
+# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
+# University Research and Technology
+# Corporation. All rights reserved.
+# Copyright (c) 2004-2005 The University of Tennessee and The University
+# of Tennessee Research Foundation. All rights
+# reserved.
+# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
+# University of Stuttgart. All rights reserved.
+# Copyright (c) 2004-2005 The Regents of the University of California.
+# All rights reserved.
+# Copyright © 2006-2013 Cisco Systems, Inc. All rights reserved.
+# $COPYRIGHT$
+#
+# Additional copyrights may follow
+#
+# $HEADER$
+#
+# This script is used to create a nightly snapshot tarball of hwloc.
+#
+# $1: scratch root
+# $2: e-mail address for destination
+# $4: dest dir
+# $3: git URL
+# $5: git branch
+#
+
+scratch_root=$1
+email=$2
+destdir=$3
+giturl=$4
+gitbranch=$5
+
+# Set this to any value for additional output; typically only when
+# debugging
+debug=
+
+# do you want a success mail?
+want_success_mail=1
+
+# max length of logfile to send in an e-mail
+max_log_len=50
+
+# how many snapshots to keep in the destdir?
+max_snapshots=5
+
+############################################################################
+# Shouldn't need to change below this line
+############################################################################
+
+start_time="`date`"
+
+# Sanity checks
+if test -z "$scratch_root" -o -z "$email" -o -z "$giturl" -o -z "$gitbranch" \
+ -o -z "$destdir"; then
+ echo "$0 scratch_root email_addr dest_dir git_url git_branch"
+ exit 1
+fi
+
+# Use the branch name as the "version" string (for if there is an
+# error). This version string will be replaced upon successful "make
+# distcheck" with the real version.
+version=$gitbranch
+
+# send a mail
+# should only be called after logdir is set
+send_error_mail() {
+ outfile="$scratch_root/output.txt"
+ rm -f "$outfile"
+ touch "$outfile"
+ for file in `/bin/ls $logdir/* | sort`; do
+ len="`wc -l $file | awk '{ print $1}'`"
+ if test "`expr $len \> $max_log_len`" = "1"; then
+ echo "[... previous lines snipped ...]" >> "$outfile"
+ tail -n $max_log_len "$file" >> "$outfile"
+ else
+ cat "$file" >> "$outfile"
+ fi
+ done
+ Mail -s "=== CREATE FAILURE ($version) ===" "$email" < "$outfile"
+ rm -f "$outfile"
+}
+
+# send output error message
+die() {
+ msg="$*"
+ cat > "$logdir/00_announce.txt" <<EOF
+Creating the nightly hwloc tarball ended in error:
+
+$msg
+EOF
+ send_error_mail
+ exit 1
+}
+
+# do the work
+# should only be called after logdir is set
+do_command() {
+ cmd="$*"
+ logfile="$logdir/20-command.txt"
+ rm -f "$logfile"
+ if test -n "$debug"; then
+ echo "*** Running command: $cmd"
+ eval $cmd 2>&1 | tee "$logfile"
+ st=$?
+ echo "*** Command complete: exit status: $st"
+ else
+ eval $cmd > "$logfile" 2>&1
+ st=$?
+ fi
+ if test "$st" != "0"; then
+ cat > "$logdir/15-error.txt" <<EOF
+
+ERROR: Command returned a non-zero exist status ($version):
+ $cmd
+
+Start time: $start_time
+End time: `date`
+
+=======================================================================
+EOF
+ cat > "$logdir/25-error.txt" <<EOF
+=======================================================================
+
+Your friendly daemon,
+Cyrador
+EOF
+ send_error_mail
+ exit 1
+ fi
+ rm -f "$logfile"
+}
+
+# see if the destination directory exists
+if test ! -d "$destdir"; then
+ mkdir -p "$destdir"
+fi
+if test ! -d "$destdir"; then
+ die "Could not cd to dest dir: $destdir"
+fi
+
+# move into the scratch directory and ensure we have an absolute
+# pathname for it
+if test ! -d "$scratch_root"; then
+ mkdir -p "$scratch_root"
+fi
+if test ! -d "$scratch_root"; then
+ die "Could not cd to scratch root: $scratch_root"
+fi
+cd "$scratch_root"
+scratch_root="`pwd`"
+
+# setup target directory where clone+logs will go
+clone_root="$scratch_root/hwloc-`date +%Y-%m-%d-%H%M%S`"
+rm -rf $clone_root
+mkdir -p $clone_root
+
+# startup the logfile (must be before do_command)
+logdir="$clone_root/logs"
+mkdir "$logdir"
+
+# Get a fresh git clone
+cd $clone_root
+do_command "git clone $giturl hwloc"
+cd hwloc
+do_command "git checkout $gitbranch"
+
+# Find the "git describe" string for this branch (remove a leading "hwloc-"
+# prefix, if there is one).
+describe=`git describe --always | sed -e s/^hwloc-//`
+if test -n "$debug"; then
+ echo "** found $gitbranch describe: $describe"
+fi
+version=$describe
+
+# if there's a $destdir/latest_snapshot.txt, see if anything has
+# happened since the describe listed in that file
+if test -f "$destdir/latest_snapshot.txt"; then
+ snapshot_describe=`cat $destdir/latest_snapshot.txt`
+ if test -n "$debug"; then
+ echo "** last snapshot describe: $snapshot_describe"
+ fi
+
+ # Do we need a new snapshot?
+ if test "$describe" = "$snapshot_describe"; then
+ if test -n "$debug"; then
+ echo "** git $gitbranch describe is same as latest_snapshot -- not doing anything"
+ fi
+ # Since we didn't do anything, there's no point in leaving the clone we
+ # just created
+ cd ..
+ rm -rf $clone_root
+
+ # All done... nothing to see here...
+ exit 0
+ fi
+fi
+
+if test -n "$debug"; then
+ echo "** making snapshot for describe: $describe"
+fi
+
+# Ensure that VERSION is set to indicate that it wants a snapshot, but
+# don't specify the snapshot version string (because "make dist"
+# [i.e., config/distscript.csh] will insert the actual value).
+sed -e 's/^snapshot=.*/snapshot=1/' \
+ -e 's/^snapshot_version=.*/snapshot_version=/' \
+ VERSION > VERSION.new
+cp -f VERSION.new VERSION
+rm -f VERSION.new
+
+# autogen is our friend
+do_command "./autogen.sh"
+
+# do config
+do_command "./configure"
+
+# Do make distcheck (which will invoke config/distscript.csh to set
+# the right values in VERSION). distcheck does many things; we need
+# to ensure it doesn't pick up any other installs via LD_LIBRARY_PATH.
+# It may be a bit Draconian to totally clean LD_LIBRARY_PATH (i.e., we
+# may need something in there), but at least in the current building
+# setup, we don't. But be advised that this may need to change in the
+# future...
+save=$LD_LIBRARY_PATH
+LD_LIBRARY_PATH=
+do_command "make distcheck"
+LD_LIBRARY_PATH=$save
+save=
+
+# chmod the whole directory, so that core files are accessible by others
+chmod a+rX -R .
+
+# move the resulting tarballs to the destdir
+gz="`/bin/ls hwloc*tar.gz`"
+bz2="`/bin/ls hwloc*tar.bz2`"
+mv $gz $bz2 $destdir
+cd $destdir
+
+# make the latest_snapshot.txt file containing the last version
+version="`echo $gz | sed -e 's/hwloc-\(.*\)\.tar\.gz/\1/g'`"
+rm -f latest_snapshot.txt
+echo $version > latest_snapshot.txt
+
+# trim the destdir to $max_snapshots
+for ext in gz bz2; do
+ count="`ls hwloc*.tar.$ext | wc -l | awk '{ print $1 }'`"
+ if test "`expr $count \> $max_snapshots`" = "1"; then
+ num_old="`expr $count - $max_snapshots`"
+ old="`ls -rt hwloc*.tar.$ext | head -n $num_old`"
+ rm -f $old
+ fi
+done
+
+# generate md5 and sha1 sums
+rm -f md5sums.txt sha1sums.txt
+touch md5sums.txt sha1sums.txt
+for file in `/bin/ls *gz *bz2 | grep -v latest`; do
+ md5sum $file >> md5sums.txt
+ sha1sum $file >> sha1sums.txt
+done
+
+# remove temp dirs
+cd "$scratch_root"
+rm -rf "$clone_root"
+
+# send success mail
+if test "$want_success_mail" = "1"; then
+ Mail -s "Create success (hwloc git $version)" "$email" <<EOF
+Creating nightly hwloc snapshot git tarball was a success.
+
+Snapshot: hwloc $version
+Start time: $start_time
+End time: `date`
+
+Your friendly daemon,
+Cyrador
+EOF
+fi