HI,
The previous patch for supporting developer RPM builds was useless for
cases where you want to use mock for building. This new patch makes
things more friendly for mock builds. It also eliminates the need to
run configure before trying to build the RPMs, which was needed
previously just to build the Makefile. More details are in the patch
description.
Thanks,
-NGK
>From c996ae334e7a27843549318b3a970c995d58f5b6 Mon Sep 17 00:00:00 2001
From: Nathan Kinder <nkinder@xxxxxxxxxx>
Date: Fri, 19 Apr 2013 18:10:30 -0700
Subject: [PATCH] Allow rpm builds to be run without configure
The previous patch that added support to build RPM packages required
you to run configure before we could even create a SRPM. We had to
do this since Makefile is generated by automake when configure is
run. This isn't useful when you just want to create a SRPM to use
for performing mock builds since the system you are creating a SRPM
on might not even have the proper build dependencies availble.
This patch removes the need to run configure when building RPMS. A
new Makefile is added that is only used for RPM related tasks. A
target to build a SRPM was also added to allow one to create a SRPM
for using with mock builds. To build a SRPM or RPMS with this patch,
you can just run one of the following commands with a freshly checked
out source tree:
make -f rpm.mk srpms
make -f rpm.mk rpms
The rpms, srpms, and source tarball will be creates in a dist
directory in the build tree.
---
Makefile.am | 41 -----------------------------------------
configure.ac | 7 -------
rpm.mk | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
rpm/rpmverrel.sh | 11 +++++++++++
4 files changed, 62 insertions(+), 48 deletions(-)
create mode 100644 rpm.mk
create mode 100755 rpm/rpmverrel.sh
diff --git a/Makefile.am b/Makefile.am
index a35f8e4..7f00b07 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,15 +6,6 @@ COLON := $(NULLSTRING):# a colon
QUOTE := $(NULLSTRING)"# a double quote"
#------------------------
-# RPM Packaging
-#------------------------
-RPMBUILD ?= $(PWD)/rpmbuild
-RPM_VERSION=@rpm_version@
-RPM_RELEASE=@rpm_release@
-RPM_NAME_VERSION=$(PACKAGE)-$(RPM_VERSION)
-TARBALL=$(RPM_NAME_VERSION).tar.bz2
-
-#------------------------
# Compiler Flags
#------------------------
BUILDNUM := $(shell perl $(srcdir)/buildnum.pl)
@@ -1684,35 +1675,3 @@ git-archive:
fi ; \
git archive --prefix=$(distdir)/ $$gittag | bzip2 > $$srcdistdir/$(distdir).tar.bz2
-local-archive:
- -mkdir -p dist/$(RPM_NAME_VERSION)
- rsync -a --exclude=dist --exclude=.git --exclude=rpmbuild $(srcdir)/. dist/$(RPM_NAME_VERSION)
-
-tarballs: local-archive
- -mkdir -p dist/sources
- cd dist; tar cfj sources/$(TARBALL) $(RPM_NAME_VERSION)
- rm -rf dist/$(RPM_NAME_VERSION)
-
-rpmroot:
- rm -rf $(RPMBUILD)
- mkdir -p $(RPMBUILD)/BUILD
- mkdir -p $(RPMBUILD)/RPMS
- mkdir -p $(RPMBUILD)/SOURCES
- mkdir -p $(RPMBUILD)/SPECS
- mkdir -p $(RPMBUILD)/SRPMS
-
-rpmdistdir:
- mkdir -p dist/rpms
- mkdir -p dist/srpms
-
-rpms: rpmroot rpmdistdir tarballs
- cp dist/sources/$(TARBALL) $(RPMBUILD)/SOURCES/
- cp $(srcdir)/rpm/$(PACKAGE)-* $(RPMBUILD)/SOURCES/
- sed -e s/__VERSION__/$(RPM_VERSION)/ -e s/__RELEASE__/$(RPM_RELEASE)/ \
- $(srcdir)/rpm/$(PACKAGE).spec.in > $(RPMBUILD)/SPECS/$(PACKAGE).spec
- rpmbuild --define "_topdir $(RPMBUILD)" -ba $(RPMBUILD)/SPECS/$(PACKAGE).spec
- cp $(RPMBUILD)/RPMS/*/$(RPM_NAME_VERSION)-*.rpm dist/rpms/
- cp $(RPMBUILD)/RPMS/*/$(PACKAGE)-*-$(RPM_VERSION)-*.rpm dist/rpms/
- cp $(RPMBUILD)/SRPMS/$(RPM_NAME_VERSION)-*.src.rpm dist/srpms/
- rm -rf $(RPMBUILD)
-
diff --git a/configure.ac b/configure.ac
index 7d61149..c6edbfa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,10 +21,6 @@ AC_SUBST([CONSOLE_VERSION])
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
-# Set the version and release for developer RPM builds
-rpm_version=$RPM_VERSION
-rpm_release=$RPM_RELEASE
-
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
@@ -690,9 +686,6 @@ AC_SUBST(brand)
AC_SUBST(capbrand)
AC_SUBST(vendor)
-AC_SUBST(rpm_version)
-AC_SUBST(rpm_release)
-
# AC_DEFINE([USE_OLD_UNHASHED], [], [Use old unhashed code])
AC_DEFINE([LDAP_DEBUG], [1], [LDAP debug flag])
AC_DEFINE([LDAP_DONT_USE_SMARTHEAP], [1], [Don't use smartheap])
diff --git a/rpm.mk b/rpm.mk
new file mode 100644
index 0000000..dfbadc6
--- /dev/null
+++ b/rpm.mk
@@ -0,0 +1,51 @@
+RPMBUILD ?= $(PWD)/rpmbuild
+RPM_VERSION ?= $(shell $(PWD)/rpm/rpmverrel.sh version)
+RPM_RELEASE ?= $(shell $(PWD)/rpm/rpmverrel.sh release)
+PACKAGE = 389-ds-base
+RPM_NAME_VERSION = $(PACKAGE)-$(RPM_VERSION)
+TARBALL = $(RPM_NAME_VERSION).tar.bz2
+
+clean:
+ rm -rf dist
+ rm -rf rpmbuild
+
+local-archive:
+ -mkdir -p dist/$(RPM_NAME_VERSION)
+ rsync -a --exclude=dist --exclude=.git --exclude=rpmbuild . dist/$(RPM_NAME_VERSION)
+
+tarballs: local-archive
+ -mkdir -p dist/sources
+ cd dist; tar cfj sources/$(TARBALL) $(RPM_NAME_VERSION)
+ rm -rf dist/$(RPM_NAME_VERSION)
+
+rpmroot:
+ rm -rf $(RPMBUILD)
+ mkdir -p $(RPMBUILD)/BUILD
+ mkdir -p $(RPMBUILD)/RPMS
+ mkdir -p $(RPMBUILD)/SOURCES
+ mkdir -p $(RPMBUILD)/SPECS
+ mkdir -p $(RPMBUILD)/SRPMS
+
+rpmdistdir:
+ mkdir -p dist/rpms
+
+srpmdistdir:
+ mkdir -p dist/srpms
+
+rpmbuildprep:
+ cp dist/sources/$(TARBALL) $(RPMBUILD)/SOURCES/
+ cp rpm/$(PACKAGE)-* $(RPMBUILD)/SOURCES/
+ sed -e s/__VERSION__/$(RPM_VERSION)/ -e s/__RELEASE__/$(RPM_RELEASE)/ \
+ rpm/$(PACKAGE).spec.in > $(RPMBUILD)/SPECS/$(PACKAGE).spec
+
+srpms: rpmroot srpmdistdir tarballs rpmbuildprep
+ rpmbuild --define "_topdir $(RPMBUILD)" -bs $(RPMBUILD)/SPECS/$(PACKAGE).spec
+ cp $(RPMBUILD)/SRPMS/$(RPM_NAME_VERSION)-*.src.rpm dist/srpms/
+ rm -rf $(RPMBUILD)
+
+rpms: rpmroot srpmdistdir rpmdistdir tarballs rpmbuildprep
+ rpmbuild --define "_topdir $(RPMBUILD)" -ba $(RPMBUILD)/SPECS/$(PACKAGE).spec
+ cp $(RPMBUILD)/RPMS/*/$(RPM_NAME_VERSION)-*.rpm dist/rpms/
+ cp $(RPMBUILD)/RPMS/*/$(PACKAGE)-*-$(RPM_VERSION)-*.rpm dist/rpms/
+ cp $(RPMBUILD)/SRPMS/$(RPM_NAME_VERSION)-*.src.rpm dist/srpms/
+ rm -rf $(RPMBUILD)
diff --git a/rpm/rpmverrel.sh b/rpm/rpmverrel.sh
new file mode 100755
index 0000000..064b052
--- /dev/null
+++ b/rpm/rpmverrel.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# Source VERSION.sh to set the version
+# and release environment variables.
+source ./VERSION.sh
+
+if [ "$1" = "version" ]; then
+ echo $RPM_VERSION
+elif [ "$1" = "release" ]; then
+ echo $RPM_RELEASE
+fi
--
1.7.11.7
--
389-devel mailing list
389-devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/389-devel