Skip to content
Snippets Groups Projects
Commit e7999980 authored by Raymond Toy's avatar Raymond Toy
Browse files

Make the version arg optional.

If the version is not specified, determine a default version based on
the git hash returned by git describe.  Thus, for tagged snapshot
builds, the version will automatically be chosen from the tag, with
"snapshot-" removed.
parent 9f423c67
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/tools/make-dist.sh,v 1.20 2011/04/11 16:34:49 rtoy Exp $ # $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/tools/make-dist.sh,v 1.20 2011/04/11 16:34:49 rtoy Exp $
usage() { usage() {
echo "make-dist.sh: [-hbg] [-G group] [-O owner] [-I destdir] [-M mandir] dir version [arch os]" echo "make-dist.sh: [-hbg] [-G group] [-O owner] [-I destdir] [-M mandir] dir [version arch os]"
echo " -h This help" echo " -h This help"
echo " -b Use bzip2 compression" echo " -b Use bzip2 compression"
echo " -g Use gzip compression" echo " -g Use gzip compression"
...@@ -40,6 +40,9 @@ usage() { ...@@ -40,6 +40,9 @@ usage() {
echo "<arch>, and <os> are given values, and <c> is gz or bz2 depending" echo "<arch>, and <os> are given values, and <c> is gz or bz2 depending"
echo "on the selected compression method." echo "on the selected compression method."
echo "" echo ""
echo "If version is not given, then a version is determined automatically"
echo "based on the result of git describe."
echo ""
echo "If arch and os are not given, the script will attempt to figure an" echo "If arch and os are not given, the script will attempt to figure an"
echo "appropriate value for arch and os from the running system." echo "appropriate value for arch and os from the running system."
echo "" echo ""
...@@ -100,13 +103,17 @@ do ...@@ -100,13 +103,17 @@ do
h | \?) usage; exit 1 ;; h | \?) usage; exit 1 ;;
esac esac
done done
echo $@
shift `expr $OPTIND - 1` shift `expr $OPTIND - 1`
# Figure out the architecture and OS # Figure out the architecture and OS
ARCH= ARCH=
OS= OS=
# Figure out the architecture and OS
def_arch_os
if [ -n "${INSTALL_DIR}" ]; then if [ -n "${INSTALL_DIR}" ]; then
# Doing direct installation # Doing direct installation
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
...@@ -115,10 +122,20 @@ if [ -n "${INSTALL_DIR}" ]; then ...@@ -115,10 +122,20 @@ if [ -n "${INSTALL_DIR}" ]; then
def_arch_os def_arch_os
fi fi
elif [ $# -lt 2 ]; then elif [ $# -lt 2 ]; then
usage # Version not specified so choose a version based on the git hash.
GIT_HASH="`(cd src; git describe --dirty 2>/dev/null)`"
if expr "X${GIT_HASH}" : 'Xsnapshot-[0-9][0-9][0-9][0-9]-[01][0-9]' > /dev/null; then
VERSION=`expr "${GIT_HASH}" : "snapshot-\(.*\)"`
fi
if expr "X${GIT_HASH}" : 'X[0-9][0-9][a-f]' > /dev/null; then
VERSION="${GIT_HASH}"
fi
echo "Defaulting version to $VERSION"
else else
# Figure out the architecture and OS VERSION="$2"
def_arch_os
if [ $# -eq 3 ]; then if [ $# -eq 3 ]; then
ARCH=$3 ARCH=$3
elif [ $# -eq 4 ]; then elif [ $# -eq 4 ]; then
...@@ -147,9 +164,7 @@ fi ...@@ -147,9 +164,7 @@ fi
TARGET="`echo $1 | sed 's:/*$::'`" TARGET="`echo $1 | sed 's:/*$::'`"
if [ -z "$INSTALL_DIR" ]; then if [ -n "$INSTALL_DIR" ]; then
VERSION=$2
else
VERSION="today" VERSION="today"
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment