diff options
5 files changed, 1597 insertions, 27 deletions
diff --git a/meta/recipes-devtools/python/python/avoid_warning_about_bsddb.patch b/meta/recipes-devtools/python/python/avoid_warning_about_bsddb.patch deleted file mode 100644 index 4968744cb6..0000000000 --- a/meta/recipes-devtools/python/python/avoid_warning_about_bsddb.patch +++ /dev/null @@ -1,23 +0,0 @@ -_bsddb module can be built only with db version between 4.1 and 4.7. -Avoid a warning by not adding this module to missing variable. - -Upstream-Status: Inappropriate [distribution] - -Signed-off-by: Andrei Gherzan <andrei@gherzan.ro> - - -Index: Python-2.7.2/setup.py -=================================================================== ---- Python-2.7.2.orig/setup.py 2012-04-05 23:16:49.268139840 +0300 -+++ Python-2.7.2/setup.py 2012-04-05 23:17:30.912138622 +0300 -@@ -1024,7 +1024,9 @@ - db_incs = None - dblibs = [] - dblib_dir = None -- missing.append('_bsddb') -+ # We need db version between 4.1 and 4.7 -+ # Avoid this warning -+ #missing.append('_bsddb') - - # The sqlite interface - sqlite_setup_debug = False # verbose debug prints from this script? diff --git a/meta/recipes-devtools/python/python/python-2.7.3-berkeley-db-5.3.patch b/meta/recipes-devtools/python/python/python-2.7.3-berkeley-db-5.3.patch new file mode 100644 index 0000000000..469cbb3ef9 --- /dev/null +++ b/meta/recipes-devtools/python/python/python-2.7.3-berkeley-db-5.3.patch @@ -0,0 +1,1570 @@ +Fix to support db 5.3 for bsddb module in python 2.7.2 + +This patch is made from the db5.1.diff in +http://archive.ubuntu.com/ubuntu/pool/main/p/python2.7/python2.7_2.7.3-0ubuntu3.diff.gz + +Signed-off-by: Jackie Huang <jackie.huang@windriver.com> +--- + Lib/bsddb/__init__.py | 2 +- + Lib/bsddb/test/test_all.py | 5 +- + Lib/bsddb/test/test_dbenv.py | 29 +++- + Modules/_bsddb.c | 439 +++++++++++++++++++++++------------------- + Modules/bsddb.h | 20 +- + setup.py | 25 +++- + 6 files changed, 307 insertions(+), 213 deletions(-) + +diff --git a/Lib/bsddb/__init__.py b/Lib/bsddb/__init__.py +index ed4deea..1b1c388 100644 +--- a/Lib/bsddb/__init__.py ++++ b/Lib/bsddb/__init__.py +@@ -33,7 +33,7 @@ + #---------------------------------------------------------------------- + + +-"""Support for Berkeley DB 4.1 through 4.8 with a simple interface. ++"""Support for Berkeley DB 4.2 through 5.3 with a simple interface. + + For the full featured object oriented interface use the bsddb.db module + instead. It mirrors the Oracle Berkeley DB C API. +diff --git a/Lib/bsddb/test/test_all.py b/Lib/bsddb/test/test_all.py +index e9fe618..6a25f4a 100644 +--- a/Lib/bsddb/test/test_all.py ++++ b/Lib/bsddb/test/test_all.py +@@ -484,6 +484,8 @@ def print_versions(): + print '-=' * 38 + print db.DB_VERSION_STRING + print 'bsddb.db.version(): %s' % (db.version(), ) ++ if db.version() >= (5, 0) : ++ print 'bsddb.db.full_version(): %s' %repr(db.full_version()) + print 'bsddb.db.__version__: %s' % db.__version__ + print 'bsddb.db.cvsid: %s' % db.cvsid + +@@ -528,7 +530,8 @@ def get_new_database_path() : + + # This path can be overriden via "set_test_path_prefix()". + import os, os.path +-get_new_path.prefix=os.path.join(os.sep,"tmp","z-Berkeley_DB") ++get_new_path.prefix=os.path.join(os.environ.get("TMPDIR", ++ os.path.join(os.sep,"tmp")), "z-Berkeley_DB") + get_new_path.num=0 + + def get_test_path_prefix() : +diff --git a/Lib/bsddb/test/test_dbenv.py b/Lib/bsddb/test/test_dbenv.py +index 37281df..6ac1e54 100644 +--- a/Lib/bsddb/test/test_dbenv.py ++++ b/Lib/bsddb/test/test_dbenv.py +@@ -25,12 +25,31 @@ class DBEnv(unittest.TestCase): + test_support.rmtree(self.homeDir) + + class DBEnv_general(DBEnv) : ++ def test_get_open_flags(self) : ++ flags = db.DB_CREATE | db.DB_INIT_MPOOL ++ self.env.open(self.homeDir, flags) ++ self.assertEqual(flags, self.env.get_open_flags()) ++ ++ def test_get_open_flags2(self) : ++ flags = db.DB_CREATE | db.DB_INIT_MPOOL | \ ++ db.DB_INIT_LOCK | db.DB_THREAD ++ self.env.open(self.homeDir, flags) ++ self.assertEqual(flags, self.env.get_open_flags()) ++ + if db.version() >= (4, 7) : + def test_lk_partitions(self) : + for i in [10, 20, 40] : + self.env.set_lk_partitions(i) + self.assertEqual(i, self.env.get_lk_partitions()) + ++ def test_getset_intermediate_dir_mode(self) : ++ self.assertEqual(None, self.env.get_intermediate_dir_mode()) ++ for mode in ["rwx------", "rw-rw-rw-", "rw-r--r--"] : ++ self.env.set_intermediate_dir_mode(mode) ++ self.assertEqual(mode, self.env.get_intermediate_dir_mode()) ++ self.assertRaises(db.DBInvalidArgError, ++ self.env.set_intermediate_dir_mode, "abcde") ++ + if db.version() >= (4, 6) : + def test_thread(self) : + for i in [16, 100, 1000] : +@@ -115,7 +134,7 @@ class DBEnv_general(DBEnv) : + self.assertEqual(i, self.env.get_lk_max_lockers()) + + def test_lg_regionmax(self) : +- for i in [128, 256, 1024] : ++ for i in [128, 256, 1000] : + i = i*1024*1024 + self.env.set_lg_regionmax(i) + j = self.env.get_lg_regionmax() +@@ -172,8 +191,12 @@ class DBEnv_general(DBEnv) : + self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL) + cachesize = (0, 2*1024*1024, 1) + self.assertRaises(db.DBInvalidArgError, +- self.env.set_cachesize, *cachesize) +- self.assertEqual(cachesize2, self.env.get_cachesize()) ++ self.env.set_cachesize, *cachesize) ++ cachesize3 = self.env.get_cachesize() ++ self.assertEqual(cachesize2[0], cachesize3[0]) ++ self.assertEqual(cachesize2[2], cachesize3[2]) ++ # In Berkeley DB 5.3, the cachesize can change when opening the Env ++ self.assertTrue(cachesize2[1] <= cachesize3[1]) + + def test_set_cachesize_dbenv_db(self) : + # You can not configure the cachesize using +diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c +index d2d12ff..e98e4bc 100644 +--- a/Modules/_bsddb.c ++++ b/Modules/_bsddb.c +@@ -187,8 +187,10 @@ static PyObject* DBOldVersionError; /* DB_OLD_VERSION */ + static PyObject* DBRunRecoveryError; /* DB_RUNRECOVERY */ + static PyObject* DBVerifyBadError; /* DB_VERIFY_BAD */ + static PyObject* DBNoServerError; /* DB_NOSERVER */ ++#if (DBVER < 52) + static PyObject* DBNoServerHomeError; /* DB_NOSERVER_HOME */ + static PyObject* DBNoServerIDError; /* DB_NOSERVER_ID */ ++#endif + static PyObject* DBPageNotFoundError; /* DB_PAGE_NOTFOUND */ + static PyObject* DBSecondaryBadError; /* DB_SECONDARY_BAD */ + +@@ -202,9 +204,7 @@ static PyObject* DBFileExistsError; /* EEXIST */ + static PyObject* DBNoSuchFileError; /* ENOENT */ + static PyObject* DBPermissionsError; /* EPERM */ + +-#if (DBVER >= 42) + static PyObject* DBRepHandleDeadError; /* DB_REP_HANDLE_DEAD */ +-#endif + #if (DBVER >= 44) + static PyObject* DBRepLockoutError; /* DB_REP_LOCKOUT */ + #endif +@@ -696,8 +696,10 @@ static int makeDBError(int err) + case DB_RUNRECOVERY: errObj = DBRunRecoveryError; break; + case DB_VERIFY_BAD: errObj = DBVerifyBadError; break; + case DB_NOSERVER: errObj = DBNoServerError; break; ++#if (DBVER < 52) + case DB_NOSERVER_HOME: errObj = DBNoServerHomeError; break; + case DB_NOSERVER_ID: errObj = DBNoServerIDError; break; ++#endif + case DB_PAGE_NOTFOUND: errObj = DBPageNotFoundError; break; + case DB_SECONDARY_BAD: errObj = DBSecondaryBadError; break; + case DB_BUFFER_SMALL: errObj = DBNoMemoryError; break; +@@ -715,9 +717,7 @@ static int makeDBError(int err) + case ENOENT: errObj = DBNoSuchFileError; break; + case EPERM : errObj = DBPermissionsError; break; + +-#if (DBVER >= 42) + case DB_REP_HANDLE_DEAD : errObj = DBRepHandleDeadError; break; +-#endif + #if (DBVER >= 44) + case DB_REP_LOCKOUT : errObj = DBRepLockoutError; break; + #endif +@@ -2132,7 +2132,7 @@ DB_get_size(DBObject* self, PyObject* args, PyObject* kwargs) + MYDB_BEGIN_ALLOW_THREADS; + err = self->db->get(self->db, txn, &key, &data, flags); + MYDB_END_ALLOW_THREADS; +- if (err == DB_BUFFER_SMALL) { ++ if ((err == DB_BUFFER_SMALL) || (err == 0)) { + retval = NUMBER_FromLong((long)data.size); + err = 0; + } +@@ -2385,9 +2385,7 @@ DB_open(DBObject* self, PyObject* args, PyObject* kwargs) + return NULL; + } + +-#if (DBVER >= 42) + self->db->get_flags(self->db, &self->setflags); +-#endif + + self->flags = flags; + +@@ -2539,6 +2537,37 @@ DB_get_priority(DBObject* self) + #endif + + static PyObject* ++DB_get_dbname(DBObject* self) ++{ ++ int err; ++ const char *filename, *dbname; ++ ++ CHECK_DB_NOT_CLOSED(self); ++ ++ MYDB_BEGIN_ALLOW_THREADS; ++ err = self->db->get_dbname(self->db, &filename, &dbname); ++ MYDB_END_ALLOW_THREADS; ++ RETURN_IF_ERR(); ++ /* If "dbname==NULL", it is correctly converted to "None" */ ++ return Py_BuildValue("(ss)", filename, dbname); ++} ++ ++static PyObject* ++DB_get_open_flags(DBObject* self) ++{ ++ int err; ++ unsigned int flags; ++ ++ CHECK_DB_NOT_CLOSED(self); ++ ++ MYDB_BEGIN_ALLOW_THREADS; ++ err = self->db->get_open_flags(self->db, &flags); ++ MYDB_END_ALLOW_THREADS; ++ RETURN_IF_ERR(); ++ return NUMBER_FromLong(flags); ++} ++ ++static PyObject* + DB_set_q_extentsize(DBObject* self, PyObject* args) + { + int err; +@@ -2555,7 +2584,6 @@ DB_set_q_extentsize(DBObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DB_get_q_extentsize(DBObject* self) + { +@@ -2570,7 +2598,6 @@ DB_get_q_extentsize(DBObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(extentsize); + } +-#endif + + static PyObject* + DB_set_bt_minkey(DBObject* self, PyObject* args) +@@ -2588,7 +2615,6 @@ DB_set_bt_minkey(DBObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DB_get_bt_minkey(DBObject* self) + { +@@ -2603,7 +2629,6 @@ DB_get_bt_minkey(DBObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(bt_minkey); + } +-#endif + + static int + _default_cmp(const DBT *leftKey, +@@ -2759,7 +2784,6 @@ DB_set_cachesize(DBObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DB_get_cachesize(DBObject* self) + { +@@ -2777,7 +2801,6 @@ DB_get_cachesize(DBObject* self) + + return Py_BuildValue("(iii)", gbytes, bytes, ncache); + } +-#endif + + static PyObject* + DB_set_flags(DBObject* self, PyObject* args) +@@ -2797,7 +2820,6 @@ DB_set_flags(DBObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DB_get_flags(DBObject* self) + { +@@ -2812,6 +2834,35 @@ DB_get_flags(DBObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(flags); + } ++ ++#if (DBVER >= 43) ++static PyObject* ++DB_get_transactional(DBObject* self) ++{ ++ int err; ++ ++ CHECK_DB_NOT_CLOSED(self); ++ ++ MYDB_BEGIN_ALLOW_THREADS; ++ err = self->db->get_transactional(self->db); ++ MYDB_END_ALLOW_THREADS; ++ ++ if(err == 0) { ++ Py_INCREF(Py_False); ++ return Py_False; ++ } else if(err == 1) { ++ Py_INCREF(Py_True); ++ return Py_True; ++ } ++ ++ /* ++ ** If we reach there, there was an error. The ++ ** "return" should be unreachable. ++ */ ++ RETURN_IF_ERR(); ++ assert(0); /* This coude SHOULD be unreachable */ ++ return NULL; ++} + #endif + + static PyObject* +@@ -2830,7 +2881,6 @@ DB_set_h_ffactor(DBObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DB_get_h_ffactor(DBObject* self) + { +@@ -2845,7 +2895,6 @@ DB_get_h_ffactor(DBObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(ffactor); + } +-#endif + + static PyObject* + DB_set_h_nelem(DBObject* self, PyObject* args) +@@ -2863,7 +2912,6 @@ DB_set_h_nelem(DBObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DB_get_h_nelem(DBObject* self) + { +@@ -2878,7 +2926,6 @@ DB_get_h_nelem(DBObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(nelem); + } +-#endif + + static PyObject* + DB_set_lorder(DBObject* self, PyObject* args) +@@ -2896,7 +2943,6 @@ DB_set_lorder(DBObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DB_get_lorder(DBObject* self) + { +@@ -2911,7 +2957,6 @@ DB_get_lorder(DBObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(lorder); + } +-#endif + + static PyObject* + DB_set_pagesize(DBObject* self, PyObject* args) +@@ -2929,7 +2974,6 @@ DB_set_pagesize(DBObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DB_get_pagesize(DBObject* self) + { +@@ -2944,7 +2988,6 @@ DB_get_pagesize(DBObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(pagesize); + } +-#endif + + static PyObject* + DB_set_re_delim(DBObject* self, PyObject* args) +@@ -2967,7 +3010,6 @@ DB_set_re_delim(DBObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DB_get_re_delim(DBObject* self) + { +@@ -2981,7 +3023,6 @@ DB_get_re_delim(DBObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(re_delim); + } +-#endif + + static PyObject* + DB_set_re_len(DBObject* self, PyObject* args) +@@ -2999,7 +3040,6 @@ DB_set_re_len(DBObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DB_get_re_len(DBObject* self) + { +@@ -3014,7 +3054,6 @@ DB_get_re_len(DBObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(re_len); + } +-#endif + + static PyObject* + DB_set_re_pad(DBObject* self, PyObject* args) +@@ -3036,7 +3075,6 @@ DB_set_re_pad(DBObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DB_get_re_pad(DBObject* self) + { +@@ -3050,7 +3088,6 @@ DB_get_re_pad(DBObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(re_pad); + } +-#endif + + static PyObject* + DB_set_re_source(DBObject* self, PyObject* args) +@@ -3069,7 +3106,6 @@ DB_set_re_source(DBObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DB_get_re_source(DBObject* self) + { +@@ -3084,7 +3120,6 @@ DB_get_re_source(DBObject* self) + RETURN_IF_ERR(); + return PyBytes_FromString(source); + } +-#endif + + static PyObject* + DB_stat(DBObject* self, PyObject* args, PyObject* kwargs) +@@ -3381,7 +3416,6 @@ DB_set_encrypt(DBObject* self, PyObject* args, PyObject* kwargs) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DB_get_encrypt_flags(DBObject* self) + { +@@ -3396,7 +3430,6 @@ DB_get_encrypt_flags(DBObject* self) + + return NUMBER_FromLong(flags); + } +-#endif + + + +@@ -4987,7 +5020,6 @@ DBEnv_set_encrypt(DBEnvObject* self, PyObject* args, PyObject* kwargs) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_encrypt_flags(DBEnvObject* self) + { +@@ -5025,7 +5057,6 @@ DBEnv_get_timeout(DBEnvObject* self, PyObject* args, PyObject* kwargs) + RETURN_IF_ERR(); + return NUMBER_FromLong(timeout); + } +-#endif + + + static PyObject* +@@ -5064,7 +5095,6 @@ DBEnv_set_shm_key(DBEnvObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_shm_key(DBEnvObject* self) + { +@@ -5081,7 +5111,6 @@ DBEnv_get_shm_key(DBEnvObject* self) + + return NUMBER_FromLong(shm_key); + } +-#endif + + #if (DBVER >= 46) + static PyObject* +@@ -5170,7 +5199,6 @@ DBEnv_set_cachesize(DBEnvObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_cachesize(DBEnvObject* self) + { +@@ -5188,7 +5216,6 @@ DBEnv_get_cachesize(DBEnvObject* self) + + return Py_BuildValue("(iii)", gbytes, bytes, ncache); + } +-#endif + + + static PyObject* +@@ -5208,7 +5235,6 @@ DBEnv_set_flags(DBEnvObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_flags(DBEnvObject* self) + { +@@ -5223,7 +5249,6 @@ DBEnv_get_flags(DBEnvObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(flags); + } +-#endif + + #if (DBVER >= 47) + static PyObject* +@@ -5423,7 +5448,6 @@ DBEnv_set_data_dir(DBEnvObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_data_dirs(DBEnvObject* self) + { +@@ -5463,7 +5487,6 @@ DBEnv_get_data_dirs(DBEnvObject* self) + } + return tuple; + } +-#endif + + #if (DBVER >= 44) + static PyObject* +@@ -5513,7 +5536,6 @@ DBEnv_set_lg_bsize(DBEnvObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_lg_bsize(DBEnvObject* self) + { +@@ -5528,7 +5550,6 @@ DBEnv_get_lg_bsize(DBEnvObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(lg_bsize); + } +-#endif + + static PyObject* + DBEnv_set_lg_dir(DBEnvObject* self, PyObject* args) +@@ -5547,7 +5568,6 @@ DBEnv_set_lg_dir(DBEnvObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_lg_dir(DBEnvObject* self) + { +@@ -5562,7 +5582,6 @@ DBEnv_get_lg_dir(DBEnvObject* self) + RETURN_IF_ERR(); + return PyBytes_FromString(dirp); + } +-#endif + + static PyObject* + DBEnv_set_lg_max(DBEnvObject* self, PyObject* args) +@@ -5580,7 +5599,6 @@ DBEnv_set_lg_max(DBEnvObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_lg_max(DBEnvObject* self) + { +@@ -5595,8 +5613,6 @@ DBEnv_get_lg_max(DBEnvObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(lg_max); + } +-#endif +- + + static PyObject* + DBEnv_set_lg_regionmax(DBEnvObject* self, PyObject* args) +@@ -5614,7 +5630,6 @@ DBEnv_set_lg_regionmax(DBEnvObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_lg_regionmax(DBEnvObject* self) + { +@@ -5629,7 +5644,6 @@ DBEnv_get_lg_regionmax(DBEnvObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(lg_regionmax); + } +-#endif + + #if (DBVER >= 47) + static PyObject* +@@ -5680,7 +5694,6 @@ DBEnv_set_lk_detect(DBEnvObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_lk_detect(DBEnvObject* self) + { +@@ -5695,8 +5708,6 @@ DBEnv_get_lk_detect(DBEnvObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(lk_detect); + } +-#endif +- + + #if (DBVER < 45) + static PyObject* +@@ -5734,7 +5745,6 @@ DBEnv_set_lk_max_locks(DBEnvObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_lk_max_locks(DBEnvObject* self) + { +@@ -5749,7 +5759,6 @@ DBEnv_get_lk_max_locks(DBEnvObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(lk_max); + } +-#endif + + static PyObject* + DBEnv_set_lk_max_lockers(DBEnvObject* self, PyObject* args) +@@ -5767,7 +5776,6 @@ DBEnv_set_lk_max_lockers(DBEnvObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_lk_max_lockers(DBEnvObject* self) + { +@@ -5782,7 +5790,6 @@ DBEnv_get_lk_max_lockers(DBEnvObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(lk_max); + } +-#endif + + static PyObject* + DBEnv_set_lk_max_objects(DBEnvObject* self, PyObject* args) +@@ -5800,7 +5807,6 @@ DBEnv_set_lk_max_objects(DBEnvObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_lk_max_objects(DBEnvObject* self) + { +@@ -5815,9 +5821,7 @@ DBEnv_get_lk_max_objects(DBEnvObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(lk_max); + } +-#endif + +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_mp_mmapsize(DBEnvObject* self) + { +@@ -5832,8 +5836,6 @@ DBEnv_get_mp_mmapsize(DBEnvObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(mmapsize); + } +-#endif +- + + static PyObject* + DBEnv_set_mp_mmapsize(DBEnvObject* self, PyObject* args) +@@ -5869,8 +5871,6 @@ DBEnv_set_tmp_dir(DBEnvObject* self, PyObject* args) + RETURN_NONE(); + } + +- +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_tmp_dir(DBEnvObject* self) + { +@@ -5887,8 +5887,6 @@ DBEnv_get_tmp_dir(DBEnvObject* self) + + return PyBytes_FromString(dirpp); + } +-#endif +- + + static PyObject* + DBEnv_txn_recover(DBEnvObject* self) +@@ -5899,7 +5897,7 @@ DBEnv_txn_recover(DBEnvObject* self) + DBTxnObject *txn; + #define PREPLIST_LEN 16 + DB_PREPLIST preplist[PREPLIST_LEN]; +-#if (DBVER < 48) ++#if (DBVER < 48 || DBVER > 51) + long retp; + #else + u_int32_t retp; +@@ -6003,8 +6001,6 @@ DBEnv_txn_checkpoint(DBEnvObject* self, PyObject* args) + RETURN_NONE(); + } + +- +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_tx_max(DBEnvObject* self) + { +@@ -6019,8 +6015,6 @@ DBEnv_get_tx_max(DBEnvObject* self) + RETURN_IF_ERR(); + return PyLong_FromUnsignedLong(max); + } +-#endif +- + + static PyObject* + DBEnv_set_tx_max(DBEnvObject* self, PyObject* args) +@@ -6038,8 +6032,6 @@ DBEnv_set_tx_max(DBEnvObject* self, PyObject* args) + RETURN_NONE(); + } + +- +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_tx_timestamp(DBEnvObject* self) + { +@@ -6054,7 +6046,6 @@ DBEnv_get_tx_timestamp(DBEnvObject* self) + RETURN_IF_ERR(); + return NUMBER_FromLong(timestamp); + } +-#endif + + static PyObject* + DBEnv_set_tx_timestamp(DBEnvObject* self, PyObject* args) +@@ -6756,6 +6747,55 @@ DBEnv_set_private(DBEnvObject* self, PyObject* private_obj) + RETURN_NONE(); + } + ++#if (DBVER >= 47) ++static PyObject* ++DBEnv_set_intermediate_dir_mode(DBEnvObject* self, PyObject* args) ++{ ++ int err; ++ const char *mode; ++ ++ if (!PyArg_ParseTuple(args,"s:set_intermediate_dir_mode", &mode)) ++ return NULL; ++ ++ CHECK_ENV_NOT_CLOSED(self); ++ ++ MYDB_BEGIN_ALLOW_THREADS; ++ err = self->db_env->set_intermediate_dir_mode(self->db_env, mode); ++ MYDB_END_ALLOW_THREADS; ++ RETURN_IF_ERR(); ++ RETURN_NONE(); ++} ++ ++static PyObject* ++DBEnv_get_intermediate_dir_mode(DBEnvObject* self) ++{ ++ int err; ++ const char *mode; ++ ++ CHECK_ENV_NOT_CLOSED(self); ++ ++ MYDB_BEGIN_ALLOW_THREADS; ++ err = self->db_env->get_intermediate_dir_mode(self->db_env, &mode); ++ MYDB_END_ALLOW_THREADS; ++ RETURN_IF_ERR(); ++ return Py_BuildValue("s", mode); ++} ++#endif ++ ++static PyObject* ++DBEnv_get_open_flags(DBEnvObject* self) ++{ ++ int err; ++ unsigned int flags; ++ ++ CHECK_ENV_NOT_CLOSED(self); ++ ++ MYDB_BEGIN_ALLOW_THREADS; ++ err = self->db_env->get_open_flags(self->db_env, &flags); ++ MYDB_END_ALLOW_THREADS; ++ RETURN_IF_ERR(); ++ return NUMBER_FromLong(flags); ++} + + #if (DBVER < 48) + static PyObject* +@@ -6875,7 +6915,6 @@ DBEnv_set_verbose(DBEnvObject* self, PyObject* args) + RETURN_NONE(); + } + +-#if (DBVER >= 42) + static PyObject* + DBEnv_get_verbose(DBEnvObject* self, PyObject* args) + { +@@ -6893,7 +6932,6 @@ DBEnv_get_verbose(DBEnvObject* self, PyObject* args) + RETURN_IF_ERR(); + return PyBool_FromLong(verbose); + } +-#endif + + #if (DBVER >= 45) + static void +@@ -6975,9 +7013,7 @@ DBEnv_rep_process_message(DBEnvObject* self, PyObject* args) + PyObject *control_py, *rec_py; + DBT control, rec; + int envid; +-#if (DBVER >= 42) + DB_LSN lsn; +-#endif + + if (!PyArg_ParseTuple(args, "OOi:rep_process_message", &control_py, + &rec_py, &envid)) +@@ -6994,13 +7030,8 @@ DBEnv_rep_process_message(DBEnvObject* self, PyObject* args) + err = self->db_env->rep_process_message(self->db_env, &control, &rec, + envid, &lsn); + #else +-#if (DBVER >= 42) + err = self->db_env->rep_process_message(self->db_env, &control, &rec, + &envid, &lsn); +-#else +- err = self->db_env->rep_process_message(self->db_env, &control, &rec, +- &envid); +-#endif + #endif + MYDB_END_ALLOW_THREADS; + switch (err) { +@@ -7029,12 +7060,10 @@ DBEnv_rep_process_message(DBEnvObject* self, PyObject* args) + return r; + break; + } +-#if (DBVER >= 42) + case DB_REP_NOTPERM : + case DB_REP_ISPERM : + return Py_BuildValue("(i(ll))", err, lsn.file, lsn.offset); + break; +-#endif + } + RETURN_IF_ERR(); + return Py_BuildValue("(OO)", Py_None, Py_None); +@@ -7086,20 +7115,6 @@ _DBEnv_rep_transportCallback(DB_ENV* db_env, const DBT* control, const DBT* rec, + return ret; + } + +-#if (DBVER <= 41) +-static int +-_DBEnv_rep_transportCallbackOLD(DB_ENV* db_env, const DBT* control, const DBT* rec, +- int envid, u_int32_t flags) +-{ +- DB_LSN lsn; +- +- lsn.file = -1; /* Dummy values */ +- lsn.offset = -1; +- return _DBEnv_rep_transportCallback(db_env, control, rec, &lsn, envid, +- flags); +-} +-#endif +- + static PyObject* + DBEnv_rep_set_transport(DBEnvObject* self, PyObject* args) + { +@@ -7120,13 +7135,8 @@ DBEnv_rep_set_transport(DBEnvObject* self, PyObject* args) + err = self->db_env->rep_set_transport(self->db_env, envid, + &_DBEnv_rep_transportCallback); + #else +-#if (DBVER >= 42) + err = self->db_env->set_rep_transport(self->db_env, envid, + &_DBEnv_rep_transportCallback); +-#else +- err = self->db_env->set_rep_transport(self->db_env, envid, +- &_DBEnv_rep_transportCallbackOLD); +-#endif + #endif + MYDB_END_ALLOW_THREADS; + RETURN_IF_ERR(); +@@ -7608,6 +7618,7 @@ DBEnv_repmgr_start(DBEnvObject* self, PyObject* args, PyObject* + RETURN_NONE(); + } + ++#if (DBVER < 52) + static PyObject* + DBEnv_repmgr_set_local_site(DBEnvObject* self, PyObject* args, PyObject* + kwargs) +@@ -7654,6 +7665,7 @@ DBEnv_repmgr_add_remote_site(DBEnvObject* self, PyObject* args, PyObject* + RETURN_IF_ERR(); + return NUMBER_FromLong(eidp); + } ++#endif + + static PyObject* + DBEnv_repmgr_set_ack_policy(DBEnvObject* self, PyObject* args) +@@ -8482,65 +8494,43 @@ static PyMethodDef DB_methods[] = { + {"remove", (PyCFunction)DB_remove, METH_VARARGS|METH_KEYWORDS}, + {"rename", (PyCFunction)DB_rename, METH_VARARGS}, + {"set_bt_minkey", (PyCFunction)DB_set_bt_minkey, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_bt_minkey", (PyCFunction)DB_get_bt_minkey, METH_NOARGS}, +-#endif + {"set_bt_compare", (PyCFunction)DB_set_bt_compare, METH_O}, + {"set_cachesize", (PyCFunction)DB_set_cachesize, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_cachesize", (PyCFunction)DB_get_cachesize, METH_NOARGS}, +-#endif + {"set_encrypt", (PyCFunction)DB_set_encrypt, METH_VARARGS|METH_KEYWORDS}, +-#if (DBVER >= 42) + {"get_encrypt_flags", (PyCFunction)DB_get_encrypt_flags, METH_NOARGS}, +-#endif +- + {"set_flags", (PyCFunction)DB_set_flags, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_flags", (PyCFunction)DB_get_flags, METH_NOARGS}, ++#if (DBVER >= 43) ++ {"get_transactional", (PyCFunction)DB_get_transactional, METH_NOARGS}, + #endif + {"set_h_ffactor", (PyCFunction)DB_set_h_ffactor, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_h_ffactor", (PyCFunction)DB_get_h_ffactor, METH_NOARGS}, +-#endif + {"set_h_nelem", (PyCFunction)DB_set_h_nelem, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_h_nelem", (PyCFunction)DB_get_h_nelem, METH_NOARGS}, +-#endif + {"set_lorder", (PyCFunction)DB_set_lorder, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_lorder", (PyCFunction)DB_get_lorder, METH_NOARGS}, +-#endif + {"set_pagesize", (PyCFunction)DB_set_pagesize, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_pagesize", (PyCFunction)DB_get_pagesize, METH_NOARGS}, +-#endif + {"set_re_delim", (PyCFunction)DB_set_re_delim, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_re_delim", (PyCFunction)DB_get_re_delim, METH_NOARGS}, +-#endif + {"set_re_len", (PyCFunction)DB_set_re_len, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_re_len", (PyCFunction)DB_get_re_len, METH_NOARGS}, +-#endif + {"set_re_pad", (PyCFunction)DB_set_re_pad, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_re_pad", (PyCFunction)DB_get_re_pad, METH_NOARGS}, +-#endif + {"set_re_source", (PyCFunction)DB_set_re_source, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_re_source", (PyCFunction)DB_get_re_source, METH_NOARGS}, +-#endif + {"set_q_extentsize",(PyCFunction)DB_set_q_extentsize, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_q_extentsize",(PyCFunction)DB_get_q_extentsize, METH_NOARGS}, +-#endif + {"set_private", (PyCFunction)DB_set_private, METH_O}, + {"get_private", (PyCFunction)DB_get_private, METH_NOARGS}, + #if (DBVER >= 46) + {"set_priority", (PyCFunction)DB_set_priority, METH_VARARGS}, + {"get_priority", (PyCFunction)DB_get_priority, METH_NOARGS}, + #endif ++ {"get_dbname", (PyCFunction)DB_get_dbname, METH_NOARGS}, ++ {"get_open_flags", (PyCFunction)DB_get_open_flags, METH_NOARGS}, + {"stat", (PyCFunction)DB_stat, METH_VARARGS|METH_KEYWORDS}, + #if (DBVER >= 43) + {"stat_print", (PyCFunction)DB_stat_print, +@@ -8639,24 +8629,18 @@ static PyMethodDef DBEnv_methods[] = { + {"get_thread_count", (PyCFunction)DBEnv_get_thread_count, METH_NOARGS}, + #endif + {"set_encrypt", (PyCFunction)DBEnv_set_encrypt, METH_VARARGS|METH_KEYWORDS}, +-#if (DBVER >= 42) + {"get_encrypt_flags", (PyCFunction)DBEnv_get_encrypt_flags, METH_NOARGS}, + {"get_timeout", (PyCFunction)DBEnv_get_timeout, + METH_VARARGS|METH_KEYWORDS}, +-#endif + {"set_timeout", (PyCFunction)DBEnv_set_timeout, METH_VARARGS|METH_KEYWORDS}, + {"set_shm_key", (PyCFunction)DBEnv_set_shm_key, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_shm_key", (PyCFunction)DBEnv_get_shm_key, METH_NOARGS}, +-#endif + #if (DBVER >= 46) + {"set_cache_max", (PyCFunction)DBEnv_set_cache_max, METH_VARARGS}, + {"get_cache_max", (PyCFunction)DBEnv_get_cache_max, METH_NOARGS}, + #endif + {"set_cachesize", (PyCFunction)DBEnv_set_cachesize, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_cachesize", (PyCFunction)DBEnv_get_cachesize, METH_NOARGS}, +-#endif + {"memp_trickle", (PyCFunction)DBEnv_memp_trickle, METH_VARARGS}, + {"memp_sync", (PyCFunction)DBEnv_memp_sync, METH_VARARGS}, + {"memp_stat", (PyCFunction)DBEnv_memp_stat, +@@ -8685,33 +8669,21 @@ static PyMethodDef DBEnv_methods[] = { + #endif + #endif + {"set_data_dir", (PyCFunction)DBEnv_set_data_dir, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_data_dirs", (PyCFunction)DBEnv_get_data_dirs, METH_NOARGS}, +-#endif +-#if (DBVER >= 42) + {"get_flags", (PyCFunction)DBEnv_get_flags, METH_NOARGS}, +-#endif + {"set_flags", (PyCFunction)DBEnv_set_flags, METH_VARARGS}, + #if (DBVER >= 47) + {"log_set_config", (PyCFunction)DBEnv_log_set_config, METH_VARARGS}, + {"log_get_config", (PyCFunction)DBEnv_log_get_config, METH_VARARGS}, + #endif + {"set_lg_bsize", (PyCFunction)DBEnv_set_lg_bsize, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_lg_bsize", (PyCFunction)DBEnv_get_lg_bsize, METH_NOARGS}, +-#endif + {"set_lg_dir", (PyCFunction)DBEnv_set_lg_dir, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_lg_dir", (PyCFunction)DBEnv_get_lg_dir, METH_NOARGS}, +-#endif + {"set_lg_max", (PyCFunction)DBEnv_set_lg_max, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_lg_max", (PyCFunction)DBEnv_get_lg_max, METH_NOARGS}, +-#endif + {"set_lg_regionmax",(PyCFunction)DBEnv_set_lg_regionmax, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_lg_regionmax",(PyCFunction)DBEnv_get_lg_regionmax, METH_NOARGS}, +-#endif + #if (DBVER >= 44) + {"set_lg_filemode", (PyCFunction)DBEnv_set_lg_filemode, METH_VARARGS}, + {"get_lg_filemode", (PyCFunction)DBEnv_get_lg_filemode, METH_NOARGS}, +@@ -8721,36 +8693,24 @@ static PyMethodDef DBEnv_methods[] = { + {"get_lk_partitions", (PyCFunction)DBEnv_get_lk_partitions, METH_NOARGS}, + #endif + {"set_lk_detect", (PyCFunction)DBEnv_set_lk_detect, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_lk_detect", (PyCFunction)DBEnv_get_lk_detect, METH_NOARGS}, +-#endif + #if (DBVER < 45) + {"set_lk_max", (PyCFunction)DBEnv_set_lk_max, METH_VARARGS}, + #endif + {"set_lk_max_locks", (PyCFunction)DBEnv_set_lk_max_locks, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_lk_max_locks", (PyCFunction)DBEnv_get_lk_max_locks, METH_NOARGS}, +-#endif + {"set_lk_max_lockers", (PyCFunction)DBEnv_set_lk_max_lockers, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_lk_max_lockers", (PyCFunction)DBEnv_get_lk_max_lockers, METH_NOARGS}, +-#endif + {"set_lk_max_objects", (PyCFunction)DBEnv_set_lk_max_objects, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_lk_max_objects", (PyCFunction)DBEnv_get_lk_max_objects, METH_NOARGS}, +-#endif + #if (DBVER >= 43) + {"stat_print", (PyCFunction)DBEnv_stat_print, + METH_VARARGS|METH_KEYWORDS}, + #endif + {"set_mp_mmapsize", (PyCFunction)DBEnv_set_mp_mmapsize, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_mp_mmapsize", (PyCFunction)DBEnv_get_mp_mmapsize, METH_NOARGS}, +-#endif + {"set_tmp_dir", (PyCFunction)DBEnv_set_tmp_dir, METH_VARARGS}, +-#if (DBVER >= 42) + {"get_tmp_dir", (PyCFunction)DBEnv_get_tmp_dir, METH_NOARGS}, +-#endif + {"txn_begin", (PyCFunction)DBEnv_txn_begin, METH_VARARGS|METH_KEYWORDS}, + {"txn_checkpoint", (PyCFunction)DBEnv_txn_checkpoint, METH_VARARGS}, + {"txn_stat", (PyCFunction)DBEnv_txn_stat, METH_VARARGS}, +@@ -8758,10 +8718,8 @@ static PyMethodDef DBEnv_methods[] = { + {"txn_stat_print", (PyCFunction)DBEnv_txn_stat_print, + METH_VARARGS|METH_KEYWORDS}, + #endif +-#if (DBVER >= 42) + {"get_tx_max", (PyCFunction)DBEnv_get_tx_max, METH_NOARGS}, + {"get_tx_timestamp", (PyCFunction)DBEnv_get_tx_timestamp, METH_NOARGS}, +-#endif + {"set_tx_max", (PyCFunction)DBEnv_set_tx_max, METH_VARARGS}, + {"set_tx_timestamp", (PyCFunction)DBEnv_set_tx_timestamp, METH_VARARGS}, + {"lock_detect", (PyCFunction)DBEnv_lock_detect, METH_VARARGS}, +@@ -8804,11 +8762,16 @@ static PyMethodDef DBEnv_methods[] = { + {"get_mp_max_write", (PyCFunction)DBEnv_get_mp_max_write, METH_NOARGS}, + #endif + {"set_verbose", (PyCFunction)DBEnv_set_verbose, METH_VARARGS}, +-#if (DBVER >= 42) +- {"get_verbose", (PyCFunction)DBEnv_get_verbose, METH_VARARGS}, ++ {"get_verbose", (PyCFunction)DBEnv_get_verbose, METH_VARARGS}, ++ {"set_private", (PyCFunction)DBEnv_set_private, METH_O}, ++ {"get_private", (PyCFunction)DBEnv_get_private, METH_NOARGS}, ++ {"get_open_flags", (PyCFunction)DBEnv_get_open_flags, METH_NOARGS}, ++#if (DBVER >= 47) ++ {"set_intermediate_dir_mode", (PyCFunction)DBEnv_set_intermediate_dir_mode, ++ METH_VARARGS}, ++ {"get_intermediate_dir_mode", (PyCFunction)DBEnv_get_intermediate_dir_mode, ++ METH_NOARGS}, + #endif +- {"set_private", (PyCFunction)DBEnv_set_private, METH_O}, +- {"get_private", (PyCFunction)DBEnv_get_private, METH_NOARGS}, + {"rep_start", (PyCFunction)DBEnv_rep_start, + METH_VARARGS|METH_KEYWORDS}, + {"rep_set_transport", (PyCFunction)DBEnv_rep_set_transport, METH_VARARGS}, +@@ -8855,10 +8818,12 @@ static PyMethodDef DBEnv_methods[] = { + #if (DBVER >= 45) + {"repmgr_start", (PyCFunction)DBEnv_repmgr_start, + METH_VARARGS|METH_KEYWORDS}, ++#if (DBVER < 52) + {"repmgr_set_local_site", (PyCFunction)DBEnv_repmgr_set_local_site, + METH_VARARGS|METH_KEYWORDS}, + {"repmgr_add_remote_site", (PyCFunction)DBEnv_repmgr_add_remote_site, + METH_VARARGS|METH_KEYWORDS}, ++#endif + {"repmgr_set_ack_policy", (PyCFunction)DBEnv_repmgr_set_ack_policy, + METH_VARARGS}, + {"repmgr_get_ack_policy", (PyCFunction)DBEnv_repmgr_get_ack_policy, +@@ -8922,13 +8887,9 @@ DBEnv_db_home_get(DBEnvObject* self) + + CHECK_ENV_NOT_CLOSED(self); + +-#if (DBVER >= 42) + MYDB_BEGIN_ALLOW_THREADS; + self->db_env->get_home(self->db_env, &home); + MYDB_END_ALLOW_THREADS; +-#else +- home=self->db_env->db_home; +-#endif + + if (home == NULL) { + RETURN_NONE(); +@@ -9298,10 +9259,25 @@ bsddb_version(PyObject* self) + { + int major, minor, patch; + ++ /* This should be instantaneous, no need to release the GIL */ + db_version(&major, &minor, &patch); + return Py_BuildValue("(iii)", major, minor, patch); + } + ++#if (DBVER >= 50) ++static PyObject* ++bsddb_version_full(PyObject* self) ++{ ++ char *version_string; ++ int family, release, major, minor, patch; ++ ++ /* This should be instantaneous, no need to release the GIL */ ++ version_string = db_full_version(&family, &release, &major, &minor, &patch); ++ return Py_BuildValue("(siiiii)", ++ version_string, family, release, major, minor, patch); ++} ++#endif ++ + + /* List of functions defined in the module */ + static PyMethodDef bsddb_methods[] = { +@@ -9311,6 +9287,9 @@ static PyMethodDef bsddb_methods[] = { + {"DBSequence", (PyCFunction)DBSequence_construct, METH_VARARGS | METH_KEYWORDS }, + #endif + {"version", (PyCFunction)bsddb_version, METH_NOARGS, bsddb_version_doc}, ++#if (DBVER >= 50) ++ {"full_version", (PyCFunction)bsddb_version_full, METH_NOARGS}, ++#endif + {NULL, NULL} /* sentinel */ + }; + +@@ -9328,6 +9307,11 @@ static BSDDB_api bsddb_api; + */ + #define ADD_INT(dict, NAME) _addIntToDict(dict, #NAME, NAME) + ++/* ++** We can rename the module at import time, so the string allocated ++** must be big enough, and any use of the name must use this particular ++** string. ++*/ + #define MODULE_NAME_MAX_LEN 11 + static char _bsddbModuleName[MODULE_NAME_MAX_LEN+1] = "_bsddb"; + +@@ -9428,16 +9412,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + ADD_INT(d, DB_MAX_RECORDS); + + #if (DBVER < 48) +-#if (DBVER >= 42) + ADD_INT(d, DB_RPCCLIENT); +-#else +- ADD_INT(d, DB_CLIENT); +- /* allow apps to be written using DB_RPCCLIENT on older Berkeley DB */ +- _addIntToDict(d, "DB_RPCCLIENT", DB_CLIENT); +-#endif + #endif + +-#if (DBVER < 48) ++#if (DBVER < 48 || DBVER > 51) + ADD_INT(d, DB_XA_CREATE); + #endif + +@@ -9477,6 +9455,14 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + ADD_INT(d, DB_TXN_SYNC); + ADD_INT(d, DB_TXN_NOWAIT); + ++#if (DBVER >= 51) ++ ADD_INT(d, DB_TXN_BULK); ++#endif ++ ++#if (DBVER >= 48) ++ ADD_INT(d, DB_CURSOR_BULK); ++#endif ++ + #if (DBVER >= 46) + ADD_INT(d, DB_TXN_WAIT); + #endif +@@ -9561,9 +9547,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + ADD_INT(d, DB_ARCH_ABS); + ADD_INT(d, DB_ARCH_DATA); + ADD_INT(d, DB_ARCH_LOG); +-#if (DBVER >= 42) + ADD_INT(d, DB_ARCH_REMOVE); +-#endif + + ADD_INT(d, DB_BTREE); + ADD_INT(d, DB_HASH); +@@ -9591,9 +9575,6 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + ADD_INT(d, DB_CACHED_COUNTS); + #endif + +-#if (DBVER <= 41) +- ADD_INT(d, DB_COMMIT); +-#endif + ADD_INT(d, DB_CONSUME); + ADD_INT(d, DB_CONSUME_WAIT); + ADD_INT(d, DB_CURRENT); +@@ -9651,8 +9632,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + ADD_INT(d, DB_LOCK_DEADLOCK); + ADD_INT(d, DB_LOCK_NOTGRANTED); + ADD_INT(d, DB_NOSERVER); ++#if (DBVER < 52) + ADD_INT(d, DB_NOSERVER_HOME); + ADD_INT(d, DB_NOSERVER_ID); ++#endif + ADD_INT(d, DB_NOTFOUND); + ADD_INT(d, DB_OLD_VERSION); + ADD_INT(d, DB_RUNRECOVERY); +@@ -9671,6 +9654,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + #if (DBVER >= 43) + ADD_INT(d, DB_STAT_SUBSYSTEM); + ADD_INT(d, DB_STAT_MEMP_HASH); ++ ADD_INT(d, DB_STAT_LOCK_CONF); ++ ADD_INT(d, DB_STAT_LOCK_LOCKERS); ++ ADD_INT(d, DB_STAT_LOCK_OBJECTS); ++ ADD_INT(d, DB_STAT_LOCK_PARAMS); + #endif + + #if (DBVER >= 48) +@@ -9690,7 +9677,6 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + ADD_INT(d, DB_EID_INVALID); + ADD_INT(d, DB_EID_BROADCAST); + +-#if (DBVER >= 42) + ADD_INT(d, DB_TIME_NOTGRANTED); + ADD_INT(d, DB_TXN_NOT_DURABLE); + ADD_INT(d, DB_TXN_WRITE_NOSYNC); +@@ -9698,9 +9684,8 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + ADD_INT(d, DB_INIT_REP); + ADD_INT(d, DB_ENCRYPT); + ADD_INT(d, DB_CHKSUM); +-#endif + +-#if (DBVER >= 42) && (DBVER < 47) ++#if (DBVER < 47) + ADD_INT(d, DB_LOG_AUTOREMOVE); + ADD_INT(d, DB_DIRECT_LOG); + #endif +@@ -9733,6 +9718,20 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + ADD_INT(d, DB_VERB_REPLICATION); + ADD_INT(d, DB_VERB_WAITSFOR); + ++#if (DBVER >= 50) ++ ADD_INT(d, DB_VERB_REP_SYSTEM); ++#endif ++ ++#if (DBVER >= 47) ++ ADD_INT(d, DB_VERB_REP_ELECT); ++ ADD_INT(d, DB_VERB_REP_LEASE); ++ ADD_INT(d, DB_VERB_REP_MISC); ++ ADD_INT(d, DB_VERB_REP_MSGS); ++ ADD_INT(d, DB_VERB_REP_SYNC); ++ ADD_INT(d, DB_VERB_REPMGR_CONNFAIL); ++ ADD_INT(d, DB_VERB_REPMGR_MISC); ++#endif ++ + #if (DBVER >= 45) + ADD_INT(d, DB_EVENT_PANIC); + ADD_INT(d, DB_EVENT_REP_CLIENT); +@@ -9748,16 +9747,25 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + ADD_INT(d, DB_EVENT_WRITE_FAILED); + #endif + ++#if (DBVER >= 50) ++ ADD_INT(d, DB_REPMGR_CONF_ELECTIONS); ++ ADD_INT(d, DB_EVENT_REP_MASTER_FAILURE); ++ ADD_INT(d, DB_EVENT_REP_DUPMASTER); ++ ADD_INT(d, DB_EVENT_REP_ELECTION_FAILED); ++#endif ++#if (DBVER >= 48) ++ ADD_INT(d, DB_EVENT_REG_ALIVE); ++ ADD_INT(d, DB_EVENT_REG_PANIC); ++#endif ++ + ADD_INT(d, DB_REP_DUPMASTER); + ADD_INT(d, DB_REP_HOLDELECTION); + #if (DBVER >= 44) + ADD_INT(d, DB_REP_IGNORE); + ADD_INT(d, DB_REP_JOIN_FAILURE); + #endif +-#if (DBVER >= 42) + ADD_INT(d, DB_REP_ISPERM); + ADD_INT(d, DB_REP_NOTPERM); +-#endif + ADD_INT(d, DB_REP_NEWSITE); + + ADD_INT(d, DB_REP_MASTER); +@@ -9766,7 +9774,13 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + ADD_INT(d, DB_REP_PERMANENT); + + #if (DBVER >= 44) ++#if (DBVER >= 50) ++ ADD_INT(d, DB_REP_CONF_AUTOINIT); ++#else + ADD_INT(d, DB_REP_CONF_NOAUTOINIT); ++#endif /* 5.0 */ ++#endif /* 4.4 */ ++#if (DBVER >= 44) + ADD_INT(d, DB_REP_CONF_DELAYCLIENT); + ADD_INT(d, DB_REP_CONF_BULK); + ADD_INT(d, DB_REP_CONF_NOWAIT); +@@ -9774,9 +9788,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + ADD_INT(d, DB_REP_REREQUEST); + #endif + +-#if (DBVER >= 42) + ADD_INT(d, DB_REP_NOBUFFER); +-#endif + + #if (DBVER >= 46) + ADD_INT(d, DB_REP_LEASE_EXPIRED); +@@ -9819,6 +9831,28 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + ADD_INT(d, DB_STAT_ALL); + #endif + ++#if (DBVER >= 51) ++ ADD_INT(d, DB_REPMGR_ACKS_ALL_AVAILABLE); ++#endif ++ ++#if (DBVER >= 48) ++ ADD_INT(d, DB_REP_CONF_INMEM); ++#endif ++ ++ ADD_INT(d, DB_TIMEOUT); ++ ++#if (DBVER >= 50) ++ ADD_INT(d, DB_FORCESYNC); ++#endif ++ ++#if (DBVER >= 48) ++ ADD_INT(d, DB_FAILCHK); ++#endif ++ ++#if (DBVER >= 51) ++ ADD_INT(d, DB_HOTBACKUP_IN_PROGRESS); ++#endif ++ + #if (DBVER >= 43) + ADD_INT(d, DB_BUFFER_SMALL); + ADD_INT(d, DB_SEQ_DEC); +@@ -9856,6 +9890,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + ADD_INT(d, DB_SET_LOCK_TIMEOUT); + ADD_INT(d, DB_SET_TXN_TIMEOUT); + ++#if (DBVER >= 48) ++ ADD_INT(d, DB_SET_REG_TIMEOUT); ++#endif ++ + /* The exception name must be correct for pickled exception * + * objects to unpickle properly. */ + #ifdef PYBSDDB_STANDALONE /* different value needed for standalone pybsddb */ +@@ -9912,8 +9950,10 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + MAKE_EX(DBRunRecoveryError); + MAKE_EX(DBVerifyBadError); + MAKE_EX(DBNoServerError); ++#if (DBVER >= 44 && DBVER < 52) + MAKE_EX(DBNoServerHomeError); + MAKE_EX(DBNoServerIDError); ++#endif + MAKE_EX(DBPageNotFoundError); + MAKE_EX(DBSecondaryBadError); + +@@ -9927,9 +9967,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + MAKE_EX(DBNoSuchFileError); + MAKE_EX(DBPermissionsError); + +-#if (DBVER >= 42) + MAKE_EX(DBRepHandleDeadError); +-#endif + #if (DBVER >= 44) + MAKE_EX(DBRepLockoutError); + #endif +@@ -9947,6 +9985,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + #undef MAKE_EX + + /* Initialise the C API structure and add it to the module */ ++ bsddb_api.api_version = PYBSDDB_API_VERSION; + bsddb_api.db_type = &DB_Type; + bsddb_api.dbcursor_type = &DBCursor_Type; + bsddb_api.dblogcursor_type = &DBLogCursor_Type; +@@ -9955,19 +9994,25 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ + bsddb_api.dblock_type = &DBLock_Type; + #if (DBVER >= 43) + bsddb_api.dbsequence_type = &DBSequence_Type; ++#else ++ bsddb_api.dbsequence_type = NULL; + #endif + bsddb_api.makeDBError = makeDBError; + + /* +- ** Capsules exist from Python 3.1, but I +- ** don't want to break the API compatibility +- ** for already published Python versions. ++ ** Capsules exist from Python 2.7 and 3.1. ++ ** We don't support Python 3.0 anymore, so... ++ ** #if (PY_VERSION_HEX < ((PY_MAJOR_VERSION < 3) ? 0x02070000 : 0x03020000)) + */ +-#if (PY_VERSION_HEX < 0x03020000) ++#if (PY_VERSION_HEX < 0x02070000) + py_api = PyCObject_FromVoidPtr((void*)&bsddb_api, NULL); + #else + { +- char py_api_name[250]; ++ /* ++ ** The data must outlive the call!!. So, the static definition. ++ ** The buffer must be big enough... ++ */ ++ static char py_api_name[MODULE_NAME_MAX_LEN+10]; + + strcpy(py_api_name, _bsddbModuleName); + strcat(py_api_name, ".api"); +diff --git a/Modules/bsddb.h b/Modules/bsddb.h +index a3a687b..c1d862a 100644 +--- a/Modules/bsddb.h ++++ b/Modules/bsddb.h +@@ -109,7 +109,7 @@ + #error "eek! DBVER can't handle minor versions > 9" + #endif + +-#define PY_BSDDB_VERSION "4.8.4.2" ++#define PY_BSDDB_VERSION "5.3.15" + + /* Python object definitions */ + +@@ -236,7 +236,7 @@ typedef struct DBSequenceObject { + /* To access the structure from an external module, use code like the + following (error checking missed out for clarity): + +- // If you are using Python before 3.2: ++ // If you are using Python before 2.7: + BSDDB_api* bsddb_api; + PyObject* mod; + PyObject* cobj; +@@ -249,7 +249,7 @@ typedef struct DBSequenceObject { + Py_DECREF(mod); + + +- // If you are using Python 3.2 or up: ++ // If you are using Python 2.7 or up: (except Python 3.0, unsupported) + BSDDB_api* bsddb_api; + + // Use "bsddb3._pybsddb.api" if you're using +@@ -257,10 +257,14 @@ typedef struct DBSequenceObject { + bsddb_api = (void **)PyCapsule_Import("bsddb._bsddb.api", 1); + + ++ Check "api_version" number before trying to use the API. ++ + The structure's members must not be changed. + */ + ++#define PYBSDDB_API_VERSION 1 + typedef struct { ++ unsigned int api_version; + /* Type objects */ + PyTypeObject* db_type; + PyTypeObject* dbcursor_type; +@@ -268,9 +272,7 @@ typedef struct { + PyTypeObject* dbenv_type; + PyTypeObject* dbtxn_type; + PyTypeObject* dblock_type; +-#if (DBVER >= 43) +- PyTypeObject* dbsequence_type; +-#endif ++ PyTypeObject* dbsequence_type; /* If DBVER < 43 -> NULL */ + + /* Functions */ + int (*makeDBError)(int err); +@@ -289,9 +291,9 @@ typedef struct { + #define DBEnvObject_Check(v) ((v)->ob_type == bsddb_api->dbenv_type) + #define DBTxnObject_Check(v) ((v)->ob_type == bsddb_api->dbtxn_type) + #define DBLockObject_Check(v) ((v)->ob_type == bsddb_api->dblock_type) +-#if (DBVER >= 43) +-#define DBSequenceObject_Check(v) ((v)->ob_type == bsddb_api->dbsequence_type) +-#endif ++#define DBSequenceObject_Check(v) \ ++ ((bsddb_api->dbsequence_type) && \ ++ ((v)->ob_type == bsddb_api->dbsequence_type)) + + #endif /* COMPILING_BSDDB_C */ + +diff --git a/setup.py b/setup.py +index 6b47451..e8ac96c 100644 +--- a/setup.py ++++ b/setup.py +@@ -799,7 +799,7 @@ class PyBuildExt(build_ext): + # a release. Most open source OSes come with one or more + # versions of BerkeleyDB already installed. + +- max_db_ver = (4, 8) ++ max_db_ver = (5, 3) + min_db_ver = (4, 1) + db_setup_debug = False # verbose debug prints from this script? + +@@ -821,7 +821,11 @@ class PyBuildExt(build_ext): + return True + + def gen_db_minor_ver_nums(major): +- if major == 4: ++ if major == 5: ++ for x in range(max_db_ver[1]+1): ++ if allow_db_ver((5, x)): ++ yield x ++ elif major == 4: + for x in range(max_db_ver[1]+1): + if allow_db_ver((4, x)): + yield x +@@ -835,6 +839,9 @@ 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/db5', ++ '/usr/local/include/db5', ++ '/opt/sfw/include/db5', + '/usr/include/db4', + '/usr/local/include/db4', + '/opt/sfw/include/db4', +@@ -845,6 +852,16 @@ class PyBuildExt(build_ext): + '/sw/include/db4', + '/sw/include/db3', + ] ++ # 5.x minor number specific paths ++ for x in gen_db_minor_ver_nums(5): ++ db_inc_paths.append('/usr/include/db5%d' % x) ++ db_inc_paths.append('/usr/include/db5.%d' % x) ++ db_inc_paths.append('/usr/local/BerkeleyDB.5.%d/include' % x) ++ db_inc_paths.append('/usr/local/include/db5%d' % x) ++ db_inc_paths.append('/pkg/db-5.%d/include' % x) ++ db_inc_paths.append('/opt/db-5.%d/include' % x) ++ # MacPorts default (http://www.macports.org/) ++ db_inc_paths.append('/opt/local/include/db5%d' % x) + # 4.x minor number specific paths + for x in gen_db_minor_ver_nums(4): + db_inc_paths.append('/usr/include/db4%d' % x) +@@ -871,6 +888,10 @@ 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, 'db5')) ++ for x in gen_db_minor_ver_nums(5): ++ std_variants.append(os.path.join(dn, "db5%d"%x)) ++ std_variants.append(os.path.join(dn, "db5.%d"%x)) + 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)) +-- +1.7.7 + diff --git a/meta/recipes-devtools/python/python/python-2.7.3-remove-bsdb-rpath.patch b/meta/recipes-devtools/python/python/python-2.7.3-remove-bsdb-rpath.patch new file mode 100644 index 0000000000..4b8953a137 --- /dev/null +++ b/meta/recipes-devtools/python/python/python-2.7.3-remove-bsdb-rpath.patch @@ -0,0 +1,22 @@ +Remove the RPTH to avoid QA issue warning. + +Signed-off-by: Jackie Huang <jackie.huang@windriver.com> +--- + setup.py | 1 - + 1 files changed, 0 insertions(+), 1 deletions(-) + +diff --git a/setup.py b/setup.py +index 83b5e56..1fd5487 100644 +--- a/setup.py ++++ b/setup.py +@@ -1025,7 +1025,6 @@ class PyBuildExt(build_ext): + exts.append(Extension('_bsddb', ['_bsddb.c'], + depends = ['bsddb.h'], + library_dirs=dblib_dir, +- runtime_library_dirs=dblib_dir, + include_dirs=db_incs, + libraries=dblibs)) + else: +-- +1.7.4 + diff --git a/meta/recipes-devtools/python/python_2.7.3.bb b/meta/recipes-devtools/python/python_2.7.3.bb index d27ff05a18..9c648fec15 100644 --- a/meta/recipes-devtools/python/python_2.7.3.bb +++ b/meta/recipes-devtools/python/python_2.7.3.bb @@ -1,6 +1,6 @@ require python.inc DEPENDS = "python-native bzip2 db gdbm openssl readline sqlite3 zlib" -PR = "${INC_PR}.1" +PR = "${INC_PR}.2" DISTRO_SRC_URI ?= "file://sitecustomize.py" DISTRO_SRC_URI_linuxstdbase = "" @@ -23,9 +23,10 @@ SRC_URI += "\ file://setuptweaks.patch \ file://check-if-target-is-64b-not-host.patch \ file://search_db_h_in_inc_dirs_and_avoid_warning.patch \ - file://avoid_warning_about_bsddb.patch \ file://avoid_warning_about_tkinter.patch \ file://avoid_warning_for_sunos_specific_module.patch \ + file://python-2.7.3-berkeley-db-5.3.patch \ + file://python-2.7.3-remove-bsdb-rpath.patch \ " S = "${WORKDIR}/Python-${PV}" diff --git a/meta/recipes-support/db/db_5.3.15.bb b/meta/recipes-support/db/db_5.3.15.bb index 0fc396ee97..063954af46 100644 --- a/meta/recipes-support/db/db_5.3.15.bb +++ b/meta/recipes-support/db/db_5.3.15.bb @@ -14,7 +14,7 @@ HOMEPAGE = "http://www.oracle.com/technology/products/berkeley-db/db/index.html" LICENSE = "Sleepycat" VIRTUAL_NAME ?= "virtual/db" RCONFLICTS_${PN} = "db3" -PR = "r7" +PR = "r8" SRC_URI = "http://download.oracle.com/berkeley-db/db-${PV}.tar.gz" SRC_URI += "file://arm-thumb-mutex_db5.patch;patchdir=.." @@ -56,7 +56,7 @@ FILES_SOLIBSDEV = "${libdir}/libdb.so" #configuration - set in local.conf to override # All the --disable-* options replace --enable-smallbuild, which breaks a bunch of stuff (eg. postfix) -DB5_CONFIG ?= "--enable-o_direct --disable-cryptography --disable-queue --disable-replication --disable-statistics --disable-verify --disable-compat185 --disable-sql" +DB5_CONFIG ?= "--enable-o_direct --disable-cryptography --disable-queue --disable-replication --disable-verify --disable-compat185 --disable-sql" EXTRA_OECONF = "${DB5_CONFIG}" |