rpms: Use git version information

Use the git version information when building RPMS, rather than hard
coding it into configure.ac.

Change-Id: I477629b4102f48a9669ff67aae429c08862a5afc
Reviewed-on: http://gerrit.openafs.org/4983
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Simon Wilkinson 2011-07-12 17:58:16 +01:00 committed by Derrick Brashear
parent 4470d849ec
commit 6a27e228ba
3 changed files with 25 additions and 19 deletions

View File

@ -6,13 +6,8 @@ AM_INIT_AUTOMAKE
AC_CONFIG_HEADER(src/config/afsconfig.h)
MACOS_VERSION=1.5.76
LINUX_PKGVER=1.5.76
#LINUX_PKGREL=0.pre3
LINUX_PKGREL=1.1
AC_SUBST(MACOS_VERSION)
AC_SUBST(LINUX_PKGVER)
AC_SUBST(LINUX_PKGREL)
dnl If the user hasn't specified CFLAGS don't let configure pick -g -O2
AS_IF([test -z "$CFLAGS"], [CFLAGS=" "], [])

View File

@ -6,7 +6,6 @@ AM_INIT_AUTOMAKE
AC_CONFIG_HEADER(src/config/afsconfig.h)
MACOS_VERSION=1.5.76
LINUX_PKGVER=1.5.76
#LINUX_PKGREL=0.pre3
LINUX_PKGREL=1.1
@ -18,8 +17,6 @@ if echo "$LINUX_PKGREL" | grep pre >/dev/null 2>/dev/null ; then
fi
AC_SUBST(MACOS_VERSION)
AC_SUBST(LINUX_PKGVER)
AC_SUBST(LINUX_PKGREL)
AC_SUBST(DEB_PKGVER)
dnl If the user hasn't specified CFLAGS don't let configure pick -g -O2
@ -194,7 +191,6 @@ src/packaging/MacOS/OpenAFS.Description.plist \
src/packaging/MacOS/OpenAFS.Info.plist \
src/packaging/MacOS/OpenAFS.info \
src/packaging/MacOS/buildpkg.sh \
src/packaging/RedHat/openafs.spec \
src/pam/Makefile \
src/platform/Makefile \
src/platform/${MKAFS_OSTYPE}/Makefile \

View File

@ -56,14 +56,6 @@ while(<$fh>) {
$afsversion = $1;
next;
}
if (/LINUX_PKGVER=(.*)/) {
$linuxver = $1;
next;
}
if (/LINUX_PKGREL=(.*)/) {
$linuxrel = $1;
next;
}
}
undef $fh;
@ -71,9 +63,32 @@ if (not defined($afsversion)) {
$afsversion = `"$srcdir/build-tools/git-version" "$srcdir"`;
}
# Build the Linux version and release information from the package version
# We need to handle a number of varieties of package version -
# Normal: 1.7.0
# Prereleases: 1.7.0pre1
# Development trees: 1.7.0dev
# and RPMS which are built from trees midway between heads, such as
# 1.7.0-45-gabcdef or 1.7.0pre1-37-g12345 or 1.7.0dev-56-g98765
if ($afsversion=~m/(.*)(pre[0-9]+)/) {
$linuxver=$1;
$linuxrel="0.$2";
} elsif ($afsversion=~m/(.*)dev/) {
$linuxver=$1;
$linuxrel="0.dev";
} else {
$linuxver=$afsversion;
$linuxrel=1;
}
if ($afsversion=~m/-([0-9]+)-(g[a-f0-9]+)$/) {
$linuxrel.=".$1.$2";
}
# Figure out a major, minor and release so that we know which version we're
# building, and therefore what the srpm is going to be called
$afsversion=~/([0-9]+)\.([0-9]+)\.([0-9]+)/;
$linuxver=~/([0-9]+)\.([0-9]+)\.([0-9]+)/;
my $major = $1;
my $minor = $2;
my $patchlevel = $3;
@ -156,7 +171,7 @@ system("rpmbuild -bs --define \"dist %undefined\" ".
or die "rpmbuild failed : $!\n";
# Copy it out to somewhere useful
if ($major > 1 || ($major == 1 && $minor >= 6)) {
if (!defined($major) || $major > 1 || ($major == 1 && $minor >= 6)) {
File::Copy::copy("$tmpdir/rpmdir/SRPMS/openafs-$linuxver-$linuxrel.src.rpm",
"openafs-$linuxver-$linuxrel.src.rpm")
or die "Unable to copy output RPM : $!\n";