Accepting request 182602 from home:jengelh:db6

- Add python-bsddb6.diff to support building against libdb-6.0

OBS-URL: https://build.opensuse.org/request/show/182602
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python?expand=0&rev=147
This commit is contained in:
Sascha Peilicke 2013-07-15 08:03:24 +00:00 committed by Git OBS Bridge
parent 472801f247
commit 5b1624f712
6 changed files with 426 additions and 5 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Jul 9 07:55:50 UTC 2013 - jengelh@inai.de
- Add python-bsddb6.diff to support building against libdb-6.0
------------------------------------------------------------------- -------------------------------------------------------------------
Sat Jul 6 17:17:11 UTC 2013 - coolo@suse.com Sat Jul 6 17:17:11 UTC 2013 - coolo@suse.com

View File

@ -49,6 +49,7 @@ Patch20: python-bundle-lang.patch
# PATCH-FIX-OPENSUSE Properly support aarch64 in _ctypes module # PATCH-FIX-OPENSUSE Properly support aarch64 in _ctypes module
Patch22: python-2.7.4-aarch64.patch Patch22: python-2.7.4-aarch64.patch
Patch23: python-2.7.4-no-REUSEPORT.patch Patch23: python-2.7.4-no-REUSEPORT.patch
Patch24: python-bsddb6.diff
# COMMON-PATCH-END # COMMON-PATCH-END
%define python_version %(echo %{tarversion} | head -c 3) %define python_version %(echo %{tarversion} | head -c 3)
BuildRequires: automake BuildRequires: automake
@ -130,7 +131,7 @@ other applications.
%patch8 -p1 %patch8 -p1
%patch10 -p1 %patch10 -p1
%patch13 -p1 %patch13 -p1
#skip test_io test for ppc,ppc64 as it broken. #skip test_io test for ppc,ppc64 as it is broken.
%ifarch ppc ppc64 %ifarch ppc ppc64
%patch15 -p1 %patch15 -p1
%endif %endif
@ -139,6 +140,7 @@ other applications.
%patch20 -p1 %patch20 -p1
%patch22 -p1 %patch22 -p1
%patch23 -p1 %patch23 -p1
%patch -P 24 -p1
# drop Autoconf version requirement # drop Autoconf version requirement
sed -i 's/^version_required/dnl version_required/' configure.ac sed -i 's/^version_required/dnl version_required/' configure.ac

407
python-bsddb6.diff Normal file
View File

