rpms/dbxml/F-7 dbxml-index-utilisation.patch, NONE, 1.1 dbxml-invalid-schema.patch, NONE, 1.1 dbxml-os-clock.patch, NONE, 1.1 dbxml-predicates.patch, NONE, 1.1 dbxml-python-build.patch, NONE, 1.1 dbxml-python25-types.patch, NONE, 1.1 dbxml-query-performance.patch, NONE, 1.1 dbxml-standalone-build.patch, NONE, 1.1 dbxml-statistics.patch, NONE, 1.1 dbxml-xmlindexlookup.patch, NONE, 1.1 dbxml-xmlmodify.patch, NONE, 1.1 dbxml.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Milan Zazrivec (mzazrive) fedora-extras-commits at redhat.com
Sun Jan 6 18:09:27 UTC 2008


Author: mzazrive

Update of /cvs/pkgs/rpms/dbxml/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv1840/F-7

Modified Files:
	.cvsignore sources 
Added Files:
	dbxml-index-utilisation.patch dbxml-invalid-schema.patch 
	dbxml-os-clock.patch dbxml-predicates.patch 
	dbxml-python-build.patch dbxml-python25-types.patch 
	dbxml-query-performance.patch dbxml-standalone-build.patch 
	dbxml-statistics.patch dbxml-xmlindexlookup.patch 
	dbxml-xmlmodify.patch dbxml.spec 
Log Message:
Initial import of dbxml ver. 2.3.10-9 into F-7 branch


dbxml-index-utilisation.patch:

--- NEW FILE dbxml-index-utilisation.patch ---
--- src/dbxml/optimizer/QueryPlanGenerator.cpp	2007-01-17 20:13:07.000000000 +0000
+++ src/dbxml/optimizer/QueryPlanGenerator.cpp	2007-03-22 11:13:19.000000000 +0000
@@ -749,8 +749,8 @@
 
 		root = new (mm) ImpliedSchemaNode(ImpliedSchemaNode::ROOT, mm);
 		item->setImpliedSchema(root);
-		storeInScopeVars(root);
 	}
+	storeInScopeVars(root);
 
 	result.join(root);
 	result.operation = new (&memMgr_) PathsQP(result.returnPaths, &memMgr_);
