s3:libsmb: allow store_cldap_reply() to work with a ipv6 response
[samba.git] / lib / tdb / wscript
index 987d78c0b8b6ab59646b0df23eadf0594a3a4764..0412149872377ab2639a922b601acfb81d9efda9 100644 (file)
@@ -1,19 +1,22 @@
 #!/usr/bin/env python
 
 APPNAME = 'tdb'
-VERSION = '1.3.13'
-
-blddir = 'bin'
+VERSION = '1.4.10'
 
 import sys, os
 
 # find the buildtools directory
-srcdir = '.'
-while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5:
-    srcdir = srcdir + '/..'
-sys.path.insert(0, srcdir + '/buildtools/wafsamba')
+top = '.'
+while not os.path.exists(top+'/buildtools') and len(top.split('/')) < 5:
+    top = top + '/..'
+sys.path.insert(0, top + '/buildtools/wafsamba')
+
+out = 'bin'
 
-import wafsamba, samba_dist, Options, Logs
+import wafsamba
+from wafsamba import samba_dist, samba_utils
+from waflib import Options, Logs, Context
+import shutil
 
 samba_dist.DIST_DIRS('lib/tdb:. lib/replace:lib/replace buildtools:buildtools third_party/waf:third_party/waf')
 
@@ -41,6 +44,7 @@ tdb1_unit_tests = [
     'run-traverse-in-transaction',
     'run-wronghash-fail',
     'run-zero-append',
+    'run-fcntl-deadlock',
     'run-marklock-deadlock',
     'run-allrecord-traverse-deadlock',
     'run-mutex-openflags2',
@@ -51,9 +55,12 @@ tdb1_unit_tests = [
     'run-mutex-transaction1',
     'run-mutex-die',
     'run-mutex1',
+    'run-circular-chain',
+    'run-circular-freelist',
+    'run-traverse-chain',
 ]
 
-def set_options(opt):
+def options(opt):
     opt.BUILTIN_DEFAULT('replace')
     opt.PRIVATE_EXTENSION_DEFAULT('tdb', noextension='tdb')
     opt.RECURSE('lib/replace')
@@ -90,14 +97,8 @@ def configure(conf):
 
     conf.CHECK_XSLTPROC_MANPAGES()
 
-    if not conf.env.disable_python:
-        # also disable if we don't have the python libs installed
-        conf.SAMBA_CHECK_PYTHON(mandatory=False)
-        conf.check_python_version((2,4,2))
-        conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
-        if not conf.env.HAVE_PYTHON_H:
-            Logs.warn('Disabling pytdb as python devel libs not found')
-            conf.env.disable_python = True
+    conf.SAMBA_CHECK_PYTHON()
+    conf.SAMBA_CHECK_PYTHON_HEADERS()
 
     conf.SAMBA_CONFIG_H()
 
@@ -144,6 +145,11 @@ def build(bld):
                          'tdb',
                          install=False)
 
+        bld.SAMBA_BINARY('tdbtortseq',
+                         'tools/tdbtortseq.c',
+                         'tdb',
+                         install=False)
+
         bld.SAMBA_BINARY('tdbrestore',
                          'tools/tdbrestore.c',
                          'tdb', manpages='man/tdbrestore.8')
@@ -175,28 +181,26 @@ def build(bld):
                                  includes='include', install=False)
 
     if not bld.CONFIG_SET('USING_SYSTEM_PYTDB'):
-        for env in bld.gen_python_environments(['PKGCONFIGDIR']):
-            bld.SAMBA_PYTHON('pytdb',
-                             'pytdb.c',
-                             deps='tdb',
-                             enabled=not bld.env.disable_python,
-                             realname='tdb.so',
-                             cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
+        bld.SAMBA_PYTHON('pytdb',
+                         'pytdb.c',
+                         deps='tdb',
+                         enabled=not bld.env.disable_python,
+                         realname='tdb.so',
+                         cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
 
         if not bld.env.disable_python:
-            for env in bld.gen_python_environments(['PKGCONFIGDIR']):
-                bld.SAMBA_SCRIPT('_tdb_text.py',
-                                 pattern='_tdb_text.py',
-                                 installdir='python')
-
-                bld.INSTALL_FILES('${PYTHONARCHDIR}', '_tdb_text.py')
+            bld.SAMBA_SCRIPT('_tdb_text.py',
+                             pattern='_tdb_text.py',
+                             installdir='python')
+            
+            bld.INSTALL_FILES('${PYTHONARCHDIR}', '_tdb_text.py')
 
 def testonly(ctx):
     '''run tdb testsuite'''
-    import Utils, samba_utils, shutil
     ecode = 0
 
-    test_prefix = "%s/st" % (Utils.g_module.blddir)
+    blddir = Context.g_module.out
+    test_prefix = "%s/st" % (blddir)
     shutil.rmtree(test_prefix, ignore_errors=True)
     os.makedirs(test_prefix)
     os.environ['TEST_DATA_PREFIX'] = test_prefix
@@ -210,11 +214,23 @@ def testonly(ctx):
         # Symlink back to source dir so it can find tests in test/
         link = os.path.join(testdir, 'test')
         if not os.path.exists(link):
-            os.symlink(os.path.abspath(os.path.join(env.cwd, 'test')), link)
+            os.symlink(ctx.path.make_node('test').abspath(), link)
+
+        sh_tests = ["test/test_tdbbackup.sh test/jenkins-be-hash.tdb",
+                    "test/test_tdbdump.sh test/sample_tdb.tdb test/sample_tdb.txt test/sample_tdb_x.txt"]
+
+        for sh_test in sh_tests:
+            cmd = "BINDIR=%s %s" % (blddir, sh_test)
+            print("shell test: " + cmd)
+            ret = samba_utils.RUN_COMMAND(cmd)
+            if ret != 0:
+                print("%s sh test failed" % cmd)
+                ecode = ret
+                break
 
         for t in tdb1_unit_tests:
             f = "tdb1-" + t
-            cmd = "cd " + testdir + " && " + os.path.abspath(os.path.join(Utils.g_module.blddir, f)) + " > test-output 2>&1"
+            cmd = "cd " + testdir + " && " + os.path.abspath(os.path.join(blddir, f)) + " > test-output 2>&1"
             print("..." + f)
             ret = samba_utils.RUN_COMMAND(cmd)
             if ret != 0:
@@ -224,7 +240,7 @@ def testonly(ctx):
                 break
 
     if ecode == 0:
-        cmd = os.path.join(Utils.g_module.blddir, 'tdbtorture')
+        cmd = os.path.join(blddir, 'tdbtorture')
         ret = samba_utils.RUN_COMMAND(cmd)
         print("testsuite returned %d" % ret)
         if ret != 0:
@@ -237,9 +253,8 @@ def testonly(ctx):
 # WAF doesn't build the unit tests for this, maybe because they don't link with tdb?
 # This forces it
 def test(ctx):
-    import Scripting
-    Scripting.commands.append('build')
-    Scripting.commands.append('testonly')
+    Options.commands.append('build')
+    Options.commands.append('testonly')
 
 def dist():
     '''makes a tarball for distribution'''
@@ -247,5 +262,4 @@ def dist():
 
 def reconfigure(ctx):
     '''reconfigure if config scripts have changed'''
-    import samba_utils
     samba_utils.reconfigure(ctx)