Browse Source

I got rid of ldapserver.spec. Instead, the spec file will be created on the fly. The only parameter passed in is the flavor - redhat or fedora. Everything else comes from the brandver.dat file. PLATFORM is derived from BUILD_ARCH in the usual Makefile way. So we could easily support Solaris or whatever else. The Makefile change is to allow you to produce the .spec file without having to build everything else. The change to reltools/brandver.pl allows us to change only the named files rather than every file in the .dat file.

The builddsrpm.sh is now the only thing you need to build the ds rpms:
cvs co ldapserver/builddsrpm.sh ; cp ldapserver/builddsrpm.sh . ; ./builddsrpm.sh [redhat|fedora]
Rich Megginson 20 years ago
parent
commit
12efac13b9
3 changed files with 62 additions and 39 deletions
  1. 7 0
      Makefile
  2. 35 20
      builddsrpm.sh
  3. 20 19
      ldapserver.spec.tmpl

+ 7 - 0
Makefile

@@ -296,3 +296,10 @@ else
 endif
 endif
 	@echo =========== Finished - LDAP Server L10N Package Build ============
 	@echo =========== Finished - LDAP Server L10N Package Build ============
 
 
+redhat-ds.spec: ldapserver.spec.tmpl branding/rhds/brandver.dat $(RELTOOLSPATH)/brandver.pl
+	sed -e s/@PLATFORM@/$(BUILD_ARCH)/g ldapserver.spec.tmpl > $@
+	$(RELTOOLSPATH)/brandver.pl -i branding/rhds/brandver.dat $@
+
+fedora-ds.spec: ldapserver.spec.tmpl branding/fedora/brandver.dat $(RELTOOLSPATH)/brandver.pl
+	sed -e s/@PLATFORM@/$(BUILD_ARCH)/g ldapserver.spec.tmpl > $@
+	$(RELTOOLSPATH)/brandver.pl -i branding/fedora/brandver.dat $@

+ 35 - 20
builddsrpm.sh

@@ -1,4 +1,4 @@
-#!/bin/sh -v
+#!/bin/sh -vx
 # --- BEGIN COPYRIGHT BLOCK ---
 # --- BEGIN COPYRIGHT BLOCK ---
 # Copyright (C) 2005 Red Hat, Inc.
 # Copyright (C) 2005 Red Hat, Inc.
 # All rights reserved.
 # All rights reserved.
@@ -14,31 +14,46 @@ mkdirs() {
 	done
 	done
 }
 }
 
 
-if [ ! -f $HOME/.rpmmacros ]; then
-	echo "This script assumes you want to build as a non-root"
-	echo "user and in a non-default place (e.g. your home dir)"
-	echo "You must have a $HOME/.rpmmacros file that redefines"
-	echo "_topdir e.g."
-	echo "%_topdir	/home/rmeggins/ds71"
-	echo "Please create that file with the above contents and"
-	echo "rerun this script."
+flavor=$1
+
+rootdir=`pwd`
+
+if [ ! $flavor ] ; then
+	echo "Error: $0 <flavor>"
+	echo "flavor is either redhat or fedora"
+	echo "use redhat to create a redhat branded DS or use fedora"
+	echo "for the fedora branded DS"
 	exit 1
 	exit 1
 fi
 fi
 
 
-NAME=ldapserver
-VERSION=7.1
+mkdirs SOURCES BUILD SRPMS RPMS
+cd SOURCES
+
+# check out files from this CVS repo
+CVSNAME=ldapserver
 # change HEAD to a real static tag when available
 # change HEAD to a real static tag when available
 CVSTAG=HEAD
 CVSTAG=HEAD
 
 
-mkdirs SOURCES BUILD SRPMS RPMS
-cd SOURCES
-rm -rf $NAME-$VERSION $NAME-$VERSION.tar.gz
 echo "Checking out source code . . ."
 echo "Checking out source code . . ."
-cvs export -r $CVSTAG -d $NAME-$VERSION $NAME > /dev/null 2>&1
+cvs export -r $CVSTAG $CVSNAME > /dev/null 2>&1
+
+echo "Creating the spec file $flavor-ds.spec . . ."
+cd $CVSNAME ; make $flavor-ds.spec ; cp $flavor-ds.spec $rootdir ; cd $rootdir/SOURCES
+
+echo "Get version from spec file . . ."
+VERSION=`grep \^Version $rootdir/$flavor-ds.spec | awk '{print $2}'`
+
 echo "Building tarball . . ."
 echo "Building tarball . . ."
-tar cf - $NAME-$VERSION | gzip > $NAME-$VERSION.tar.gz
-rm -rf $NAME-$VERSION
-cd ..
+mv $CVSNAME $flavor-ds-$VERSION
+tar cfh - $flavor-ds-$VERSION | gzip > $flavor-ds-$VERSION.tar.gz
+rm -rf $flavor-ds-$VERSION
+cd $rootdir
+
+macrosfile=/tmp/macros.$$
+trap "rm -f $macrosfile" 0 1 2 3 15
+
+echo "%_topdir	$rootdir" > $macrosfile
+
 echo "Executing rpmbuild . . ."
 echo "Executing rpmbuild . . ."
