[Fedora-directory-commits] ldapserver/ldap/cm fedora-patch.inf, NONE, 1.1.2.1 redhat-patch.inf, NONE, 1.1.2.1 genRpmPatch.pl, NONE, 1.1.2.1 Makefile, 1.30.2.1, 1.30.2.2

Noriko Hosoi (nhosoi) fedora-directory-commits at redhat.com
Sat Sep 10 00:41:50 UTC 2005


Author: nhosoi

Update of /cvs/dirsec/ldapserver/ldap/cm
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv19966/ldap/cm

Modified Files:
      Tag: Directory71RtmBranch
	Makefile 
Added Files:
      Tag: Directory71RtmBranch
	fedora-patch.inf redhat-patch.inf genRpmPatch.pl 
Log Message:
[167982] Service Pack framework
1) added patch info files and a perl script to process the info (RPM)
2) modified makefiles to create RPM based as well as setupsdk based SP package



--- NEW FILE fedora-patch.inf ---
#
# 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
#
# Info file to generate DS7.1 SP1 patch
# base: <builddir> containing the base package -- DS7.1
# file: <patchfile>
#
base: /share/dev4/fedora-ds/fds71/ships/20050526.1

file: 147585: plugins/slapd/slapi/examples/testpreop.c
file: 164834,165641,166229: bin/slapd/server/ns-slapd
file: 155276,164834,164843,165641,166229: bin/slapd/server/libslapd.*
file: 151678: bin/slapd/admin/bin/ds_newinst
file: 151678: bin/slapd/admin/bin/ds_create
file: 155276,164843,165641,165827,165862,166012: lib/libback-ldbm.*
file: 160003: bin/slapd/admin/scripts/template-db2index.pl
file: 160003: bin/slapd/admin/bin/upgradeServer
file: 164836,165600: lib/attr-unique-plugin.*
file: 165640: lib/views-plugin.*
file: 167478,160589: setup/setup
file: 156120,159037: winsync/PassSync.msi
file: 156120,159037: winsync/ntds.msi
file: 167761: java/jars/ds71.jar


--- NEW FILE redhat-patch.inf ---
#
# 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
#
# Info file to generate DS7.1 SP1 patch
# base: <builddir> containing the base package -- DS7.1
# file: <patchfile>
#
base: /share/dev4/ds/ds71/ships/20050524.1

file: 147585: plugins/slapd/slapi/examples/testpreop.c
file: 164834,165641,166229: bin/slapd/server/ns-slapd
file: 155276,164834,164843,165641,166229: bin/slapd/server/libslapd.*
file: 151678: bin/slapd/admin/bin/ds_newinst
file: 151678: bin/slapd/admin/bin/ds_create
file: 155276,164843,165641,165827,165862,166012: lib/libback-ldbm.*
file: 160003: bin/slapd/admin/scripts/template-db2index.pl
file: 160003: bin/slapd/admin/bin/upgradeServer
file: 164836,165600: lib/attr-unique-plugin.*
file: 165640: lib/views-plugin.*
file: 167478,160589: setup/setup
file: 156120,159037: winsync/PassSync.msi
file: 156120,159037: winsync/ntds.msi
file: 167761: java/jars/ds71.jar


--- NEW FILE genRpmPatch.pl ---
#!/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 =~ /optimized/) {
    $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: Makefile
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/cm/Makefile,v
retrieving revision 1.30.2.1
retrieving revision 1.30.2.2
diff -u -r1.30.2.1 -r1.30.2.2
--- Makefile	31 Aug 2005 21:40:49 -0000	1.30.2.1
+++ Makefile	10 Sep 2005 00:41:46 -0000	1.30.2.2
@@ -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,13 @@
 endif
 ABS_INSTDIR = $(shell cd $(INSTDIR); pwd)
 
+ifdef BUILD_PATCH
+ifndef BUILD_RPM
+PATCHINSTDIR = $(ABS_INSTDIR)-SP
+SLAPDSP = slapd-71sp1
+endif
+endif
+
 INST_TARGET_RESKIT=$(INSTDIR)/reskit
 INST_TARGET_INTL=./$(PRODUCT_MARKET)dir
 
@@ -610,6 +624,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
+
 # copy over the setup sdk stuff
 # hack - remove once admin server bundles setupsdk 6.02
 #	cp -R $(SETUP_SDK_BUILD_DIR)/bin/* $(INSTDIR)
@@ -779,6 +802,29 @@
 endif # BUILD_SHIP
 endif # BUILD_RPM
 
+ifdef BUILD_PATCH
+ifndef BUILD_RPM
+	mkdir -p $(PATCHINSTDIR)/$(SLAPDSP)
+	cp $(INSTDIR)/dssetup $(PATCHINSTDIR)
+	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}'`
+# 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
+	cd $(PATCHINSTDIR); $(TAR) cvf - * | gzip -f > ../$(NS_BUILD_FLAVOR)-SP.tar.gz
+endif
+endif
+
 else
 
 # ---THE NT PACKAGE---




More information about the Fedora-directory-commits mailing list