Fix error codes to match Windows NFS Server behavior
[gd/samba/.git] / wscript
diff --git a/wscript b/wscript
index 5e775ebd2dd0783e32876d0d5ab411967eb4d8fa..d5de9cca27029862f1e4e9dd5a99c7b7d0b6187f 100644 (file)
--- a/wscript
+++ b/wscript
@@ -45,7 +45,6 @@ def options(opt):
     opt.RECURSE('pidl')
     opt.RECURSE('source3')
     opt.RECURSE('lib/util')
-    opt.RECURSE('lib/crypto')
     opt.RECURSE('ctdb')
 
 # Optional Libraries
@@ -116,7 +115,15 @@ def options(opt):
                   help=("Disable RELRO builds"),
                   action="store_false", dest='enable_relro')
 
-    gr = opt.option_group('developer options')
+    opt.add_option('--with-kernel-keyring',
+                  help=('Enable kernely keyring support for credential storage ' +
+                        '(default if keyutils libraries are available)'),
+                  action='store_true', dest='enable_keyring')
+    opt.add_option('--without-kernel-keyring',
+                  help=('Disable kernely keyring support for credential storage'),
+                  action='store_false', dest='enable_keyring')
+
+    opt.option_group('developer options')
 
     opt.load('python') # options for disabling pyc or pyo compilation
     # enable options related to building python extensions
@@ -200,6 +207,13 @@ def configure(conf):
                    mandatory=True)
     conf.CHECK_FUNCS_IN('inflateInit2', 'z')
 
+    if Options.options.enable_keyring is not False:
+        conf.env['WITH_KERNEL_KEYRING'] = 'auto'
+        if Options.options.enable_keyring is True:
+            conf.env['WITH_KERNEL_KEYRING'] = True
+    else:
+        conf.env['WITH_KERNEL_KEYRING'] = False
+
     if conf.CHECK_FOR_THIRD_PARTY():
         conf.RECURSE('third_party')
     else:
@@ -305,12 +319,12 @@ def configure(conf):
 
     conf.RECURSE('source4/dsdb/samdb/ldb_modules')
     conf.RECURSE('source4/ntvfs/sysdep')
+    conf.RECURSE('source4/torture/nfs')
     conf.RECURSE('lib/util')
     conf.RECURSE('lib/util/charset')
     conf.RECURSE('source4/auth')
     conf.RECURSE('nsswitch')
     conf.RECURSE('libcli/smbreadline')
-    conf.RECURSE('lib/crypto')
     conf.RECURSE('pidl')
     if conf.CONFIG_GET('ENABLE_SELFTEST'):
         if not (Options.options.without_ad_dc):
@@ -326,13 +340,13 @@ def configure(conf):
 
     conf.SET_TARGET_TYPE('jansson', 'EMPTY')
 
-    if Options.options.with_json != False:
+    if Options.options.with_json is not False:
         if conf.CHECK_CFG(package='jansson', args='--cflags --libs',
                           msg='Checking for jansson'):
             conf.CHECK_FUNCS_IN('json_object', 'jansson')
 
     if not conf.CONFIG_GET('HAVE_JSON_OBJECT'):
-        if Options.options.with_json != False:
+        if Options.options.with_json is not False:
             conf.fatal("Jansson JSON support not found. "
                        "Try installing libjansson-dev or jansson-devel. "
                        "Otherwise, use --without-json to build without "
@@ -348,12 +362,14 @@ def configure(conf):
 
     conf.RECURSE('source3')
     conf.RECURSE('lib/texpect')
+    conf.RECURSE('lib/tsocket')
     conf.RECURSE('python')
     if conf.env.with_ctdb:
         conf.RECURSE('ctdb')
     conf.RECURSE('lib/socket')
     conf.RECURSE('lib/mscat')
     conf.RECURSE('packaging')
+    conf.RECURSE('lib/krb5_wrap')
 
     conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
 
@@ -375,8 +391,8 @@ def configure(conf):
                            msg='Checking configure summary'):
         raise Errors.WafError('configure summary failed')
 
-    if Options.options.enable_pie != False:
-        if Options.options.enable_pie == True:
+    if Options.options.enable_pie is not False:
+        if Options.options.enable_pie is True:
                 need_pie = True
         else:
                 # not specified, only build PIEs if supported by compiler
@@ -385,8 +401,8 @@ def configure(conf):
                          msg="Checking compiler for PIE support"):
             conf.env['ENABLE_PIE'] = True
 
-    if Options.options.enable_relro != False:
-        if Options.options.enable_relro == True:
+    if Options.options.enable_relro is not False:
+        if Options.options.enable_relro is True:
             need_relro = True
         else:
             # not specified, only build RELROs if supported by compiler
@@ -396,13 +412,13 @@ def configure(conf):
             conf.env['ENABLE_RELRO'] = True
 
     if conf.CONFIG_GET('ENABLE_SELFTEST') and \
