]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib/tdb/wscript: update to handle waf 2.0.4
authorAlexander Bokovoy <ab@samba.org>
Fri, 2 Feb 2018 14:34:31 +0000 (16:34 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 5 Sep 2018 04:37:23 +0000 (06:37 +0200)
Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
buildtools/wafsamba/samba_utils.py
lib/tdb/wscript

index a2afbbf9b66e105a084fa92ea1f8949fe72de987..ed5ce7fc410d808a1b39d5b363ed334022d0da53 100644 (file)
@@ -378,7 +378,7 @@ def RUN_COMMAND(cmd,
 def RUN_PYTHON_TESTS(testfiles, pythonpath=None, extra_env=None):
     env = LOAD_ENVIRONMENT()
     if pythonpath is None:
-        pythonpath = os.path.join(Context.g_module.blddir, 'python')
+        pythonpath = os.path.join(Context.g_module.out, 'python')
     result = 0
     for interp in env.python_interpreters:
         if not isinstance(interp, str):
@@ -465,7 +465,7 @@ def RECURSE(ctx, directory):
     if os.path.exists(d):
         abspath = os.path.abspath(d)
     else:
-        abspath = os.path.abspath(os.path.join(Context.g_module.srcdir, directory))
+        abspath = os.path.abspath(os.path.join(Context.g_module.top, directory))
     ctxclass = ctx.__class__.__name__
     key = ctxclass + ':' + abspath
     if key in visited_dirs:
index 073c53e42d48efdfa2eb15d654343c95e8d0db54..6ffca9e34b7ea87aa08a095b609ce387a8030983 100644 (file)
@@ -3,17 +3,20 @@
 APPNAME = 'tdb'
 VERSION = '1.3.16'
 
-blddir = 'bin'
-
 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')
 
@@ -54,7 +57,7 @@ tdb1_unit_tests = [
     'run-mutex1',
 ]
 
-def set_options(opt):
+def options(opt):
     opt.BUILTIN_DEFAULT('replace')
     opt.PRIVATE_EXTENSION_DEFAULT('tdb', noextension='tdb')
     opt.RECURSE('lib/replace')
@@ -194,10 +197,10 @@ def build(bld):
 
 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
@@ -216,7 +219,7 @@ def testonly(ctx):
         sh_tests = ["test/test_tdbbackup.sh test/jenkins-be-hash.tdb"]
 
         for sh_test in sh_tests:
-            cmd = "BINDIR={} {}".format(Utils.g_module.blddir, sh_test)
+            cmd = "BINDIR={} {}".format(blddir, sh_test)
             print("shell test: " + cmd)
             ret = samba_utils.RUN_COMMAND(cmd)
             if ret != 0:
@@ -226,7 +229,7 @@ def testonly(ctx):
 
         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:
@@ -236,7 +239,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:
@@ -249,7 +252,6 @@ 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 Options
     Options.commands.append('build')
     Options.commands.append('testonly')
 
@@ -259,5 +261,4 @@ def dist():
 
 def reconfigure(ctx):
     '''reconfigure if config scripts have changed'''
-    import samba_utils
     samba_utils.reconfigure(ctx)