Monday, August 22, 2016

[389-commits] configure configure.ac Makefile.am Makefile.in rpm/389-ds-base.spec.in rpm.mk rpm/rpmverrel.sh VERSION.sh

Makefile.am | 2 +-
Makefile.in | 3 ++-
VERSION.sh | 14 ++++++--------
configure | 1 +
configure.ac | 1 +
rpm.mk | 2 ++
rpm/389-ds-base.spec.in | 2 +-
rpm/rpmverrel.sh | 2 ++
8 files changed, 16 insertions(+), 11 deletions(-)

New commits:
commit 9daee2890e2d01ed2d9c11f2bf9bab3474d55f55
Author: Viktor Ashirov <vashirov@redhat.com>
Date: Tue Aug 16 20:54:09 2016 +0200

Ticket 48965 - Fix generation of the pre-release version

Description: Previously, when building DS from git checkout, pre-release
version didn't contain git commit id, though supporting code existed.

Fix description: Generate pre-release version according to Fedora Naming
Guidelines for snapshot packages [1]:
- change date format to YYYYMMDD
- remove '-' since it's not allowed

https://fedorahosted.org/389/ticket/48965

Reviewed by: mreynolds@redhat.com (Thanks!)

[1] https://fedoraproject.org/wiki/Packaging:Naming?rd=Packaging:NamingGuidelines#Snapshot_packages

diff --git a/Makefile.am b/Makefile.am
index 3e1bf47..a2f834e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1999,7 +1999,7 @@ rpmbrprep: dist-bzip2 rpmroot
cp $(distdir).tar.bz2 $(RPMBUILD)/SOURCES
cp $(srcdir)/rpm/389-ds-base-git.sh $(RPMBUILD)/SOURCES
cp $(srcdir)/rpm/389-ds-base-devel.README $(RPMBUILD)/SOURCES
- sed -e "s/__VERSION__/$(RPM_VERSION)/" -e "s/__RELEASE__/$(RPM_RELEASE)/" -e "s/__NUNC_STANS_ON__/$(NUNC_STANS_ON)/" -e "s/__ASAN_ON__/$(ASAN_ON)/" < $(abs_builddir)/rpm/389-ds-base.spec > $(RPMBUILD)/SPECS/389-ds-base.spec
+ sed -e "s/__VERSION__/$(RPM_VERSION)/" -e "s/__RELEASE__/$(RPM_RELEASE)/" -e "s/__VERSION_PREREL__/$(VERSION_PREREL)/" -e "s/__NUNC_STANS_ON__/$(NUNC_STANS_ON)/" -e "s/__ASAN_ON__/$(ASAN_ON)/" < $(abs_builddir)/rpm/389-ds-base.spec > $(RPMBUILD)/SPECS/389-ds-base.spec

# Requires rpmdevtools. Consider making this a dependancy of rpms.
rpmsources: rpmbrprep
diff --git a/Makefile.in b/Makefile.in
index 6788fe1..17b8d73 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1368,6 +1368,7 @@ SHELL = @SHELL@
STRIP = @STRIP@
THREADLIB = @THREADLIB@
VERSION = @VERSION@
+VERSION_PREREL = @VERSION_PREREL@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -10858,7 +10859,7 @@ rpmbrprep: dist-bzip2 rpmroot
cp $(distdir).tar.bz2 $(RPMBUILD)/SOURCES
cp $(srcdir)/rpm/389-ds-base-git.sh $(RPMBUILD)/SOURCES
cp $(srcdir)/rpm/389-ds-base-devel.README $(RPMBUILD)/SOURCES
- sed -e "s/__VERSION__/$(RPM_VERSION)/" -e "s/__RELEASE__/$(RPM_RELEASE)/" -e "s/__NUNC_STANS_ON__/$(NUNC_STANS_ON)/" -e "s/__ASAN_ON__/$(ASAN_ON)/" < $(abs_builddir)/rpm/389-ds-base.spec > $(RPMBUILD)/SPECS/389-ds-base.spec
+ sed -e "s/__VERSION__/$(RPM_VERSION)/" -e "s/__RELEASE__/$(RPM_RELEASE)/" -e "s/__VERSION_PREREL__/$(VERSION_PREREL)/" -e "s/__NUNC_STANS_ON__/$(NUNC_STANS_ON)/" -e "s/__ASAN_ON__/$(ASAN_ON)/" < $(abs_builddir)/rpm/389-ds-base.spec > $(RPMBUILD)/SPECS/389-ds-base.spec

# Requires rpmdevtools. Consider making this a dependancy of rpms.
rpmsources: rpmbrprep
diff --git a/VERSION.sh b/VERSION.sh
index f831270..f83c1ec 100644
--- a/VERSION.sh
+++ b/VERSION.sh
@@ -13,8 +13,7 @@ VERSION_MINOR=3
VERSION_MAINT=5.13
# NOTE: VERSION_PREREL is automatically set for builds made out of a git tree
VERSION_PREREL=
-VERSION_DATE=`date -u +%Y%m%d%H%M%S`
-GIT_CHECKOUT=`git log -1 >/dev/null 2>&1`
+VERSION_DATE=$(date -u +%Y%m%d)

