From 2b2c26069aee6c0ead2c6ed95de5f181089025ac Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Thu, 12 Nov 2009 11:20:16 -0700 Subject: Implement support for versioning and release engineering procedures - version 1.2.5.a1 Instead of changing configure.ac AC_INIT for each version change, there is a new file - VERSION.sh. This file also contains support for creating version numbers for pre-releases, and pre-release strings containing git commit hashes. One of the complications is that AC_INIT does not allow you to override the version and package tarname fields. We can override them after the fact everywhere except in config.h. AC_INIT defines the following which we would like to override but cannot: PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_STRING PACKAGE_BUGREPORT Instead, we define DS_ versions of these e.g. DS_PACKAGE_VERSION etc. and make these available with AC_DEFINE(DS_PACKAGE_VERSION,...) etc. As an extra added precaution, we undefine these in Makefile.am like this: DS_DEFINES = ... \ -UPACKAGE_VERSION -UPACKAGE_TARNAME -UPACKAGE_STRING -UPACKAGE_BUGREPORT If someone tries to use PACKAGE_VERSION in C code, they will not be able to, and will have to use DS_PACKAGE_VERSION instead. All of the DS code that used PACKAGE_VERSION has been changed to use DS_PACKAGE_VERSION instead. There is a new make target - git-archive - as a convenience for creating source tarballs from git. By default, the source archive will be placed in the build directory - you can specify SRCDISTDIR=/path/to/SOURCES to use an alternate dir (e.g. make SRCDISTDIR=/path/to/rpmbuild/SOURCES git-archive to make a source tarball for rpmbuild) configure will print the branded package name and version Reviewed by: nkinder (Thanks!) --- VERSION.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 VERSION.sh (limited to 'VERSION.sh') diff --git a/VERSION.sh b/VERSION.sh new file mode 100644 index 00000000..c584a580 --- /dev/null +++ b/VERSION.sh @@ -0,0 +1,50 @@ +# brand is lower case - used for names that don't appear to end users +# brand is used for file naming - should contain no spaces +brand=389 +# capbrand is the properly capitalized brand name that appears to end users +# may contain spaces +capbrand=389 +# vendor is the properly formatted vendor/manufacturer name that appears to end users +vendor="389 Project" + +# PACKAGE_VERSION is constructed from these +VERSION_MAJOR=1 +VERSION_MINOR=2 +VERSION_MAINT=5 +# if this is a PRERELEASE, set VERSION_PREREL +# otherwise, comment it out +# be sure to include the dot prefix in the prerel +VERSION_PREREL=.a1 +# NOTES on VERSION_PREREL +# use aN for an alpha release e.g. a1, a2, etc. +# use rcN for a release candidate e.g. rc1, rc2, etc. +# for extra clarification, the date can be appended to the prerel e.g. +# RC1.`date +%Y%m%d` +# a git commit may also be used + +if test -n "$VERSION_PREREL"; then +# if the source is from a git repo, put the last commit +# in the version +# if this is not a git repo, git log will say +# fatal: Not a git repository +# to stderr and stdout will be empty +# this tells git to print the short commit hash from the last commit + COMMIT=`cd $srcdir ; git log -1 --pretty=format:%h 2> /dev/null` + if test -n "$COMMIT" ; then + VERSION_PREREL=$VERSION_PREREL.git$COMMIT + fi +fi + +# the real version used throughout configure and make +# NOTE: because of autoconf/automake harshness, we cannot override the settings +# below in C code - there is no way to override the default #defines +# for these set with AC_INIT - so configure.ac should AC_DEFINE +# DS_PACKAGE_VERSION DS_PACKAGE_TARNAME DS_PACKAGE_BUGREPORT +# for use in C code - other code (perl scripts, shell scripts, Makefiles) +# can use PACKAGE_VERSION et. al. +PACKAGE_VERSION=$VERSION_MAJOR.$VERSION_MINOR.${VERSION_MAINT}$VERSION_PREREL +# the name of the source tarball - see make dist +PACKAGE_TARNAME=${brand}-ds-base +# url for bug reports +PACKAGE_BUGREPORT="${PACKAGE_BUGREPORT}enter_bug.cgi?product=$brand" +PACKAGE_STRING="$PACKAGE_TARNAME $PACKAGE_VERSION" -- cgit