Author: nhosoi
Update of /cvs/dirsec/ldapserver/ldap/cm
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv18968/ldap/cm
Modified Files:
Makefile
Added Files:
fedora-patch.inf genRpmPatch.pl redhat-patch.inf
Log Message:
[167982] Service Pack framework
Ported the patch making code to the trunk.
Index: fedora-patch.inf
===================================================================
RCS file: fedora-patch.inf
diff -N fedora-patch.inf
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ fedora-patch.inf 22 Sep 2005 16:48:16 -0000 1.2
@@ -0,0 +1,47 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# This Program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation; version 2 of the License.
+#
+# This Program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA.
+#
+# In addition, as a special exception, Red Hat, Inc. gives You the additional
+# right to link the code of this Program with code not covered under the GNU
+# General Public License ("Non-GPL Code") and to distribute linked combinations
+# including the two, subject to the limitations in this paragraph. Non-GPL Code
+# permitted under this exception must only link to the code of this Program
+# through those well defined interfaces identified in the file named EXCEPTION
+# found in the source code files (the "Approved Interfaces"). The files of
+# Non-GPL Code may instantiate templates or use macros or inline functions from
+# the Approved Interfaces without causing the resulting work to be covered by
+# the GNU General Public License. Only Red Hat, Inc. may make changes or
+# additions to the list of Approved Interfaces. You must obey the GNU General
+# Public License in all respects for all of the Program code and other code used
+# in conjunction with the Program except the Non-GPL Code covered by this
+# exception. If you modify this file, you may extend this exception to your
+# version of the file, but you are not obligated to do so. If you do not wish to
+# provide this exception without modification, you must delete this exception
+# statement from your version and license this file solely under the GPL without
+# exception.
+#
+#
+# Copyright (C) 2005 Red Hat, Inc.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+# Sample Info file to generate service pack
+# base: <builddir> containing the base package -- e.g., DS7.1
+# file: <bugzilla number>: <patchfile>
+#
+base: /share/dev4/fedora-ds/fds71/ships/20050526.1
+
+file: 000001: README.txt
+file: 000002: COPYRIGHT.txt
+
Index: genRpmPatch.pl
===================================================================
RCS file: genRpmPatch.pl
diff -N genRpmPatch.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ genRpmPatch.pl 22 Sep 2005 16:48:16 -0000 1.2
@@ -0,0 +1,231 @@
+#!/usr/bin/perl
+#
+# BEGIN COPYRIGHT BLOCK
+# This Program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation; version 2 of the License.
+#
+# This Program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA.
+#
+# In addition, as a special exception, Red Hat, Inc. gives You the additional
+# right to link the code of this Program with code not covered under the GNU
+# General Public License ("Non-GPL Code") and to distribute linked combinations
+# including the two, subject to the limitations in this paragraph. Non-GPL Code
+# permitted under this exception must only link to the code of this Program
+# through those well defined interfaces identified in the file named EXCEPTION
+# found in the source code files (the "Approved Interfaces"). The files of
+# Non-GPL Code may instantiate templates or use macros or inline functions from
+# the Approved Interfaces without causing the resulting work to be covered by
+# the GNU General Public License. Only Red Hat, Inc. may make changes or
+# additions to the list of Approved Interfaces. You must obey the GNU General
+# Public License in all respects for all of the Program code and other code used
+# in conjunction with the Program except the Non-GPL Code covered by this
+# exception. If you modify this file, you may extend this exception to your
+# version of the file, but you are not obligated to do so. If you do not wish to
+# provide this exception without modification, you must delete this exception
+# statement from your version and license this file solely under the GPL without
+# exception.
+#
+#
+# Copyright (C) 2005 Red Hat, Inc.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+#
+#
+
+sub usage {
+ print(STDERR "Usage : $0 -r <releasedir> -o <objdir> -e <extension> -i <identity> -f <inffile>\n");
+ print(STDERR " -r <releasedir>: built/release dir\n");
+ print(STDERR " -o <objdir>: e.g., RHEL4-domestic-full-normal-pth-slapd\n");
+ print(STDERR " -e <extension>: extension for the patch dir\n");
+ print(STDERR " -i <identity>: fedora or redhat\n");
+ print(STDERR " -f <inffile>: file containing the patch info\n");
+ print(STDERR "sample <inffile>\n");
+ print(STDERR " ======================================================\n");
+ print(STDERR " base: /share/dev4/fedora-ds/fds71/ships/20050526.1\n");
+ print(STDERR " file: 147585: plugins/slapd/slapi/examples/testpreop.c\n");
+ print(STDERR " file: 164834,165641: bin/slapd/server/ns-slapd\n");
+ print(STDERR " ======================================================\n");
+}
+
+$verbose = 0;
+$inffile = "";
+$builtdirname = "";
+$releasedir = "";
+$extension = "";
+$identity = "";
+
+$i = 0;
+while ($i <= $#ARGV) {
+ if ("$ARGV[$i]" eq "-o") {
+ $i++;
+ $builtdirname = $ARGV[$i];
+ } elsif ("$ARGV[$i]" eq "-r") {
+ $i++;
+ $releasedir = $ARGV[$i];
+ } elsif ("$ARGV[$i]" eq "-e") {
+ $i++;
+ $extension = $ARGV[$i];
+ } elsif ("$ARGV[$i]" eq "-i") {
+ $i++;
+ $identity = $ARGV[$i];
+ } elsif ("$ARGV[$i]" eq "-f") {
+ $i++;
+ $inffile = $ARGV[$i];
+ } elsif ("$ARGV[$i]" eq "-v") {
+ $verbose = 1;
+ }
+ $i++;
+}
+
+if ("$builtdirname" eq "") {
+ print(STDERR "ERROR: builtdirname is not given\n");
+ &usage; exit(1);
+}
+if ("$releasedir" eq "") {
+ print(STDERR "ERROR: releasedir is not given\n");
+ &usage; exit(1);
+}
+if ("$extension" eq "") {
+ print(STDERR "ERROR: extension is not given\n");
+ &usage; exit(1);
+}
+if ("$identity" eq "" ||
+ (("$identity" ne "fedora") && ("$identity" ne "redhat"))) {
+ print(STDERR "ERROR: $identity is not fedora or redhat\n");
+ &usage; exit(1);
+}
+if ("$inffile" eq "") {
+ print(STDERR "ERROR: inffile is not given\n");
+ &usage; exit(1);
+}
+if (!(-d "$releasedir")) {
+ print(STDERR "ERROR: $releasedir does not exist\n");
+ exit(1);
+}
+
+unless (open (INFFILE, $inffile)) {
+ die "Error, cannot open info file $inffile\n";
+}
+
+$basedir = 0;
+@newfiles = ();
+while ($l = <INFFILE>) {
+ chop($l);
+ $pos = length($l);
+ if ($l =~ /^base: /) {
+ $pos = rindex($l, ":", $pos);
+ $pos++;
+ $basedir = substr($l, $pos);
+ $basedir =~ s/[ ]//g;
+ } elsif ($l =~ /^file: /) {
+ $pos = rindex($l, ":", $pos);
+ $pos++;
+ $file = substr($l, $pos);
+ $file =~ s/[ ]//g;
+ push(@newfiles, ($file));
+ }
+}
+if (1 == $verbose) {
+ print "Base: $basedir\n";
+ print "New Files:\n";
+ foreach $afile (@newfiles) {
+ print " $afile\n";
+ }
+}
+
+if ($builtdirname !~ /RHEL/) {
+ print(STDERR "ERROR: Not RHEL\n");
+ exit(1);
+}
+
+# Get info from $builtdirname (e.g., RHEL4-domestic-full-normal-pth-slapd\n")
+$rhelversion = "";
+$rhelversionl = "";
+if ($builtdirname =~ /RHEL3/) {
+ $rhelversion = "RHEL3";
+ $rhelversionl = "rhel3";
+} elsif ($builtdirname =~ /RHEL4/) {
+ $rhelversion = "RHEL4";
+ $rhelversionl = "rhel4";
+} else {
+ print(STDERR "ERROR: $builtdirname is not supported\n");
+ exit(1);
+}
+
+$optordbg = "";
+if ($builtdirname =~ /full/) {
+ $optordbg = "dbg";
+} elsif ($builtdirname =~ /optimize/) {
+ $optordbg = "opt";
+} else {
+ print(STDERR "ERROR: $builtdirname has no opt/debug info\n");
+ exit(1);
+}
+
+# Get fullpath to the RPM file
+$fullrpmfile = "";
+$iddir = "";
+opendir(BASEDIR, $basedir) or die "ERROR: Could not open $basedir\n";
+while ( defined ( $subdir = readdir(BASEDIR))) {
+ if ($subdir =~ /$rhelversionl/ || $subdir =~ /$rhelversion/) {
+ $fullsubdir = $basedir . "/" . $subdir;
+ opendir(SUBDIR, $fullsubdir) or die "ERROR: Could not open $fullsubdir\n";
+ while ( defined ( $rpmfile = readdir(SUBDIR))) {
+ if (($rpmfile =~ /$rhelversionl/ || $rpmfile =~ /$rhelversion/) &&
+ $rpmfile =~ /$optordbg/ && $rpmfile =~ /\.rpm$/) {
+ $fullrpmfile = $fullsubdir . "/" . $rpmfile;
+ ($org, $ds, $rest) = split('-', $rpmfile, 3);
+ $iddir = $org . "-" . $ds;
+ if ("$org" ne "$identity") {
+ print "ERROR: rpmfile name $rpmfile does not match the given identity $identity\n";
+ exit(1);
+ }
+ closedir(SUBDIR);
+ last;
+ }
+ }
+ closedir(BASEDIR);
+ last;
+ }
+}
+if ("$fullrpmfile" eq "") {
+ print(STDERR "ERROR: Cannot file an rpm file under $basedir\n");
+ exit(1);
+}
+if (1 == $verbose) {
+ print "RPM File: $fullrpmfile\n";
+}
+
+# Expand the RPM file to the $releasedir
+$workdir = $releasedir . "/slapd/" . $builtdirname . $extension;
+mkdir($workdir, 0700);
+chdir($workdir);
+if (1 == $verbose) {
+ print "Work Dir: $workdir\n";
+}
+open(RPM2CPIO, "rpm2cpio $fullrpmfile | cpio -id | ") or die "Cannot run program: $!\n";
+close(RPM2CPIO);
+
+# Copy new files onto the expanded files
+foreach $afile (@newfiles) {
+ $srcfile = $releasedir . "/slapd/" . $builtdirname . "/" . $afile;
+ $destfile = $workdir . "/opt/" . $iddir . "/" . $afile;
+ $destdir = substr($destfile, 0, rindex($destfile, "/", length($destfile)));
+ if (!(-d $destdir)) {
+ print "WARNING: $destdir does not exist. Skipping ...\n";
+ next;
+ }
+ if (1 == $verbose) {
+ print "Copy: $srcfile => $destdir\n";
+ }
+ open(COPY, "cp $srcfile $destdir | ") or print "Copy $srcfile to $destdir failed: $!\n";
+ close(COPY);
+}
Index: redhat-patch.inf
===================================================================
RCS file: redhat-patch.inf
diff -N redhat-patch.inf
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ redhat-patch.inf 22 Sep 2005 16:48:16 -0000 1.2
@@ -0,0 +1,47 @@
+#
+# BEGIN COPYRIGHT BLOCK
+# This Program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation; version 2 of the License.
+#
+# This Program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA 02111-1307 USA.
+#
+# In addition, as a special exception, Red Hat, Inc. gives You the additional
+# right to link the code of this Program with code not covered under the GNU
+# General Public License ("Non-GPL Code") and to distribute linked combinations
+# including the two, subject to the limitations in this paragraph. Non-GPL Code
+# permitted under this exception must only link to the code of this Program
+# through those well defined interfaces identified in the file named EXCEPTION
+# found in the source code files (the "Approved Interfaces"). The files of
+# Non-GPL Code may instantiate templates or use macros or inline functions from
+# the Approved Interfaces without causing the resulting work to be covered by
+# the GNU General Public License. Only Red Hat, Inc. may make changes or
+# additions to the list of Approved Interfaces. You must obey the GNU General
+# Public License in all respects for all of the Program code and other code used
+# in conjunction with the Program except the Non-GPL Code covered by this
+# exception. If you modify this file, you may extend this exception to your
+# version of the file, but you are not obligated to do so. If you do not wish to
+# provide this exception without modification, you must delete this exception
+# statement from your version and license this file solely under the GPL without
+# exception.
+#
+#
+# Copyright (C) 2005 Red Hat, Inc.
+# All rights reserved.
+# END COPYRIGHT BLOCK
+#
+# Sample Info file to generate service pack
+# base: <builddir> containing the base package -- e.g., DS7.1
+# file: <bugzilla number>: <patchfile>
+#
+base: /share/dev4/fedora-ds/fds71/ships/20050526.1
+
+file: 000001: README.txt
+file: 000002: COPYRIGHT.txt
+
Index: Makefile
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/cm/Makefile,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- Makefile 14 Sep 2005 21:39:42 -0000 1.32
+++ Makefile 22 Sep 2005 16:48:16 -0000 1.33
@@ -214,6 +214,13 @@
FIX_SETUP_INF = $(BUILD_ROOT)/ldap/cm/fixSetupInf.pl
FIX_BASE_INF = $(BUILD_ROOT)/ldap/cm/fixBaseInf.pl
+ABSBUILD_ROOT = $(shell cd $(BUILD_ROOT); pwd)
+ABSRELDIR = $(ABSBUILD_ROOT)/built/release
+GENRPMPATCH = $(ABSBUILD_ROOT)/ldap/cm/genRpmPatch.pl
+PATCHINF = $(ABSBUILD_ROOT)/ldap/cm/fedora-patch.inf
+DATETIME = $(shell date +%Y%m%d-%H%M%S)
+SPEXT = .SP.$(DATETIME)
+
# This is the directory where we put what we're making: the files which go on the CD.
ifndef INSTDIR
ifeq ($(ARCH), WINNT)
@@ -224,6 +231,11 @@
endif
ABS_INSTDIR = $(shell cd $(INSTDIR); pwd)
+ifdef BUILD_PATCH
+PATCHINSTDIR = $(ABS_INSTDIR)-SP
+SLAPDSP = slapd-71
+endif
+
INST_TARGET_RESKIT=$(INSTDIR)/reskit
INST_TARGET_INTL=./$(PRODUCT_MARKET)dir
@@ -610,6 +622,15 @@
$(INSTDIR)/tools/infozip.zip \
$(ADMSERV_DEP)
+ifdef BUILD_PATCH
+ifdef BUILD_RPM
+# create a patch
+ $(GENRPMPATCH) -i $(RPM_BASE_NAME) -o $(NS_BUILD_FLAVOR) -r $(ABSRELDIR) -e $(SPEXT) -f $(PATCHINF) -v
+ mv $(ABSRELDIR)/slapd/$(NS_BUILD_FLAVOR) $(ABSRELDIR)/slapd/$(NS_BUILD_FLAVOR).original
+ ln -s $(ABSRELDIR)/slapd/$(NS_BUILD_FLAVOR)$(SPEXT)/opt/$(RPM_BASE_NAME)-ds $(ABSRELDIR)/slapd/$(NS_BUILD_FLAVOR)
+endif
+endif
+
# this gets setup, setup.inf, silent.inf, the zip wrapper, and svrcore, among others
ifeq ($(USE_SETUPUTIL),1)
cp -R $(SETUPUTIL_BINPATH)/* $(INSTDIR)
@@ -712,8 +733,10 @@
| gzip -f > ../$(NS_BUILD_FLAVOR).tar.gz
# build the combined packages tar file; use h flag to follow symlinks
ifdef BUILD_SHIP
+ifndef BUILD_PATCH
cd $(INSTDIR); $(TAR) cvfh - setup.inf setup slapd nsperl \
perldap dsktune tools $(ADMIN_IMPORTS) | gzip -f > $(BUILD_SHIP)/$(FTPNAMEGZ)
+endif
ifeq ($(DEBUG), optimize)
# $(REMSH) "/u/svbld/bin/preRtm $(BUILD_SHIP) $(FTPNAMEGZ) svbld"
endif
@@ -739,13 +762,44 @@
rm $(RPM_FILE_BASE) ; \
fi
# execute the RPM build
- rpmbuild $(RPM_TOPDIR) $(RPM_SOURCEDIR) $(RPM_BUILDDIR) $(RPM_RPMDIR) $(RPM_SRPMDIR) --define "flavor $(RPM_FLAVOR)" --clean --nodeps -ba $(OBJDIR)/$(RPM_BASE_NAME)-ds.spec
+ rpmbuild $(RPM_TOPDIR) $(RPM_SOURCEDIR) $(RPM_BUILDDIR) $(RPM_RPMDIR) $(RPM_SRPMDIR) $(RPM_REQUIRES) --define "flavor $(RPM_FLAVOR)" --clean --nodeps -ba $(OBJDIR)/$(RPM_BASE_NAME)-ds.spec
ifdef BUILD_SHIP
cp $(ABS_TOPDIR)/$(RPM_FILE_BASE)*$(NSOS_ARCH)$(NSOS_RELEASE).$(RPM_ARCH).$(RPM_FLAVOR).rpm $(BUILD_SHIP)
endif # BUILD_SHIP
endif # BUILD_RPM
+ifdef BUILD_PATCH
+ mkdir -p $(PATCHINSTDIR)/$(SLAPDSP)
+ cp $(INSTDIR)/LICENSE.txt $(PATCHINSTDIR)
+ cp $(INSTDIR)/README.txt $(PATCHINSTDIR)
+# prepare the main inf file: setup.inf pointing inf file $(SLAPDS)/$(SLAPD).inf
+ sed -e "s/Components.*=/Components = $(SLAPDSP)/" $(INSTDIR)/setup.inf > $(PATCHINSTDIR)/setup.inf
+ echo "" >> $(PATCHINSTDIR)/setup.inf
+ echo "[$(SLAPDSP)]" >> $(PATCHINSTDIR)/setup.inf
+ echo "ComponentInfoFile = $(SLAPDSP)/$(SLAPDSP).inf" >> $(PATCHINSTDIR)/setup.inf
+# create a zip file based upon the $(PATCHINF) file
+ cd $(ABSRELDIR)/slapd/$(NS_BUILD_FLAVOR); zip -r $(PATCHINSTDIR)/$(SLAPDSP)/ns$(SLAPDSP).zip `egrep file: $(PATCHINF) | awk -F: '{print $$3}'`
+# put ns-config and needed libs in the $(PATCHINSTDIR)/$(SLAPDSP) directory
+ $(INSTALL) -m 755 $(RELDIR_32)/bin/slapd/admin/bin/ns-config $(PATCHINSTDIR)/$(SLAPDSP)
+ -@for file in $(PACKAGE_SETUP_LIBS_32) ; \
+ do if [ -f $$file ] ; \
+ then $(INSTALL) -m 755 $$file $(PATCHINSTDIR)/$(SLAPDSP) ; \
+ fi ; \
+ done
+# create patch inf file: $(SLAPD).inf
+ cp $(OBJDIR)/slapd-patch.inf $(PATCHINSTDIR)/$(SLAPDSP)/$(SLAPDSP).inf
+ cd $(ABSRELDIR)/slapd/$(NS_BUILD_FLAVOR); ls `egrep file: $(PATCHINF) | egrep -v "setup/setup" | awk -F: '{print $$3}'` > $(PATCHINSTDIR)/$(SLAPDSP)/$(SLAPDSP).inf.tmp
+ echo `cat $(PATCHINSTDIR)/$(SLAPDSP)/$(SLAPDSP).inf.tmp` | sed -e "s/ /,/g" > $(PATCHINSTDIR)/$(SLAPDSP)/$(SLAPDSP).inf.tmp2
+ echo "BackupFiles="`cat $(PATCHINSTDIR)/$(SLAPDSP)/$(SLAPDSP).inf.tmp2`>> $(PATCHINSTDIR)/$(SLAPDSP)/$(SLAPDSP).inf
+ rm -f $(PATCHINSTDIR)/$(SLAPDSP)/$(SLAPDSP).inf.tmp $(PATCHINSTDIR)/$(SLAPDSP)/$(SLAPDSP).inf.tmp2
+ifdef BUILD_SHIP
+ cd $(PATCHINSTDIR); $(TAR) cvfh - * | gzip -f > $(BUILD_SHIP)/$(FTPNAMEGZ)
+else
+ cd $(PATCHINSTDIR); $(TAR) cvfh - * | gzip -f > ../$(NS_BUILD_FLAVOR)-SP.tar.gz
+endif
+endif
+
else
# ---THE NT PACKAGE---