# Set the version and release numbers for local developer RPM builds. We
# set these here because we do not want the git commit hash in the RPM
@@ -23,17 +22,16 @@ GIT_CHECKOUT=`git log -1 >/dev/null 2>&1`
RPM_RELEASE=${VERSION_DATE}
RPM_VERSION=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MAINT}

-if test -n "$GIT_CHECKOUT"; then
-# if the source is from a git repo, put the last commit
-# in the version
+if $(git -C "$srcdir" rev-parse --is-inside-work-tree > /dev/null 2>&1); then
+# Check if the source is from a git repo
# 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`
+ COMMIT=$(git -C "$srcdir" log -1 --pretty=format:%h 2> /dev/null)
if test -n "$COMMIT" ; then
- VERSION_PREREL=.${VERSION_DATE}-git$COMMIT
- RPM_RELEASE=$RPM_RELEASE-git$COMMIT
+ VERSION_PREREL=.${VERSION_DATE}git$COMMIT
+ RPM_RELEASE=${RPM_RELEASE}git$COMMIT
fi
fi

diff --git a/configure b/configure
index 3f26631..c2a4af6 100755
--- a/configure
+++ b/configure
@@ -840,6 +840,7 @@ MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
CONSOLE_VERSION
+VERSION_PREREL
RPM_RELEASE
RPM_VERSION
AM_BACKSLASH
diff --git a/configure.ac b/configure.ac
index a7f0bbf..c18d2d9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,6 +19,7 @@ AC_DEFINE_UNQUOTED([VERSION], "$VERSION", [package version])
AC_DEFINE_UNQUOTED([PACKAGE], "$PACKAGE", [package tar name])
AC_SUBST([RPM_VERSION])
AC_SUBST([RPM_RELEASE])
+AC_SUBST([VERSION_PREREL])
AC_SUBST([CONSOLE_VERSION])
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
diff --git a/rpm.mk b/rpm.mk
index a880e62..19a85d7 100644
--- a/rpm.mk
+++ b/rpm.mk
@@ -1,6 +1,7 @@
RPMBUILD ?= $(PWD)/rpmbuild
RPM_VERSION ?= $(shell $(PWD)/rpm/rpmverrel.sh version)
RPM_RELEASE ?= $(shell $(PWD)/rpm/rpmverrel.sh release)
+VERSION_PREREL ?= $(shell $(PWD)/rpm/rpmverrel.sh prerel)
PACKAGE = 389-ds-base
RPM_NAME_VERSION = $(PACKAGE)-$(RPM_VERSION)
TARBALL = $(RPM_NAME_VERSION).tar.bz2
@@ -34,6 +35,7 @@ rpmroot:
mkdir -p $(RPMBUILD)/SPECS
mkdir -p $(RPMBUILD)/SRPMS
sed -e s/__VERSION__/$(RPM_VERSION)/ -e s/__RELEASE__/$(RPM_RELEASE)/ \
+ -e s/__VERSION_PREREL__/$(VERSION_PREREL)/ \
-e s/__NUNC_STANS_ON__/$(NUNC_STANS_ON)/ \
-e s/__ASAN_ON__/$(ASAN_ON)/ \
rpm/$(PACKAGE).spec.in > $(RPMBUILD)/SPECS/$(PACKAGE).spec
diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in
index 33bf470..e5d824e 100644
--- a/rpm/389-ds-base.spec.in
+++ b/rpm/389-ds-base.spec.in
@@ -6,7 +6,7 @@
# for a pre-release, define the prerel field e.g. .a1 .rc2 - comment out for official release
# also remove the space between % and global - this space is needed because
# fedpkg verrel stupidly ignores comment lines
-#% global prerel .rc3
+%global prerel __VERSION_PREREL__%{nil}
# also need the relprefix field for a pre-release e.g. .0 - also comment out for official release
#% global relprefix 0.

diff --git a/rpm/rpmverrel.sh b/rpm/rpmverrel.sh
index 06e97c7..0b034d4 100755
--- a/rpm/rpmverrel.sh
+++ b/rpm/rpmverrel.sh
@@ -12,4 +12,6 @@ if [ "$1" = "version" ]; then
echo $RPM_VERSION
elif [ "$1" = "release" ]; then
echo $RPM_RELEASE
+elif [ "$1" = "prerel" ]; then
+ echo $VERSION_PREREL
fi

--
389-commits mailing list
389-commits@lists.fedoraproject.org
https://lists.fedoraproject.org/admin/lists/389-commits@lists.fedoraproject.org

No comments:

Post a Comment