-       Options.options.with_smb1server == False and \
-       Options.options.without_ad_dc != True:
+       Options.options.with_smb1server is False and \
+       Options.options.without_ad_dc is not True:
         conf.fatal('--without-smb1-server cannot be specified with '
                    '--enable-selftest/--enable-developer if '
                    '--without-ad-dc is NOT set!')
 
-    if Options.options.with_smb1server != False:
+    if Options.options.with_smb1server is not False:
         conf.DEFINE('WITH_SMB1SERVER', '1')
 
     #
@@ -437,9 +453,8 @@ def configure(conf):
 
 def etags(ctx):
     '''build TAGS file using etags'''
-    from waflib import Utils
     source_root = os.path.dirname(Context.g_module.root_path)
-    cmd = 'rm -f %s/TAGS && (find %s -name "*.[ch]" | egrep -v \.inst\. | xargs -n 100 etags -a)' % (source_root, source_root)
+    cmd = r'rm -f %s/TAGS && (find %s -name "*.[ch]" | egrep -v \.inst\. | xargs -n 100 etags -a)' % (source_root, source_root)
     print("Running: %s" % cmd)
     status = os.system(cmd)
     if os.WEXITSTATUS(status):
@@ -447,9 +462,8 @@ def etags(ctx):
 
 def ctags(ctx):
     "build 'tags' file using ctags"
-    from waflib import Utils
     source_root = os.path.dirname(Context.g_module.root_path)
-    cmd = 'ctags --python-kinds=-i $(find %s -name "*.[ch]" | grep -v "*_proto\.h" | egrep -v \.inst\.) $(find %s -name "*.py")' % (source_root, source_root)
+    cmd = r'ctags --python-kinds=-i $(find %s -name "*.[ch]" | grep -v "*_proto\.h" | egrep -v \.inst\.) $(find %s -name "*.py")' % (source_root, source_root)
     print("Running: %s" % cmd)
     status = os.system(cmd)
     if os.WEXITSTATUS(status):
@@ -463,28 +477,6 @@ def build(bld):
     samba_version.load_version(env=bld.env, is_install=bld.is_install)
 
 
-def pydoctor(ctx):
-    '''build python apidocs'''
-    bp = os.path.abspath('bin/python')
-    mpaths = {}
-    modules = ['talloc', 'tdb', 'ldb']
-    for m in modules:
-        f = os.popen("PYTHONPATH=%s python -c 'import %s; print %s.__file__'" % (bp, m, m), 'r')
-        try:
-            mpaths[m] = f.read().strip()
-        finally:
-            f.close()
-    mpaths['main'] = bp
-    cmd = ('PYTHONPATH=%(main)s pydoctor --introspect-c-modules --project-name=Samba '
-           '--project-url=http://www.samba.org --make-html --docformat=restructuredtext '
-           '--add-package bin/python/samba ' + ''.join('--add-module %s ' % n for n in modules))
-    cmd = cmd % mpaths
-    print("Running: %s" % cmd)
-    status = os.system(cmd)
-    if os.WEXITSTATUS(status):
-        raise Errors.WafError('pydoctor failed')
-
-
 def pep8(ctx):
     '''run pep8 validator'''
     cmd='PYTHONPATH=bin/python pep8 -r bin/python/samba'
@@ -494,21 +486,6 @@ def pep8(ctx):
         raise Errors.WafError('pep8 failed')
 
 
-def wafdocs(ctx):
-    '''build wafsamba apidocs'''
-    from samba_utils import recursive_dirlist
-    os.system('pwd')
-    list = recursive_dirlist('../buildtools/wafsamba', '.', pattern='*.py')
-
-    print(list)
-    cmd='PYTHONPATH=bin/python pydoctor --project-name=wafsamba --project-url=http://www.samba.org --make-html --docformat=restructuredtext' +\
-        "".join(' --add-module %s' % f for f in list)
-    print("Running: %s" % cmd)
-    status = os.system(cmd)
-    if os.WEXITSTATUS(status):
-        raise Errors.WafError('wafdocs failed')
-
-
 def dist():
     '''makes a tarball for distribution'''
     sambaversion = samba_version.load_version(env=None)
@@ -540,6 +517,11 @@ def distcheck():
     '''test that distribution tarball builds and installs'''
     samba_version.load_version(env=None)
 
+def printversion(ctx):
+    '''print version'''
+    ver = samba_version.load_version(env=None)
+    print('Samba Version: ' + ver.STRING_WITH_NICKNAME)
+
 def wildcard_cmd(cmd):
     '''called on a unknown command'''
     from samba_wildcard import run_named_build_task
@@ -553,7 +535,6 @@ Scripting.main = main
 
 def reconfigure(ctx):
     '''reconfigure if config scripts have changed'''
-    import samba_utils
     samba_utils.reconfigure(ctx)