-rpmbuild -ba $NAME.spec
-echo "Finished doing rpmbuild $NAME.spec"
+rpmbuild --macros=$macrosfile -ba $flavor-ds.spec
+echo "Finished doing rpmbuild $flavor-ds.spec"

+ 20 - 19
ldapserver.spec → ldapserver.spec.tmpl

@@ -2,13 +2,13 @@
 # Copyright (C) 2005 Red Hat, Inc.
 # Copyright (C) 2005 Red Hat, Inc.
 # All rights reserved.
 # All rights reserved.
 # END COPYRIGHT BLOCK
 # END COPYRIGHT BLOCK
-Summary: Directory Server
-Name: ldapserver
-Version: 7.1
-Release: 0
-License: GPL
+Summary: @COMPANY-PRODUCT-NAME@
+Name: @LCASE-COMPANY-NAME-NOSP@-ds
+Version: @GEN-VERSION@
+Release: 1.@PLATFORM@
+License: GPL plus extensions
 Group: System Environment/Daemons
 Group: System Environment/Daemons
-URL: http://www.redhat.com
+URL: @COMPANY-URL@
 Source0: %{name}-%{version}.tar.gz
 Source0: %{name}-%{version}.tar.gz
 BuildRoot: %{_builddir}/%{name}-root
 BuildRoot: %{_builddir}/%{name}-root
 BuildPreReq: perl, fileutils, make
 BuildPreReq: perl, fileutils, make
@@ -20,7 +20,7 @@ Requires: perl
 Prefix: /opt/%{name}
 Prefix: /opt/%{name}
 
 
 %description
 %description
-ldapserver is an LDAPv3 compliant server.
+@COMPANY-PRODUCT-NAME@ is an LDAPv3 compliant server.
 
 
 # prep and setup expect there to be a Source0 file
 # prep and setup expect there to be a Source0 file
 # in the SOURCES directory - it will be unpacked
 # in the SOURCES directory - it will be unpacked
@@ -37,24 +37,22 @@ ldapserver is an LDAPv3 compliant server.
 # build the file structure to package under ldapserver/pkg
 # build the file structure to package under ldapserver/pkg
 # instead of MM.DD/platform
 # instead of MM.DD/platform
 # remove BUILD_DEBUG=optimize to build the debug version
 # remove BUILD_DEBUG=optimize to build the debug version
-make BUILD_JAVA_CODE=1 BUILD_DEBUG=optimize NO_INSTALLER_TAR_FILES=1 INSTDIR=../../pkg
+# INTERNAL_BUILD=1 uses the internal, proprietary packages
+# like setupsdk, adminsdk, admin server
+# BUILD_MODE=int builds the Redhat branded product
+BUILDMODE=@BUILD-MODE@
+if [ $BUILDMODE = int ]; then
+# brandDirectory makes the product use Redhat branded text and graphics
+	make brandDirectory
+fi
+make INTERNAL_BUILD=1 BUILD_MODE=$BUILDMODE BUILD_JAVA_CODE=1 BUILD_DEBUG=optimize NO_INSTALLER_TAR_FILES=1 INSTDIR=../../pkg
 
 
 %install
 %install
 # all we do here is run setup -b to unpack the binaries
 # all we do here is run setup -b to unpack the binaries
 # into the BuildRoot
 # into the BuildRoot
 rm -rf $RPM_BUILD_ROOT
 rm -rf $RPM_BUILD_ROOT
 cd pkg
 cd pkg
-# hack hack hack
-# hack for unbundled jre - please fix!!!!!!
-export NSJRE=/share/builds/components/jdk/1.4.2/Linux/jre
-mkdir tmp
-cd tmp
-mkdir -p bin/base/jre
-cp -r $NSJRE/bin bin/base/jre
-cp -r $NSJRE/lib bin/base/jre
-zip -q -r ../base/nsjre.zip bin
-cd ..
-rm -rf tmp
+# the echo yes is for dsktune to continue
 echo yes | ./setup -b $RPM_BUILD_ROOT/%{prefix}
 echo yes | ./setup -b $RPM_BUILD_ROOT/%{prefix}
 # this is our setup script that sets up the initial
 # this is our setup script that sets up the initial
 # server instances after installation
 # server instances after installation
@@ -76,6 +74,9 @@ echo ""
 echo "Please cd " %{prefix} " and run ./setup/setup"
 echo "Please cd " %{prefix} " and run ./setup/setup"
 
 
 %changelog
 %changelog
+* Tue Mar 29 2005 Richard Megginson <[email protected]> 7.1-1
+- use INTERNAL_BUILD=1 for internal builds - change rev to 1
+
 * Tue Mar  8 2005 Richard Megginson <[email protected]> 7.1-0
 * Tue Mar  8 2005 Richard Megginson <[email protected]> 7.1-0
 - use ${prefix} instead of /opt/ldapserver - prefix is defined as /opt/%{name}
 - use ${prefix} instead of /opt/ldapserver - prefix is defined as /opt/%{name}