@ -0,0 +1,407 @@
From: Jan Engelhardt <jengelh@inai.de>
Date: 2013-07-06 16:07:31.146616589 +0200
This patch was partially autogenerated:
- copying python-bsddb3-6.0.0 sources into the python-2.7.5 tree
- creating a diff -w against the unmodified python-2.7.5
- stripped all hunks that pertained to module renaming
- manually added db6 searching to setup.py
---
Lib/bsddb/test/test_all.py | 15 +++--
Lib/bsddb/test/test_misc.py | 5 +
Lib/bsddb/test/test_replication.py | 25 +-------
Modules/_bsddb.c | 108 +++++++++++++++++++++++++++++++++----
Modules/bsddb.h | 2
setup.py | 6 +-
6 files changed, 120 insertions(+), 41 deletions(-)
Index: Python-2.7.5/Lib/bsddb/test/test_all.py
===================================================================
--- Python-2.7.5.orig/Lib/bsddb/test/test_all.py
+++ Python-2.7.5/Lib/bsddb/test/test_all.py
@@ -74,8 +74,9 @@ if sys.version_info[0] >= 3 :
key = key.decode(charset)
return (key, value.decode(charset))
- def __next__(self) :
- v = getattr(self._dbcursor, "next")()
+ def __next__(self, flags=0, dlen=-1, doff=-1) :
+ v = getattr(self._dbcursor, "next")(flags=flags, dlen=dlen,
+ doff=doff)
return self._fix(v)
next = __next__
@@ -128,8 +129,8 @@ if sys.version_info[0] >= 3 :
v = self._dbcursor.current(flags=flags, dlen=dlen, doff=doff)
return self._fix(v)
- def first(self) :
- v = self._dbcursor.first()
+ def first(self, flags=0, dlen=-1, doff=-1) :
+ v = self._dbcursor.first(flags=flags, dlen=dlen, doff=doff)
return self._fix(v)
def pget(self, key=None, data=None, flags=0) :
@@ -492,7 +493,11 @@ def print_versions():
print 'py module: %s' % getattr(bsddb, "__file"+suffix)
print 'extension module: %s' % getattr(bsddb, "__file"+suffix)
- print 'python version: %s' % sys.version
+ print 'Test working dir: %s' % get_test_path_prefix()
+ import platform
+ print 'python version: %s %s' % \
+ (sys.version.replace("\r", "").replace("\n", ""), \
+ platform.architecture()[0])
print 'My pid: %s' % os.getpid()
print '-=' * 38
Index: Python-2.7.5/Lib/bsddb/test/test_misc.py
===================================================================
--- Python-2.7.5.orig/Lib/bsddb/test/test_misc.py
+++ Python-2.7.5/Lib/bsddb/test/test_misc.py
@@ -46,8 +46,9 @@ class MiscTestCase(unittest.TestCase):
d[repr(i)] = repr(100*i)
db.close()
db = hashopen(self.filename)
- rp = repr(db)
- self.assertEqual(rp, repr(d))
+ rp = repr(sorted(db.items()))
+ rd = repr(sorted(d.items()))
+ self.assertEqual(rp, rd)
db.close()
# http://sourceforge.net/tracker/index.php?func=detail&aid=1708868&group_id=13900&atid=313900
Index: Python-2.7.5/Lib/bsddb/test/test_replication.py
===================================================================
--- Python-2.7.5.orig/Lib/bsddb/test/test_replication.py
+++ Python-2.7.5/Lib/bsddb/test/test_replication.py
@@ -165,21 +165,10 @@ class DBReplicationManager(DBReplication
# is not generated if the master has no new transactions.
# This is solved in BDB 4.6 (#15542).
import time
- timeout = time.time()+60
+ timeout = time.time()+10
while (time.time()<timeout) and not (self.confirmed_master and self.client_startupdone) :
time.sleep(0.02)
- # self.client_startupdone does not always get set to True within
- # the timeout. On windows this may be a deep issue, on other
- # platforms it is likely just a timing issue, especially on slow
- # virthost buildbots (see issue 3892 for more). Even though
- # the timeout triggers, the rest of this test method usually passes
- # (but not all of it always, see below). So we just note the
- # timeout on stderr and keep soldering on.
- if time.time()>timeout:
- import sys
- print >> sys.stderr, ("XXX: timeout happened before"
- "startup was confirmed - see issue 3892")
- startup_timeout = True
+ self.assertTrue(time.time()<timeout)
d = self.dbenvMaster.repmgr_site_list()
self.assertEqual(len(d), 1)
@@ -239,14 +228,6 @@ class DBReplicationManager(DBReplication
txn.commit()
if v is None :
time.sleep(0.02)
- # If startup did not happen before the timeout above, then this test
- # sometimes fails. This happens randomly, which causes buildbot
- # instability, but all the other bsddb tests pass. Since bsddb3 in the
- # stdlib is currently not getting active maintenance, and is gone in
- # py3k, we just skip the end of the test in that case.
- if time.time()>=timeout and startup_timeout:
- self.skipTest("replication test skipped due to random failure, "
- "see issue 3892")
self.assertTrue(time.time()<timeout)
self.assertEqual("123", v)
@@ -377,7 +358,7 @@ class DBBaseReplication(DBReplication) :
# is not generated if the master has no new transactions.
# This is solved in BDB 4.6 (#15542).
import time
- timeout = time.time()+60
+ timeout = time.time()+10
while (time.time()<timeout) and not (self.confirmed_master and
self.client_startupdone) :
time.sleep(0.02)
Index: Python-2.7.5/Modules/_bsddb.c
===================================================================
--- Python-2.7.5.orig/Modules/_bsddb.c
+++ Python-2.7.5/Modules/_bsddb.c
@@ -124,10 +124,14 @@ typedef int Py_ssize_t;
#define NUMBER_Check PyLong_Check
#define NUMBER_AsLong PyLong_AsLong
#define NUMBER_FromLong PyLong_FromLong
+#define NUMBER_FromUnsignedLong PyLong_FromUnsignedLong
#else
#define NUMBER_Check PyInt_Check
#define NUMBER_AsLong PyInt_AsLong
#define NUMBER_FromLong PyInt_FromLong
+#if (PY_VERSION_HEX >= 0x02050000)
+#define NUMBER_FromUnsignedLong PyInt_FromSize_t
+#endif
#endif
#ifdef WITH_THREAD
@@ -853,6 +857,18 @@ static void _addIntToDict(PyObject* dict
Py_XDECREF(v);
}
+#if (DBVER >= 60) && (PY_VERSION_HEX >= 0x02050000)
+/* add an unsigned integer to a dictionary using the given name as a key */
+static void _addUnsignedIntToDict(PyObject* dict, char *name, unsigned int value)
+{
+ PyObject* v = NUMBER_FromUnsignedLong((unsigned long) value);
+ if (!v || PyDict_SetItemString(dict, name, v))
+ PyErr_Clear();
+
+ Py_XDECREF(v);
+}
+#endif
+
/* The same, when the value is a time_t */
static void _addTimeTToDict(PyObject* dict, char *name, time_t value)
{
@@ -2662,13 +2678,21 @@ _default_cmp(const DBT *leftKey,
static int
_db_compareCallback(DB* db,
const DBT *leftKey,
- const DBT *rightKey)
+ const DBT *rightKey
+#if (DBVER >= 60)
+ , size_t *locp
+#endif
+ )
{
int res = 0;
PyObject *args;
PyObject *result = NULL;
DBObject *self = (DBObject *)db->app_private;
+# if (DBVER >= 60)
+ locp = NULL; /* As required by documentation */
+#endif
+
if (self == NULL || self->btCompareCallback == NULL) {
MYDB_BEGIN_BLOCK_THREADS;
PyErr_SetString(PyExc_TypeError,
@@ -2776,13 +2800,21 @@ DB_set_bt_compare(DBObject* self, PyObje
static int
_db_dupCompareCallback(DB* db,
const DBT *leftKey,
- const DBT *rightKey)
+ const DBT *rightKey
+#if (DBVER >= 60)
+ , size_t *locp
+#endif
+ )
{
int res = 0;
PyObject *args;
PyObject *result = NULL;
DBObject *self = (DBObject *)db->app_private;
+#if (DBVER >= 60)
+ locp = NULL; /* As required by documentation */
+#endif
+
if (self == NULL || self->dupCompareCallback == NULL) {
MYDB_BEGIN_BLOCK_THREADS;
PyErr_SetString(PyExc_TypeError,
@@ -3559,13 +3591,14 @@ Py_ssize_t DB_length(PyObject* _self)
err = self->db->stat(self->db, /*txnid*/ NULL, &sp, 0);
MYDB_END_ALLOW_THREADS;
+ if (makeDBError(err)) {
+ return -1;
+ }
+
/* All the stat structures have matching fields upto the ndata field,
so we can use any of them for the type cast */
size = ((DB_BTREE_STAT*)sp)->bt_ndata;
- if (err)
- return -1;
-
free(sp);
return size;
}
@@ -8406,12 +8439,22 @@ static PyObject*
DBSequence_get(DBSequenceObject* self, PyObject* args, PyObject* kwargs)
{
int err, flags = 0;
+#if (DBVER >= 60)
+ unsigned
+#endif
int delta = 1;
db_seq_t value;
PyObject *txnobj = NULL;
DB_TXN *txn = NULL;
static char* kwnames[] = {"delta", "txn", "flags", NULL };
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iOi:get", kwnames, &delta, &txnobj, &flags))
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+#if (DBVER >=60)
+ "|IOi:get",
+#else
+ "|iOi:get",
+#endif
+ kwnames, &delta, &txnobj, &flags))
return NULL;
CHECK_SEQUENCE_NOT_CLOSED(self)
@@ -8541,8 +8584,19 @@ DBSequence_remove(DBSequenceObject* self
static PyObject*
DBSequence_set_cachesize(DBSequenceObject* self, PyObject* args)
{
- int err, size;
- if (!PyArg_ParseTuple(args,"i:set_cachesize", &size))
+ int err;
+#if (DBVER >= 60)
+ unsigned
+#endif
+ int size;
+
+ if (!PyArg_ParseTuple(args,
+#if (DBVER >= 60)
+ "I:set_cachesize",
+#else
+ "i:set_cachesize",
+#endif
+ &size))
return NULL;
CHECK_SEQUENCE_NOT_CLOSED(self)
@@ -8557,7 +8611,11 @@ DBSequence_set_cachesize(DBSequenceObjec
static PyObject*
DBSequence_get_cachesize(DBSequenceObject* self)
{
- int err, size;
+ int err;
+#if (DBVER >= 60)
+ unsigned
+#endif
+ int size;
CHECK_SEQUENCE_NOT_CLOSED(self)
@@ -8686,6 +8744,9 @@ DBSequence_stat(DBSequenceObject* self,
#define MAKE_INT_ENTRY(name) _addIntToDict(dict_stat, #name, sp->st_##name)
+#if (DBVER >= 60) && (PY_VERSION_HEX >= 0x02050000)
+#define MAKE_UNSIGNED_INT_ENTRY(name) _addUnsignedIntToDict(dict_stat, #name, sp->st_##name)
+#endif
#define MAKE_LONG_LONG_ENTRY(name) _addDb_seq_tToDict(dict_stat, #name, sp->st_##name)
MAKE_INT_ENTRY(wait);
@@ -8695,10 +8756,15 @@ DBSequence_stat(DBSequenceObject* self,
MAKE_LONG_LONG_ENTRY(last_value);
MAKE_LONG_LONG_ENTRY(min);
MAKE_LONG_LONG_ENTRY(max);
+#if (DBVER >= 60) && (PY_VERSION_HEX >= 0x02050000)
+ MAKE_UNSIGNED_INT_ENTRY(cache_size);
+#else
MAKE_INT_ENTRY(cache_size);
+#endif
MAKE_INT_ENTRY(flags);
#undef MAKE_INT_ENTRY
+#undef MAKE_UNSIGNED_INT_ENTRY
#undef MAKE_LONG_LONG_ENTRY
free(sp);
@@ -9000,7 +9066,7 @@ static PyMethodDef DBEnv_methods[] = {
{"txn_recover", (PyCFunction)DBEnv_txn_recover, METH_NOARGS},
#if (DBVER < 48)
{"set_rpc_server", (PyCFunction)DBEnv_set_rpc_server,
- METH_VARARGS|METH_KEYWORDS},
+ METH_VARARGS||METH_KEYWORDS},
#endif
{"set_mp_max_openfd", (PyCFunction)DBEnv_set_mp_max_openfd, METH_VARARGS},
{"get_mp_max_openfd", (PyCFunction)DBEnv_get_mp_max_openfd, METH_NOARGS},
@@ -9972,6 +10038,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /
ADD_INT(d, DB_LOG_ZERO);
#endif
+#if (DBVER >= 60)
+ ADD_INT(d, DB_LOG_BLOB);
+#endif
+
#if (DBVER >= 44)
ADD_INT(d, DB_DSYNC_DB);
#endif
@@ -10032,6 +10102,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /
ADD_INT(d, DB_EVENT_REG_PANIC);
#endif
+#if (DBVER >= 60)
+ ADD_INT(d, DB_EVENT_REP_AUTOTAKEOVER_FAILED);
+#endif
+
#if (DBVER >=52)
ADD_INT(d, DB_EVENT_REP_SITE_ADDED);
ADD_INT(d, DB_EVENT_REP_SITE_REMOVED);
@@ -10136,6 +10210,20 @@ PyMODINIT_FUNC PyInit__bsddb(void) /
ADD_INT(d, DB_REP_CONF_INMEM);
#endif
+#if (DBVER >= 60)
+ ADD_INT(d, DB_REPMGR_ISVIEW);
+#endif
+
+#if (DBVER >= 60)
+ ADD_INT(d, DB_DBT_BLOB);
+#endif
+
+#if (DBVER >= 60)
+ ADD_INT(d, DB_STREAM_READ);
+ ADD_INT(d, DB_STREAM_WRITE);
+ ADD_INT(d, DB_STREAM_SYNC_WRITE);
+#endif
+
ADD_INT(d, DB_TIMEOUT);
#if (DBVER >= 50)
Index: Python-2.7.5/Modules/bsddb.h
===================================================================
--- Python-2.7.5.orig/Modules/bsddb.h
+++ Python-2.7.5/Modules/bsddb.h
@@ -110,7 +110,7 @@
#error "eek! DBVER can't handle minor versions > 9"
#endif
-#define PY_BSDDB_VERSION "5.3.0"
+#define PY_BSDDB_VERSION "6.0.0"
/* Python object definitions */
Index: Python-2.7.5/setup.py
===================================================================
--- Python-2.7.5.orig/setup.py
+++ Python-2.7.5/setup.py
@@ -879,7 +879,7 @@ class PyBuildExt(build_ext):
# a release. Most open source OSes come with one or more
# versions of BerkeleyDB already installed.
- max_db_ver = (5, 3)
+ max_db_ver = (6, 0)
min_db_ver = (4, 3)
db_setup_debug = False # verbose debug prints from this script?
@@ -919,6 +919,7 @@ class PyBuildExt(build_ext):
# construct a list of paths to look for the header file in on
# top of the normal inc_dirs.
db_inc_paths = [
+ '/usr/include/db6',
'/usr/include/db4',
'/usr/local/include/db4',
'/opt/sfw/include/db4',
@@ -958,6 +959,7 @@ class PyBuildExt(build_ext):
for dn in inc_dirs:
std_variants.append(os.path.join(dn, 'db3'))
std_variants.append(os.path.join(dn, 'db4'))
+ std_variants.append(os.path.join(dn, 'db6'))
for x in gen_db_minor_ver_nums(4):
std_variants.append(os.path.join(dn, "db4%d"%x))
std_variants.append(os.path.join(dn, "db4.%d"%x))

View File

@ -15,7 +15,6 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via http://bugs.opensuse.org/
# #
Name: python-doc Name: python-doc
Version: 2.7 Version: 2.7
Release: 0 Release: 0
@ -56,6 +55,7 @@ Patch20: python-bundle-lang.patch
# PATCH-FIX-OPENSUSE Properly support aarch64 in _ctypes module # PATCH-FIX-OPENSUSE Properly support aarch64 in _ctypes module
Patch22: python-2.7.4-aarch64.patch Patch22: python-2.7.4-aarch64.patch
Patch23: python-2.7.4-no-REUSEPORT.patch Patch23: python-2.7.4-no-REUSEPORT.patch
Patch24: python-bsddb6.diff
# COMMON-PATCH-END # COMMON-PATCH-END
Provides: pyth_doc Provides: pyth_doc
Provides: pyth_ps Provides: pyth_ps
@ -93,7 +93,7 @@ Python, and Macintosh Module Reference in PDF format.
%patch8 -p1 %patch8 -p1
%patch10 -p1 %patch10 -p1
%patch13 -p1 %patch13 -p1
#skip test_io test for ppc,ppc64 as it broken. #skip test_io test for ppc,ppc64 as it is broken.
%ifarch ppc ppc64 %ifarch ppc ppc64
%patch15 -p1 %patch15 -p1
%endif %endif
@ -102,6 +102,7 @@ Python, and Macintosh Module Reference in PDF format.
%patch20 -p1 %patch20 -p1
%patch22 -p1 %patch22 -p1
%patch23 -p1 %patch23 -p1
%patch -P 24 -p1
# drop Autoconf version requirement # drop Autoconf version requirement
sed -i 's/^version_required/dnl version_required/' configure.ac sed -i 's/^version_required/dnl version_required/' configure.ac

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Jul 9 07:55:50 UTC 2013 - jengelh@inai.de
- Add python-bsddb6.diff to support building against libdb-6.0
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Jun 5 15:19:14 UTC 2013 - schwab@suse.de Wed Jun 5 15:19:14 UTC 2013 - schwab@suse.de

View File

@ -15,7 +15,6 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via http://bugs.opensuse.org/
# #
Name: python Name: python
Version: 2.7.5 Version: 2.7.5
Release: 0 Release: 0
@ -56,6 +55,7 @@ Patch20: python-bundle-lang.patch
# PATCH-FIX-OPENSUSE Properly support aarch64 in _ctypes module # PATCH-FIX-OPENSUSE Properly support aarch64 in _ctypes module
Patch22: python-2.7.4-aarch64.patch Patch22: python-2.7.4-aarch64.patch
Patch23: python-2.7.4-no-REUSEPORT.patch Patch23: python-2.7.4-no-REUSEPORT.patch
Patch24: python-bsddb6.diff
# COMMON-PATCH-END # COMMON-PATCH-END
BuildRequires: automake BuildRequires: automake
BuildRequires: db-devel BuildRequires: db-devel
@ -169,7 +169,7 @@ implementation of the standard Unix DBM databases.
%patch8 -p1 %patch8 -p1
%patch10 -p1 %patch10 -p1
%patch13 -p1 %patch13 -p1
#skip test_io test for ppc,ppc64 as it broken. #skip test_io test for ppc,ppc64 as it is broken.
%ifarch ppc ppc64 %ifarch ppc ppc64
%patch15 -p1 %patch15 -p1
%endif %endif
@ -178,6 +178,7 @@ implementation of the standard Unix DBM databases.
%patch20 -p1 %patch20 -p1
%patch22 -p1 %patch22 -p1
%patch23 -p1 %patch23 -p1
%patch -P 24 -p1
# drop Autoconf version requirement # drop Autoconf version requirement
sed -i 's/^version_required/dnl version_required/' configure.ac sed -i 's/^version_required/dnl version_required/' configure.ac