@@ -1073,7 +1073,7 @@
 
 void QueryPlanGenerator::storeInScopeVars(ImpliedSchemaNode *root) {
 	// List the in scope vars
-	VariableIDs vars;
+	VariableIDs &vars = inScopeVars_[root];
 	VarStore::MyScope* index = const_cast<VarStore::MyScope*>(varStore_.getCurrentScope());
 	while(index) {
 		std::vector< std::pair<unsigned int, const XMLCh*> > tmp = index->getVars();
@@ -1086,8 +1086,6 @@
 			index = const_cast<VarStore::MyScope*>(varStore_.getGlobalScope());
 		else index = index->getNext();
 	}
-
-	inScopeVars_[root] = vars;
 }
 
 class ArgHolder {

dbxml-invalid-schema.patch:

--- NEW FILE dbxml-invalid-schema.patch ---
*** src/dbxml/nodeStore/NsSAX2Reader.cpp	Mon Oct 30 12:45:57 2006
--- src/dbxml/nodeStore/NsSAX2Reader.cpp	Fri Oct 26 10:51:11 2007
***************
*** 1008,1016 ****
  			  const XMLSSize_t colNum)
  {
  	int len = NsUtil::nsStringLen(errorText);
! 	xmlbyte_t buf[500];
! 	xmlbyte_t *bufp = buf;
! 	len = NsUtil::nsToUTF8((MemoryManager*)0, &bufp,
  			       errorText, len+1, 500);
  
  	std::ostringstream s;
--- 1008,1015 ----
  			  const XMLSSize_t colNum)
  {
  	int len = NsUtil::nsStringLen(errorText);
! 	xmlbyte_t *bufp = (xmlbyte_t *) fMemoryManager->allocate(500);
! 	len = NsUtil::nsToUTF8(fMemoryManager, &bufp,
  			       errorText, len+1, 500);
  
  	std::ostringstream s;
***************
*** 1022,1028 ****
  	s << " Parse error in document ";
  	s << "at line, " << lineNum;
  	s << ", char " << colNum;
! 	s << ". Parser message: " << buf;
  	// log warnings as info, and errors as warning.
  	// Neither is fatal to the program, and may be
  	// what is expected.
--- 1021,1027 ----
  	s << " Parse error in document ";
  	s << "at line, " << lineNum;
  	s << ", char " << colNum;
! 	s << ". Parser message: " << bufp;
  	// log warnings as info, and errors as warning.
  	// Neither is fatal to the program, and may be
  	// what is expected.

dbxml-os-clock.patch:

--- NEW FILE dbxml-os-clock.patch ---
--- src/common/Timer.cpp	2006-10-30 18:45:50.000000000 +0100
+++ src/common/Timer.cpp	2007-10-29 18:11:54.000000000 +0100
@@ -10,10 +10,7 @@
 #include <db_cxx.h>
 #include <iostream>
 #include <sstream>
-
-// use __os_clock from Berkeley DB internals
-
-extern "C" int __os_clock(DB_ENV *, u_int32_t *, u_int32_t *);
+#include <sys/time.h>
 
 using namespace DbXml;
 
@@ -33,13 +30,20 @@
 
 void Timer::start()
 {
-	(void)__os_clock(NULL, &start_secs, &start_usecs);
+	struct timeval v;
+	gettimeofday(&v, NULL);
+	start_secs = v.tv_sec;
+	start_usecs = v.tv_usec;
 }
 
 void Timer::stop()
 {
 	u_int32_t stop_secs, stop_usecs;
-	(void)__os_clock(NULL, &stop_secs, &stop_usecs);
+	struct timeval v;
+
+	gettimeofday(&v, NULL);
+	stop_secs = v.tv_sec;
+	stop_usecs = v.tv_usec;
 	duration_secs += (stop_secs - start_secs);
 	duration_usecs += (stop_usecs - start_usecs);
 	// fixup for usec under/overflow
--- src/dbxml/HighResTimer.cpp	2006-10-30 18:45:52.000000000 +0100
+++ src/dbxml/HighResTimer.cpp	2007-10-29 18:15:33.000000000 +0100
@@ -13,8 +13,7 @@
 
 #include <iostream>
 #include <sstream>
-
-extern "C" int __os_clock(DB_ENV *, u_int32_t *, u_int32_t *);
+#include <sys/time.h>
 
 using namespace DbXml;
 
@@ -109,13 +108,21 @@
 
 void HighResTimer::start()
 {
-	(void)__os_clock(NULL, &start_secs, &start_usecs);
+	struct timeval v;
+
+	gettimeofday(&v, NULL);
+	start_secs = v.tv_sec;
+	start_usecs = v.tv_usec;
 }
 
 void HighResTimer::stop()
 {
 	u_int32_t stop_secs, stop_usecs;
-	(void)__os_clock(NULL, &stop_secs, &stop_usecs);
+	struct timeval v;
+
+	gettimeofday(&v, NULL);
+	stop_secs = v.tv_sec;
+	stop_usecs = v.tv_usec;
 	duration_secs += (stop_secs - start_secs);
 	duration_usecs += (stop_usecs - start_usecs);
 	// fixup for usec under/overflow
--- src/dbxml/QueryContext.cpp	2007-01-12 19:05:49.000000000 +0100
+++ src/dbxml/QueryContext.cpp	2007-10-29 18:19:01.000000000 +0100
@@ -45,12 +45,11 @@
 #include <xqilla/exceptions/QueryTimeoutException.hpp>
 #include <xqilla/exceptions/QueryInterruptedException.hpp>
 
+#include <sys/time.h>
+
 using namespace DbXml;
 using namespace std;
 
-// From DB, used by QueryInterrupt code
-extern "C" int __os_clock(DB_ENV *, u_int32_t *, u_int32_t *);
-
 namespace DbXml {
 /**
    QueryInterrupt is private to QueryContext, used to
@@ -425,7 +424,10 @@
 	qInt_->stop = false;
 	if(qInt_->timeoutValue) {
 		qInt_->timeCount = 0;
-		(void)__os_clock(NULL, &qInt_->timeoutStart, NULL);
+		struct timeval v;
+
+		gettimeofday(&v, NULL);
+		qInt_->timeoutStart = v.tv_sec;
 	}
 }
 
@@ -438,12 +440,13 @@
 			throw QueryInterruptedException(0, 0, 0, 0, 0);
 		}
 		if(qInt_->timeoutValue) {
-			// only call __os_clock() every 100 calls; not
-			// precise, but more efficient
 			if(++(qInt_->timeCount) == 100) {
 				qInt_->timeCount = 0;
 				u_int32_t now;
-				(void)__os_clock(NULL, &now, NULL);
+				struct timeval v;
+
+				gettimeofday(&v, NULL);
+				now = v.tv_sec;
 				if ((now - qInt_->timeoutStart) >
 					qInt_->timeoutValue) {
 					qInt_->timeoutStart = 0;

dbxml-predicates.patch:

--- NEW FILE dbxml-predicates.patch ---
--- src/dbxml/optimizer/QueryPlanGenerator.cpp	2007-04-18 10:05:24.000000000 +0100
+++ src/dbxml/optimizer/QueryPlanGenerator.cpp	2007-08-08 11:32:10.000000000 +0100
@@ -1566,11 +1572,12 @@
 
 	else if(name == Or::name) {
 		UnionQP *unionOp = new (&memMgr_) UnionQP(&memMgr_);
+		result.operation = unionOp;
 		for(VectorOfASTNodes::iterator i = args.begin(); i != args.end(); ++i) {
 			PathResult ret = generate(*i, ids);
 			unionOp->addArg(ret.operation);
+			if(ret.operation == 0) result.operation = 0;
 		}
-		result.operation = unionOp;
 	}
 
 	// These operators use the presence of the node arguments, not their value

dbxml-python-build.patch:

--- NEW FILE dbxml-python-build.patch ---
--- src/python/dbxml_python_wrap.cpp	2006-12-15 23:38:53.000000000 +0100
+++ src/python/dbxml_python_wrap.cpp	2007-11-12 21:00:35.000000000 +0100
@@ -2591,6 +2591,11 @@
 #include <errno.h>
 #include <fstream>
 
+#ifndef DB_READ_UNCOMMITTED
+#define DB_READ_UNCOMMITTED DB_DIRTY_READ
+#define DB_READ_COMMITTED DB_DEGREE_2
+#endif
+
 using namespace DbXml;
 
 class XmlIndexDeclaration {
--- src/python/setup.py.template	2006-12-15 23:39:10.000000000 +0100
+++ src/python/setup.py.template	2007-11-12 21:03:45.000000000 +0100
@@ -16,22 +16,14 @@
 # Windows: may require further editing to reflect site specifics.
 #
 if os.name == "posix":
-  db_home = "@DB_DIR@"
-  xerces_home = "@XERCES_DIR@"
   xqilla_home = "@XQILLA_DIR@"
   LFLAGS = os.environ.get('LFLAGS', [])
 else:
-  xerces_home = "../@XERCES_WINHOME@"
   xqilla_home = "../@XQILLA_HOME@"
-  db_home = "../@DB_HOME@"

 for arg in sys.argv:
-  if arg.startswith('--with-berkeleydb='):
-    db_home = arg.split('=')[1]
-  elif arg.startswith('--with-xerces='):
-    xerces_home = arg.split('=')[1]
-  elif arg.startswith('--with-xqilla='):
-    xqillahome = arg.split('=')[1]
+  if arg.startswith('--with-xqilla='):
+    xqilla_home = arg.split('=')[1]
   elif arg.startswith('--lflags='):
     LFLAGS = arg.split('=')[1].split()
     sys.argv.remove(arg)
@@ -48,16 +40,12 @@

 if os.name == "posix":
   INCLUDES =    ["../../include",
-                 os.path.join(db_home, "include")]
+                 os.path.join(xqilla_home, "include")]

-  LIBDIRS =     ["../../build_unix/.libs",
-                 os.path.join(db_home, "lib"),
-                 os.path.join(xqilla_home, "lib"),
-                 os.path.join(xerces_home, "lib")]
+  LIBDIRS =     ["../../build_unix/.libs"]

-  LIBS =        ["dbxml- at DBXML_VERSION_MAJOR@",
-                 "db_cxx- at DB_VERSION_MAJOR@",
-                 "xqilla", "xerces-c"]
+  LIBS =        ["dbxml- at DBXML_VERSION_MAJOR@. at DBXML_VERSION_MINOR@",
+                 "db_cxx", "xqilla10", "xerces-c"]

   DATAFILES =   []

@@ -80,7 +68,6 @@
               ext_modules = [Extension("_dbxml", ["dbxml_python_wrap.cpp"],
                                        include_dirs = INCLUDES,
                                        library_dirs = LIBDIRS,
-                                       runtime_library_dirs = LIBDIRS,
                                        libraries = LIBS,
                                        extra_link_args = lflags_arg
                                        )],

dbxml-python25-types.patch:

--- NEW FILE dbxml-python25-types.patch ---
--- src/python/dbxml_python_wrap.cpp	2006-12-15 23:38:53.000000000 +0100
+++ src/python/dbxml_python_wrap.cpp	2007-06-25 10:47:32.000000000 +0200
@@ -2055,7 +2055,7 @@
     void *vptr = 0;
     
     /* here we get the method pointer for callbacks */
-    char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
+    const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
     const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
     if (desc) {
       desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
@@ -2998,7 +2998,7 @@
 SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
 {
   if (PyString_Check(obj)) {
-    char *cstr; int len;
+    char *cstr; Py_ssize_t len;
     PyString_AsStringAndSize(obj, &cstr, &len);
     if (cptr)  {
       if (alloc) {
@@ -36692,11 +36692,11 @@
     swig_type_info **types_initial) {
     size_t i;
     for (i = 0; methods[i].ml_name; ++i) {
-      char *c = methods[i].ml_doc;
+      const char *c = methods[i].ml_doc;
       if (c && (c = strstr(c, "swig_ptr: "))) {
         int j;
         swig_const_info *ci = 0;
-        char *name = c + 10;
+        const char *name = c + 10;
         for (j = 0; const_table[j].type; ++j) {
           if (strncmp(const_table[j].name, name, 
               strlen(const_table[j].name)) == 0) {

dbxml-query-performance.patch:

--- NEW FILE dbxml-query-performance.patch ---
--- src/dbxml/optimizer/CostBasedOptimizer.cpp	2007-02-02 20:11:55.000000000 +0000
+++ src/dbxml/optimizer/CostBasedOptimizer.cpp	2007-03-21 20:30:20.000000000 +0000
@@ -352,7 +352,7 @@
 }
 
 DbXmlNav::Steps::reverse_iterator CostBasedOptimizer::findBestIndex(DbXmlNav::Steps::reverse_iterator start,
-	DbXmlNav::Steps::reverse_iterator end)
+	DbXmlNav::Steps::reverse_iterator end, bool findJoin)
 {
 	DbXmlNav::Steps::reverse_iterator found_it = end;
 	QueryPlan::Cost found_cost;
@@ -374,7 +374,7 @@
 					}
 				}
 			}
-		} else if((*i)->getType() == (ASTNode::whichType)DbXmlASTNode::JOIN) {
+		} else if(findJoin && (*i)->getType() == (ASTNode::whichType)DbXmlASTNode::JOIN) {
 			LookupIndex *index = findLookupIndex(*i);
 
 			if(index != 0 && index->isSuitableForLookupIndex()) {
@@ -448,7 +448,7 @@
 	}
 
 	DbXmlNav::Steps &args = const_cast<DbXmlNav::Steps &>(nav->getSteps());
-	DbXmlNav::Steps::reverse_iterator found_it = findBestIndex(args.rbegin(), args.rend());
+	DbXmlNav::Steps::reverse_iterator found_it = findBestIndex(args.rbegin(), args.rend(), /*findJoin*/false);
 
 	if(found_it != args.rend()) {
 		// Create a navigation for the forward steps,
@@ -568,7 +568,7 @@
 		args.push_back(const_cast<ASTNode*>(item->getArgument()));
 	}
 
-	DbXmlNav::Steps::reverse_iterator found_it = findBestIndex(args.rbegin(), args.rend());
+	DbXmlNav::Steps::reverse_iterator found_it = findBestIndex(args.rbegin(), args.rend(), /*findJoin*/true);
 
 	if(found_it == args.rend()) {
 		found_it = findLastJoin(args.rbegin(), args.rend());
--- src/dbxml/optimizer/CostBasedOptimizer.hpp	2006-10-30 17:45:59.000000000 +0000
+++ src/dbxml/optimizer/CostBasedOptimizer.hpp	2007-03-21 20:29:19.000000000 +0000
@@ -34,7 +34,7 @@
 private:
 	void compressSteps(DbXmlNav *nav);
 	DbXmlNav::Steps::reverse_iterator findBestIndex(DbXmlNav::Steps::reverse_iterator start,
-		DbXmlNav::Steps::reverse_iterator end);
+		DbXmlNav::Steps::reverse_iterator end, bool findJoin);
 
 	bool isASTNodeReversible(ASTNode *ast);
 	bool reverseASTNode(ASTNode *ast, Join::Type &axis, LookupIndex *index, DbXmlNav *&reverse);

dbxml-standalone-build.patch:

--- NEW FILE dbxml-standalone-build.patch ---
--- dist/aclocal/options.ac	2006-06-13 21:32:29.000000000 +0200
+++ dist/aclocal/options.ac	2007-11-12 20:55:02.000000000 +0100
@@ -55,23 +55,24 @@
 AC_MSG_CHECKING([if --with-berkeleydb=DIR option specified])
 AC_ARG_WITH(berkeleydb,
 	[AC_HELP_STRING([--with-berkeleydb=DIR],
-			[Path of Berkeley DB. [DIR="/usr/local/BerkeleyDB. at DB_VERSION_MAJOR@. at DB_VERSION_MINOR@"]])],
+			[Path of Berkeley DB. [DIR="/usr"]])],
 	[with_berkeleydb="$withval"], [with_berkeleydb="no"])
 AC_MSG_RESULT($with_berkeleydb)
 # If --with-berkeleydb isn't specified, assume it's here | wc -l` -gt 0
 if test "$with_berkeleydb" = "no"; then
-	with_berkeleydb="/usr/local/BerkeleyDB. at DB_VERSION_MAJOR@. at DB_VERSION_MINOR@"
+	with_berkeleydb="/usr"
 fi
 with_berkeleydb=`cd $with_berkeleydb && pwd`
-if test `ls "$with_berkeleydb"/lib/libdb_cxx-*.la 2>/dev/null | wc -l` -gt 0 ; then
-	AC_MSG_CHECKING([for Berkeley DB version from install tree])
-	db_version=`ls "$with_berkeleydb"/lib/libdb_cxx-*.la | sed 's/.*db_cxx-\(.*\).la/\1/'`
+if test `ls "$libdir"/libdb_cxx-?.?.so 2>/dev/null | wc -l` -gt 0 ; then
+	AC_MSG_CHECKING([for Berkeley DB version from installed library])
+	db_version=`ls "$libdir"/libdb_cxx-?.?.so | sed 's/.*db_cxx-\(.*\).so/\1/'`
 	AC_MSG_RESULT([$db_version])
-	if test "$db_version" != "4.3" && test "$db_version" != "4.4" && test "$db_version" != "4.5"; then
+	if test "$db_version" != "4.3" && test "$db_version" != "4.4" && test "$db_version" != "4.5" && test "$db_version" != "4.6"; then
 		AC_MSG_ERROR([$with_berkeleydb is version $db_version, which is not a supported version of Berkeley DB. The version must be at least 4.3])
 	fi
 	echo "$CPPFLAGS" | grep "$with_berkeleydb/include" >/dev/null 2>&1 || CPPFLAGS="$CPPFLAGS -I$with_berkeleydb/include"
-	LIBS="$LIBS $with_berkeleydb/lib/libdb_cxx-$db_version.la"
+	LIBS="$LIBS -L$libdir -ldb_cxx-$db_version"
+	LIBXSO_LIBS="$LIBXSO_LIBS -L$libdir -ldb_cxx-$db_version"
 
 	# find test lib locations, if specified, and possible
 	# it could be safer to require that --with-berkeleydb point to a build
@@ -100,7 +100,7 @@
 	    fi
 	fi
 
-	ADDITIONAL_CLASSPATH="$ADDITIONAL_CLASSPATH:$with_berkeleydb/lib/db.jar"
+	ADDITIONAL_CLASSPATH="$ADDITIONAL_CLASSPATH:/usr/share/java/db.jar"
 elif test `ls "$with_berkeleydb"/build_unix/libdb_cxx-*.la 2>/dev/null | wc -l` -gt 0 ; then
 	AC_MSG_CHECKING([for Berkeley DB version from build tree])
 	db_version=`ls "$with_berkeleydb"/build_unix/libdb_cxx-*.la | sed 's/.*db_cxx-\(.*\).la/\1/'`
@@ -146,10 +146,11 @@
 	with_xqilla="@XQILLA_HOME@"
 fi
 with_xqilla=`cd $with_xqilla && pwd`
-# Try as an install directory
-if test `ls "$with_xqilla"/lib/libxqilla*.la 2>/dev/null | wc -l` -gt 0 ; then
-	echo "$CPPFLAGS" | grep "$with_xqilla/include" >/dev/null 2>&1 || CPPFLAGS="$CPPFLAGS -I$with_xqilla/include"
-	LIBS="$LIBS -L$with_xqilla/lib -lxqilla"
+# Try from installed library
+if test `ls "$libdir"/libxqilla10.so.1.0.? 2>/dev/null | wc -l` -gt 0 ; then
+	echo "$CPPFLAGS" | grep "$with_xqilla/include" >/dev/null 2>&1 || CPPFLAGS="$CPPFLAGS -I$with_xqilla/include/xqilla10"
+	LIBS="$LIBS -L$libdir -lxqilla10"
+	LIBXSO_LIBS="$LIBXSO_LIBS -L$libdir -lxqilla10"
 # Try as a source directory, built in the top level directory
 elif test `ls "$with_xqilla"/libxqilla*.la 2>/dev/null | wc -l` -gt 0 ; then
   # If we have been given a build directory inside the XQilla top
@@ -177,12 +177,13 @@
 fi
 
 # specifically test for 2.6 or 2.7.  This needs to change as releases change
-if test `ls $with_xerces/lib/libxerces-c.*2[[6-7]].* 2>/dev/null | wc -l` -gt 0 ; then
-	AC_MSG_CHECKING([for Xerces C++ version from install tree])
-	xerces_version=`ls "$with_xerces"/lib/libxerces-c.*[[0-9]][[0-9]].* | tail -1 | sed 's/.*xerces-c.*\([[0-9]]\)\([[0-9]]\).*/\1.\2/'`
+if test `ls $libdir/libxerces-c.*2[[6-7]].* 2>/dev/null | wc -l` -gt 0 ; then
+	AC_MSG_CHECKING([for Xerces C++ version from installed library])
+	xerces_version=`ls "$libdir"/libxerces-c.*[[0-9]][[0-9]].* | tail -1 | sed 's/.*xerces-c.*\([[0-9]]\)\([[0-9]]\).*/\1.\2/'`
 	with_xerces=`cd $with_xerces && pwd`
 	echo "$CPPFLAGS" | grep "$with_xerces/include" >/dev/null 2>&1 || CPPFLAGS="$CPPFLAGS -I$with_xerces/include"
-	LIBS="$LIBS -L$with_xerces/lib -R$with_xerces/lib -lxerces-c"
+	LIBS="$LIBS -L$libdir -lxerces-c"
+	LIBXSO_LIBS="$LIBXSO_LIBS -L$libdir -lxerces-c"
 	AC_MSG_RESULT([$xerces_version])
 elif test `ls $with_xerces/lib/libxerces-c*2[[6-7]].* 2>/dev/null | wc -l` -gt 0 ; then
 	AC_MSG_CHECKING([for Xerces C++ version from install tree])
--- dist/Makefile.in	2007-01-19 16:52:44.000000000 +0100
+++ dist/Makefile.in	2007-11-12 20:54:36.000000000 +0100
@@ -327,8 +327,8 @@
 uninstall: uninstall_include uninstall_lib uninstall_utilities uninstall_docs
 
 install_setup:
-	@test -d $(prefix) || \
-	    ($(mkdir) -p $(prefix) && $(chmod) $(dmode) $(prefix))
+	@test -d $(DESTDIR)$(prefix) || \
+	    ($(mkdir) -p $(DESTDIR)$(prefix) && $(chmod) $(dmode) $(DESTDIR)$(prefix))
 
 INCLUDE_NAMES= DbXml.hpp DbXmlFwd.hpp XmlQueryExpression.hpp XmlContainer.hpp \
 	XmlDocument.hpp XmlException.hpp XmlIndexSpecification.hpp \
@@ -342,22 +342,22 @@
 INCLUDE_FILES= $(patsubst %,$(srcdir)/include/dbxml/,$(INCLUDE_NAMES))
 
 install_include:
-	@echo "Installing DB XML include files: $(includedir) ..."
-	@test -d $(includedir) || \
-	    ($(mkdir) -p $(includedir) && $(chmod) $(dmode) $(includedir))
-	@cd $(srcdir)/include/dbxml/ && $(cp) -pf $(INCLUDE_NAMES) $(includedir)
-	@cd $(includedir) && $(chmod) $(fmode) $(INCLUDE_NAMES)
+	@echo "Installing DB XML include files: $(DESTDIR)$(includedir) ..."
+	@test -d $(DESTDIR)$(includedir) || \
+	    ($(mkdir) -p $(DESTDIR)$(includedir) && $(chmod) $(dmode) $(DESTDIR)$(includedir))
+	@cd $(srcdir)/include/dbxml/ && $(cp) -pf $(INCLUDE_NAMES) $(DESTDIR)$(includedir)
+	@cd $(DESTDIR)$(includedir) && $(chmod) $(fmode) $(INCLUDE_NAMES)
 
 uninstall_include:
-	@cd $(includedir) && $(rm) -f $(INCLUDE_NAMES)
+	@cd $(DESTDIR)$(includedir) && $(rm) -f $(INCLUDE_NAMES)
 
 install_lib:
-	@echo "Installing DB XML library: $(libdir) ..."
-	@test -d $(libdir) || \
-	    ($(mkdir) -p $(libdir) && $(chmod) $(dmode) $(libdir))
-	@cd $(libdir) && $(rm) -f $(LIB_INSTALL_FILE_LIST)
-	@$(INSTALLER) $(libxso_target) $(install_tcl) $(install_java) $(libdir)
-	@(cd $(libdir) && \
+	@echo "Installing DB XML library: $(DESTDIR)$(libdir) ..."
+	@test -d $(DESTDIR)$(libdir) || \
+	    ($(mkdir) -p $(DESTDIR)$(libdir) && $(chmod) $(dmode) $(DESTDIR)$(libdir))
+	@cd $(DESTDIR)$(libdir) && $(rm) -f $(LIB_INSTALL_FILE_LIST)
+	@$(INSTALLER) $(libxso_target) $(install_tcl) $(install_java) $(DESTDIR)$(libdir)
+	@(cd $(DESTDIR)$(libdir) && \
 	    test -f $(libxso) && $(ln) -s $(libxso) $(libxso_default); \
 	    test -f $(libxso) && $(ln) -s $(libxso) $(libxso_major); \
 	    test -f $(libxso_static) && $(ln) -s $(libxso_static) $(libcxx); \
@@ -368,26 +368,26 @@
 	    test -f $(libjso) && $(ln) -s $(libjso) $(libjso_g); \
 	    $(LIBJSO_LN_INSTALL)) || true
 	@(test -f $(libj_jarfile) && \
-	    $(cp) $(libj_jarfile) $(libdir) && \
-	    $(chmod) $(fmode) $(libdir)/$(libj_jarfile)) || true
+	    $(cp) $(libj_jarfile) $(DESTDIR)$(libdir) && \
+	    $(chmod) $(fmode) $(DESTDIR)$(libdir)/$(libj_jarfile)) || true
 
 uninstall_lib:
-	@cd $(libdir) && $(rm) -f $(LIB_INSTALL_FILE_LIST)
+	@cd $(DESTDIR)$(libdir) && $(rm) -f $(LIB_INSTALL_FILE_LIST)
 
 install_utilities:
-	echo "Installing DB XML utilities: $(bindir) ..."
-	@test -d $(bindir) || \
-	    ($(mkdir) -p $(bindir) && $(chmod) $(dmode) $(bindir))
+	echo "Installing DB XML utilities: $(DESTDIR)$(bindir) ..."
+	@test -d $(DESTDIR)$(bindir) || \
+	    ($(mkdir) -p $(DESTDIR)$(bindir) && $(chmod) $(dmode) $(DESTDIR)$(bindir))
 	@for i in $(UTIL_PROGS); do \
-		$(rm) -f $(bindir)/$$i $(bindir)/$$i.exe; \
+		$(rm) -f $(DESTDIR)$(bindir)/$$i $(DESTDIR)$(bindir)/$$i.exe; \
 		test -f $$i.exe && i=$$i.exe || true; \
-		$(INSTALLER) $$i $(bindir)/$$i; \
-		test -f $(strip) && $(strip) $(bindir)/$$i || true; \
-		$(chmod) $(emode) $(bindir)/$$i; \
+		$(INSTALLER) $$i $(DESTDIR)$(bindir)/$$i; \
+		test -f $(strip) && $(strip) $(DESTDIR)$(bindir)/$$i || true; \
+		$(chmod) $(emode) $(DESTDIR)$(bindir)/$$i; \
 	done
 
 uninstall_utilities:
-	@(cd $(bindir); for i in $(UTIL_PROGS); do \
+	@(cd $(DESTDIR)$(bindir); for i in $(UTIL_PROGS); do \
 		$(rm) -f $$i $$i.exe; \
 	done)
 
@@ -395,14 +395,14 @@
 	api_c api_cxx api_tcl collections gsg gsg_db_rep gsg_txn gsg_xml_txn \
 	gsg_xml images index.html license java ref ref_xml intro_xml utility
 install_docs:
-	@echo "Installing documentation: $(docdir) ..."
-	@test -d $(docdir) || \
-	    ($(mkdir) -p $(docdir) && $(chmod) $(dmode) $(docdir))
-	@cd $(docdir) && $(rm) -rf $(DOCLIST)
-	@cd $(srcdir)/docs && $(cp) -pr $(DOCLIST) $(docdir)/
+	@echo "Installing documentation: $(DESTDIR)$(docdir) ..."
+	@test -d $(DESTDIR)$(docdir) || \
+	    ($(mkdir) -p $(DESTDIR)$(docdir) && $(chmod) $(dmode) $(DESTDIR)$(docdir))
+	@cd $(DESTDIR)$(docdir) && $(rm) -rf $(DOCLIST)
+	@cd $(srcdir)/docs && $(cp) -pr $(DOCLIST) $(DESTDIR)$(docdir)/
 
 uninstall_docs:
-	@cd $(docdir) && $(rm) -rf $(DOCLIST)
+	@cd $(DESTDIR)$(docdir) && $(rm) -rf $(DOCLIST)
 
 ##################################################
 # Remaining standard Makefile targets.

dbxml-statistics.patch:

--- NEW FILE dbxml-statistics.patch ---
--- src/dbxml/Statistics.cpp	2006-10-30 17:45:53.000000000 +0000
+++ src/dbxml/Statistics.cpp	2007-10-26 12:16:19.000000000 +0100
@@ -220,7 +220,6 @@
 		context.key().set_size(structureLength); // trim the value off
 	}
 
-	StatsMapKey tmpKey(key.container);
 	KeyStatistics tmpStats;
 	KeyStatistics result;
 
@@ -242,9 +241,6 @@
 			else {
 				++found;
 
-				// Cache the intermediate value (it might be useful)
-				tmpKey.key.unmarshalStructure(context.key());
-				tmpKey.key.getIndex().set(key.key.getSyntaxType(), Index::SYNTAX_MASK);
 				tmpStats.setThisFromDbt(context.data());
 
 				// Fix the unique keys value, if necessary
@@ -253,9 +249,6 @@
 					tmpStats.numUniqueKeys_ = 1;
 				}
 
-				// Store the intermediate value
-				putKeyStatistics(tmpKey, tmpStats);
-
 				// add the value it to the results
 				result.add(tmpStats);
 

dbxml-xmlindexlookup.patch:

--- NEW FILE dbxml-xmlindexlookup.patch ---
--- src/dbxml/Cursor.cpp	2006-10-30 12:45:52.000000000 -0500
+++ src/dbxml/Cursor.cpp	2007-03-19 13:58:27.000000000 -0400
@@ -21,6 +21,16 @@
 
 #define MINIMUM_BULK_GET_BUFFER 256 * 1024
 
+// determine if two keys refer to the same index, based
+// on initial structure bytes.
+static bool isSameIndex(const Dbt &k1, const Dbt &k2)
+{
+	const xmlbyte_t *p1 = (const xmlbyte_t*)k1.get_data();
+	const xmlbyte_t *p2 = (const xmlbyte_t*)k2.get_data();
+	return (Key::compareStructure(p1, p1 + k1.get_size(),
+				      p2, p2 + k2.get_size()) == 0);
+}
+
 // Cursor
 Cursor::Cursor(DbWrapper &db, Transaction *txn,
 	       CursorType type, u_int32_t flags)
@@ -252,10 +262,16 @@
 		// no throw for NOTFOUND and KEYEMPTY
 		err = cursor_.get(&key_, &data_, DB_SET);
 		if(err == 0) {
+			// save key structure for comparison below
+			DbtOut tmp(key_.get_data(), key_.get_size());
 			// Do the DB_NEXT_NODUP without the DB_MULTIPLE_KEY,
 			// otherwise the multiple get will get all of it's keys
 			// with the NODUP flag...
 			err = cursor_.get(&key_, &data_, DB_NEXT_NODUP);
+			if ((err == 0) && !isSameIndex(key_, tmp)) {
+				done_ = true;
+				return 0;
+			}
 			flags = DB_CURRENT;
 		} else if(err == DB_NOTFOUND) {
 			err = 0;
@@ -322,9 +338,7 @@
 	case DbWrapper::GTX:
 	case DbWrapper::GTE: {
 		// Check the Prefix and VIDs are the same.
-		const xmlbyte_t *p1 = (const xmlbyte_t*)key_.get_data();
-		const xmlbyte_t *p2 = (const xmlbyte_t*)tmpKey_.get_data();
-		if(Key::compareStructure(p1, p1 + key_.get_size(), p2, p2 + tmpKey_.get_size()) != 0) {
+		if (!isSameIndex(key_, tmpKey_)) {
 			done_ = true;
 			ie.reset();
 			return 0;
@@ -621,9 +635,7 @@
 	case DbWrapper::LTX:
 	case DbWrapper::LTE: {
 		// Check the Prefix and VIDs are the same.
-		const xmlbyte_t *p1 = (const xmlbyte_t*)key_.get_data();
-		const xmlbyte_t *p2 = (const xmlbyte_t*)tmpKey_.get_data();
-		if(Key::compareStructure(p1, p1 + key_.get_size(), p2, p2 + tmpKey_.get_size()) != 0) {
+		if (!isSameIndex(key_, tmpKey_)) {
 			done_ = true;
 			ie.reset();
 			return 0;

dbxml-xmlmodify.patch:

--- NEW FILE dbxml-xmlmodify.patch ---
*** src/dbxml/nodeStore/NsDom.cpp	Tue Jan  9 15:29:19 2007
--- src/dbxml/nodeStore/NsDom.cpp	Mon Oct 22 13:44:51 2007
***************
*** 529,545 ****
  	if (prev)
  		prev->nsMakeTransient();
  
- 	// Move text, if present.  Just copy; explicit
- 	// remove isn't required, as the node's going away
- 	NsNode *node = child->getNsNode();
- 	if (node->hasLeadingText()) {
- 		if (next) {
- 			_coalesceTextNodes(child, next, false);
- 		} else {
- 			_coalesceTextNodes(child, this, true);
- 		}
- 	}
- 
  	if (next) {
  		next->setElemPrev(prev);
  		if (prev)
--- 529,534 ----
***************
*** 580,585 ****
--- 569,585 ----
  		getNsDocument()->addToModifications(
  			NodeModification::UPDATE, this);
  
+ 	// Move text, if present.  Just copy; explicit
+ 	// remove isn't required, as the node's going away
+ 	NsNode *node = child->getNsNode();
+ 	if (node->hasLeadingText()) {
+ 		if (next) {
+ 			_coalesceTextNodes(child, next, false);
+ 		} else {
+ 			_coalesceTextNodes(child, this, true);
+ 		}
+ 	}
+ 
  	// Remove the child from the tree
  	child->_makeStandalone();
  	child->_parent = 0;
***************
*** 638,644 ****
  	int32_t index = -1; // -1 means append as last on list
  	bool isChild = false;
  	NsDomNav *prev = 0;
! 	
  	// if no next, operation is appending child text
  	if (!nextChild) {
  		modified = this;
--- 638,644 ----
  	int32_t index = -1; // -1 means append as last on list
  	bool isChild = false;
  	NsDomNav *prev = 0;
! 	NsDomNav *ttext = 0;
  	// if no next, operation is appending child text
  	if (!nextChild) {
  		modified = this;
***************
*** 662,667 ****
--- 662,678 ----
  				     nsNodeElement);
  			modified = (NsDomElement*)nextChild;
  			index = modified->getNsNode()->getNumLeadingText();
+ 			NsNode *tnode = modified->getNsNode();
+ 			if (tnode->hasTextChild()) {
+ 				// existing text on target will move "right."
+ 				// get first text child for renumbering, later
+ 				NsDomNav *last = modified->getNsLastChild(true);
+ 				while (last && last->getNsNodeType() ==
+ 				       nsNodeText) {
+ 					ttext = (NsDomText*)last;
+ 					last = last->getNsPrevSibling();
+ 				}
+ 			}
  		}
  	}
  
***************
*** 702,707 ****
--- 713,730 ----
  		((NsDomText*)next)->setIndex(newindex + 1);
  		next = next->getNsNextSibling();
  	}
+ 
+ 	// If modified == nextChild, we added leading text to
+ 	// an element; if it had child text, child text indexes
+ 	// must be renumbered
+ 	if (ttext) { // ttext set above
+ 		while (ttext &&
+ 		       (ttext->getNsNodeType() == nsNodeText)) {
+ 			int32_t newindex = ((NsDomText*)ttext)->getIndex();
+ 			((NsDomText*)ttext)->setIndex(newindex + 1);
+ 			ttext = ttext->getNsNextSibling();
+ 		}
+ 	}
  	
  	getNsDocument()->addToModifications(NodeModification::UPDATE, modified);
  	return child;
***************
*** 976,982 ****
  {
  	NsNode *tnode = target->getNsNode();
  	MemoryManager *mmgr = getMemoryManager();
! 
  	// Cannot count on sibling links to the source.
  	// They have been eliminated in the caller.
  	// Instead use a counter.  Previous sibling link
--- 999,1014 ----
  {
  	NsNode *tnode = target->getNsNode();
  	MemoryManager *mmgr = getMemoryManager();
! 	NsDomNav *ttext = 0;
! 	if (tnode->hasTextChild()) {
! 		// existing child text on target will move "right."
! 		// get first text child for renumbering, later
! 		NsDomNav *last = target->getNsLastChild(true);
! 		while (last && last->getNsNodeType() == nsNodeText) {
! 			ttext = (NsDomText*)last;
! 			last = last->getNsPrevSibling();
! 		}
! 	}
  	// Cannot count on sibling links to the source.
  	// They have been eliminated in the caller.
  	// Instead use a counter.  Previous sibling link
***************
*** 994,1001 ****
  	int32_t index = 0;
  	if (toChild) {
  		index = tnode->getFirstTextChildIndex();
! 		DBXML_ASSERT(index >= 0);
  	}
  	for (int i = 0; i < num; i++) {
  		DBXML_ASSERT(first->getNsNodeType() == nsNodeText);
  		if (nsTextType(first->getNsTextType()) == NS_PINST) {
--- 1026,1034 ----
  	int32_t index = 0;
  	if (toChild) {
  		index = tnode->getFirstTextChildIndex();
! 		if (index == -1) index = 0;
  	}
+ 
  	for (int i = 0; i < num; i++) {
  		DBXML_ASSERT(first->getNsNodeType() == nsNodeText);
  		if (nsTextType(first->getNsTextType()) == NS_PINST) {
***************
*** 1016,1028 ****
  	}
  	// caller has already rearranged sibling links correctly
  	// need to renumber indexes on any remaining text siblings
- 	// "first" is pointing to it, or it's pointing to the source node
  	tmp = first;
  	while (tmp && (tmp->getNsNodeType() == nsNodeText)) {
  		int32_t newindex = ((NsDomText*)tmp)->getIndex();
  		((NsDomText*)tmp)->setIndex(newindex + num);
  		tmp = tmp->getNsNextSibling();
  	}
  }
  
  //
--- 1049,1067 ----
  	}
  	// caller has already rearranged sibling links correctly
  	// need to renumber indexes on any remaining text siblings
  	tmp = first;
  	while (tmp && (tmp->getNsNodeType() == nsNodeText)) {
  		int32_t newindex = ((NsDomText*)tmp)->getIndex();
  		((NsDomText*)tmp)->setIndex(newindex + num);
  		tmp = tmp->getNsNextSibling();
  	}
+ 
+ 	// renumber child text nodes on target
+ 	while (ttext && (ttext->getNsNodeType() == nsNodeText)) {
+ 		int32_t newindex = ((NsDomText*)ttext)->getIndex();
+ 		((NsDomText*)ttext)->setIndex(newindex + num);
+ 		ttext = ttext->getNsNextSibling();
+ 	}
  }
  
  //
***************
*** 1527,1534 ****
  		previous = newtext;
  		if (returnLast)
  			retval = newtext; // return last
! 		else if (i == startIndex)
  			retval = newtext;
  	}
  	return retval;
  }
--- 1566,1580 ----
  		previous = newtext;
  		if (returnLast)
  			retval = newtext; // return last
! 		else if (i == startIndex) {
  			retval = newtext;
+ 			// first text child is first child only if
+ 			// no child elements
+ 			if (!_node->hasChildElem())
+ 				_firstChild = newtext;
+ 		}
+ 		// child text is *always* last child
+ 		_lastChild = newtext;
  	}
  	return retval;
  }
*** src/dbxml/nodeStore/NsNode.cpp	Tue Jan 30 10:19:07 2007
--- src/dbxml/nodeStore/NsNode.cpp	Mon Oct 22 12:18:49 2007
***************
*** 934,941 ****
  NsNode::clearPrev(XER_NS MemoryManager *mmgr)
  {
  	nd_header.nh_flags &= ~NS_HASPREV;
! 	if (!noNav()) {
! 		DBXML_ASSERT(nd_nav);
  		nd_nav->nn_prev.freeNid(mmgr);
  		memset(&nd_nav->nn_prev, 0, sizeof(NsNid));
  	}
--- 934,941 ----
  NsNode::clearPrev(XER_NS MemoryManager *mmgr)
  {
  	nd_header.nh_flags &= ~NS_HASPREV;
! 	if (!noNav() && nd_nav) {
! 		//DBXML_ASSERT(nd_nav);
  		nd_nav->nn_prev.freeNid(mmgr);
  		memset(&nd_nav->nn_prev, 0, sizeof(NsNid));
  	}


--- NEW FILE dbxml.spec ---
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%{!?python_version: %define python_version %(%{__python} -c "from distutils.sysconfig import get_python_version; print get_python_version()")}

Name: dbxml
Summary: An embeddable XML database with XQuery-based access to documents
Group: System Environment/Libraries
Version: 2.3.10
Release: 9%{?dist}
License: BSD
URL: http://www.oracle.com/technology/software/products/berkeley-db/xml/index.html
# Source tarball from Oracle containing sources of db4, xercesc, xqilla
# and dbxml library itself
# Source0: http://download.oracle.com/berkeley-db/dbxml-2.3.10.tar.gz
#
# New tarball with db4, xercesc, xqilla and perl sources removed
Source0: dbxml-2.3.10-fedora.tar.gz
Patch0: dbxml-standalone-build.patch
Patch1: dbxml-python-build.patch
Patch2: dbxml-python25-types.patch
Patch3: dbxml-os-clock.patch
Patch4: dbxml-xmlindexlookup.patch
Patch5: dbxml-query-performance.patch
Patch6: dbxml-index-utilisation.patch
Patch7: dbxml-predicates.patch
Patch8: dbxml-xmlmodify.patch
Patch9: dbxml-statistics.patch
Patch10: dbxml-invalid-schema.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-build

BuildRequires: automake autoconf libtool
BuildRequires: python-devel
BuildRequires: db4-devel >= 4.3.28
BuildRequires: xerces-c-devel >= 2.7.0
BuildRequires: xqilla10-devel >= 1.0.2

Requires: db4 >= 4.3.28 xerces-c >= 2.7.0 xqilla10 >= 1.0.2

%define install_prefix %{buildroot}%{_usr}
%define install_libdir %{buildroot}%{_libdir}
%define install_docdir %{buildroot}%{_defaultdocdir}

%description
Oracle Berkeley DB XML is an open source, embeddable XML database with
XQuery-based access to documents stored in containers and indexed based
on their content. Oracle Berkeley DB XML is built on top of Oracle Berkeley DB
and inherits its rich features and attributes. Like Oracle Berkeley DB, it runs
in process with the application with no need for human administration.
Oracle Berkeley DB XML adds a document parser, XML indexer and XQuery engine
on top of Oracle Berkeley DB to enable the fastest, most efficient
retrieval of data.

%package utils
Summary: Command line tools for managing Oracle DB XML database
Group: Applications/Databases
Version: %{version}
Release: %{release}
License: BSD
URL: http://www.oracle.com/technology/software/products/berkeley-db/xml/index.html
Requires: %{name} = %{version}-%{release} db4 >= 4.3.28

%description utils
Oracle Berkeley DB XML is an open source, embeddable XML database with
XQuery-based access to documents stored in containers and indexed based
on their content. Oracle Berkeley DB XML is built on top of Oracle Berkeley DB
and inherits its rich features and attributes. Like Oracle Berkeley DB, it runs
in process with the application with no need for human administration.
Oracle Berkeley DB XML adds a document parser, XML indexer and XQuery engine
on top of Oracle Berkeley DB to enable the fastest, most efficient
retrieval of data.

%package devel
Summary: Files needed to develop application using Oracle DB XML
Group: Development/Libraries
Version: %{version}
Release: %{release}
License: BSD
URL: http://www.oracle.com/technology/software/products/berkeley-db/xml/index.html
Requires: %{name} = %{version}-%{release} db4-devel >= 4.3.28

%description devel
Oracle Berkeley DB XML is an open source, embeddable XML database with
XQuery-based access to documents stored in containers and indexed based
on their content. Oracle Berkeley DB XML is built on top of Oracle Berkeley DB
and inherits its rich features and attributes. Like Oracle Berkeley DB, it runs
in process with the application with no need for human administration.
Oracle Berkeley DB XML adds a document parser, XML indexer and XQuery engine
on top of Oracle Berkeley DB to enable the fastest, most efficient
retrieval of data.

%package doc
Summary: Documentation for Oracle DB XML
Group: Development/Libraries
Version: %{version}
Release: %{release}
License: BSD
URL: http://www.oracle.com/technology/software/products/berkeley-db/xml/index.html

%description doc
Oracle Berkeley DB XML is an open source, embeddable XML database with
XQuery-based access to documents stored in containers and indexed based
on their content. Oracle Berkeley DB XML is built on top of Oracle Berkeley DB
and inherits its rich features and attributes. Like Oracle Berkeley DB, it runs
in process with the application with no need for human administration.
Oracle Berkeley DB XML adds a document parser, XML indexer and XQuery engine
on top of Oracle Berkeley DB to enable the fastest, most efficient
retrieval of data.

%package python
Summary: Python bindings for Oracle DB XML
Group: Development/Languages
Version: %{version}
Release: %{release}
License: BSD
URL: http://www.oracle.com/technology/software/products/berkeley-db/xml/index.html
Requires: %{name} = %{version}-%{release}

%description python
Oracle Berkeley DB XML is an open source, embeddable XML database with
XQuery-based access to documents stored in containers and indexed based
on their content. Oracle Berkeley DB XML is built on top of Oracle Berkeley DB
and inherits its rich features and attributes. Like Oracle Berkeley DB, it runs
in process with the application with no need for human administration.
Oracle Berkeley DB XML adds a document parser, XML indexer and XQuery engine
on top of Oracle Berkeley DB to enable the fastest, most efficient
retrieval of data.

%prep
libdb4_version() {
`ls "%{_libdir}"/libdb_cxx-?.?.so | sed 's/.*db_cxx-\(.*\).so/\1/'`
}
%setup -q -n dbxml-2.3.10
%patch0
%patch1
%if "%{python_version}" > "2.4"
%patch2
%endif 
%if "libdb4_version" > "4.5"
%patch3
%endif
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9
%patch10

%build
export CPPFLAGS="-I%{_includedir}/xqilla10"
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
export CXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"

pushd src/python
sed -i "s!\"../../build_unix/.libs\"!\"../../build_unix/.libs\",\"%{_libdir}\"!" setup.py.template
sed -i "s!\"../../include\"!\"../../include\",\"%{_includedir}\"!" setup.py.template
popd
pushd dist
chmod a+x s_paths
sh s_readme
sh s_config
sh s_include
sh s_perm
sh s_python
popd
pushd build_unix
../dist/configure \
	--program-prefix= \
	--prefix=%{_prefix} \
	--exec-prefix=%{_exec_prefix} \
	--bindir=%{_bindir} \
	--sbindir=%{_sbindir} \
	--sysconfdir=%{_sysconfdir} \
	--datadir=%{_datadir} \
	--includedir=%{_includedir} \
	--libdir=%{_libdir} \
	--libexecdir=%{_libexecdir} \
	--localstatedir=%{_localstatedir} \
	--sharedstatedir=%{_sharedstatedir} \
	--mandir=%{_mandir} \
	--infodir=%{_infodir} \
	--with-berkeleydb=%{_prefix} \
	--with-xerces=%{_prefix} \
	--with-xqilla=%{_prefix} \
	--disable-java \
	--disable-tcl \
	--disable-test \
	--enable-shared \
	--disable-static
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
make # parallel make is not supported
popd

# dbxml-python
pushd src/python
%{__python} setup.py build
popd

%install
rm -rf %{buildroot}
export CPPROG="cp -p"

# dbxml
fix_encoding() {
for file in "$@"; do
	if grep -q 'encoding="' $file; then
		enc=$(grep 'encoding="' $file | sed 's/.\+encoding="\(.\+\)"\ .\+/\1/')
		if  [ "$enc" != "UTF-8" ]; then
			iconv -f $enc -t "UTF-8" $file > tmp
			sed -i s/"$enc"/"UTF-8"/ tmp
			mv tmp $file
		fi
	fi
done
}
pushd build_unix
make install DESTDIR=%{buildroot}
mkdir -p %{install_docdir}/dbxml-%{version}
mkdir -p %{install_docdir}/dbxml-devel-%{version}
mkdir -p %{install_docdir}/dbxml-doc-%{version}
popd
cp -p LICENSE README %{install_docdir}/dbxml-%{version}/
mv %{install_prefix}/docs/* %{install_docdir}/dbxml-doc-%{version}/
rmdir %{install_prefix}/docs
mkdir -p %{install_docdir}/dbxml-devel-%{version}/examples
cp -pr examples/cxx examples/xmlData \
	%{install_docdir}/dbxml-devel-%{version}/examples
find %{install_docdir}/dbxml-devel-%{version} -name "*.cmd" -exec chmod 0644 {} ';'
find %{install_docdir}/dbxml-devel-%{version} -name "*.sh" -exec chmod 0644 {} ';'
fix_encoding `find %{install_docdir}/dbxml-doc-%{version} -name "*.html"`

# dbxml-python
pushd src/python
%{__python} setup.py install --skip-build --root %{buildroot}
mkdir -p %{install_docdir}/dbxml-python-%{version}/
cp -p README.exceptions %{install_docdir}/dbxml-python-%{version}/
popd
cp -p examples/python/examples.py %{install_docdir}/dbxml-python-%{version}/

find %{buildroot} -name "*.la" -exec rm -f {} ';'
find %{buildroot} -name "*%{name}-*.egg-info*" -exec rm -f {} ';'


%clean
rm -rf %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files 
%defattr(-,root,root,-)
%attr(0755,root,root) %{_libdir}/libdbxml-?.?.so
%{_defaultdocdir}/dbxml-%{version}

%files utils
%defattr(-,root,root,-)
%attr(0755,root,root) %{_bindir}/dbxml*
%attr(0755,root,root) %{_bindir}/query_runner

%files devel
%defattr(-,root,root,-)
%attr(0755,root,root) %{_libdir}/libdbxml-?.so
%attr(0755,root,root) %{_libdir}/libdbxml.so
%{_includedir}/dbxml/
%{_defaultdocdir}/dbxml-devel-%{version}

%files doc
%defattr(-,root,root,-)
%{_defaultdocdir}/dbxml-doc-%{version}

%files python
%defattr(-,root,root,-)
%{python_sitearch}/dbxml.py*
%attr(0755,root,root) %{python_sitearch}/_dbxml.so
%{_defaultdocdir}/dbxml-python-%{version}

%changelog
* Thu Jan 03 2008 Milan Zazrivec <mzazrivec at redhat.com> 2.3.10-9
- Removed dbxml-perl and made it a standalone package

* Tue Dec 18 2007 Milan Zazrivec <mzazrivec at redhat.com> - 2.3.10-9
- db4, xercesc and xqilla sources removed from source tarball
- dbxml depends on xqilla10

* Sun Oct 28 2007 Milan Zazrivec <mzazrivec at redhat.com> - 2.3.10-9
- Compile against Berkeley DB 4.6
- Merged upstream patches from Oracle

* Thu Jul 19 2007 Milan Zazrivec <mzazrivec at redhat.com> - 2.3.10-5
- Initial packaging


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/dbxml/F-7/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	6 Jan 2008 17:32:49 -0000	1.1
+++ .cvsignore	6 Jan 2008 18:08:46 -0000	1.2
@@ -0,0 +1 @@
+dbxml-2.3.10-fedora.tar.gz


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/dbxml/F-7/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	6 Jan 2008 17:32:49 -0000	1.1
+++ sources	6 Jan 2008 18:08:46 -0000	1.2
@@ -0,0 +1 @@
+e88a39cc543d291b54b31cefa74b3967  dbxml-2.3.10-fedora.tar.gz




More information about the fedora-extras-commits mailing list