From 6e18439e29dd8ad58e453801b836b1e0360ab3ca Mon Sep 17 00:00:00 2001 From: Ian Stakenvicius Date: Fri, 27 Jan 2017 13:28:01 -0500 Subject: [PATCH 01/15] waf: disable-python - add option globally to build system This commit adds --disable-python as an option to the build system. It adds PYTHON_BUILD_IS_ENABLED() to bld, to be used with enabled= on other modules, and adjusts SAMBA_PYTHON() to set enabled=False if PYTHON_BUILD_IS_ENABLED() is false. Signed-off-by: Ian Stakenvicius --- buildtools/wafsamba/samba_python.py | 37 +++++++++++++++++++++++++++++++++---- buildtools/wafsamba/wscript | 10 ++++++++++ 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/buildtools/wafsamba/samba_python.py b/buildtools/wafsamba/samba_python.py index 057a017..56cef21 100644 --- a/buildtools/wafsamba/samba_python.py +++ b/buildtools/wafsamba/samba_python.py @@ -4,8 +4,9 @@ import os import Build, Logs, Utils, Configure from Configure import conf + @conf -def SAMBA_CHECK_PYTHON(conf, mandatory=True, version=(2,4,2)): +def SAMBA_CHECK_PYTHON(conf, mandatory=True, version=(2, 4, 2)): # enable tool to build python extensions if conf.env.HAVE_PYTHON_H: conf.check_python_version(version) @@ -40,6 +41,18 @@ def SAMBA_CHECK_PYTHON(conf, mandatory=True, version=(2,4,2)): @conf def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True): + if conf.env.disable_python: + if mandatory: + raise Utils.WafError("Cannot check for python headers when " + "--disable-python specified") + + conf.msg("python headers", "Check disabled due to --disable-python") + # we don't want PYTHONDIR in config.h, as otherwise changing + # --prefix causes a complete rebuild + del(conf.env.defines['PYTHONDIR']) + del(conf.env.defines['PYTHONARCHDIR']) + return + if conf.env["python_headers_checked"] == []: if conf.env['EXTRA_PYTHON']: conf.setenv('extrapython') @@ -54,21 +67,23 @@ def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True): if extraversion == conf.env['PYTHON_VERSION']: raise Utils.WafError("extrapython %s is same as main python %s" % ( extraversion, conf.env['PYTHON_VERSION'])) + else: - conf.msg("python headers", "using cache") + conf.msg("python headers", "using cache") # we don't want PYTHONDIR in config.h, as otherwise changing # --prefix causes a complete rebuild del(conf.env.defines['PYTHONDIR']) del(conf.env.defines['PYTHONARCHDIR']) + def _check_python_headers(conf, mandatory): try: Configure.ConfigurationError conf.check_python_headers(mandatory=mandatory) except Configure.ConfigurationError: if mandatory: - raise + raise if conf.env['PYTHON_VERSION'] > '3': abi_pattern = os.path.splitext(conf.env['pyext_PATTERN'])[0] @@ -77,6 +92,12 @@ def _check_python_headers(conf, mandatory): conf.env['PYTHON_SO_ABI_FLAG'] = '' +def PYTHON_BUILD_IS_ENABLED(self): + return self.CONFIG_SET('HAVE_PYTHON_H') + +Build.BuildContext.PYTHON_BUILD_IS_ENABLED = PYTHON_BUILD_IS_ENABLED + + def SAMBA_PYTHON(bld, name, source='', deps='', @@ -91,6 +112,11 @@ def SAMBA_PYTHON(bld, name, enabled=True): '''build a python extension for Samba''' + # force-disable when we can't build python modules, so + # every single call doesn't need to pass this in. + if not bld.PYTHON_BUILD_IS_ENABLED(): + enabled = False + if bld.env['IS_EXTRA_PYTHON']: name = 'extra-' + name @@ -138,7 +164,10 @@ Build.BuildContext.SAMBA_PYTHON = SAMBA_PYTHON def pyembed_libname(bld, name, extrapython=False): - return name + bld.env['PYTHON_SO_ABI_FLAG'] + if bld.env['PYTHON_SO_ABI_FLAG']: + return name + bld.env['PYTHON_SO_ABI_FLAG'] + else: + return name Build.BuildContext.pyembed_libname = pyembed_libname diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript index fcaaf1b..4eef008 100644 --- a/buildtools/wafsamba/wscript +++ b/buildtools/wafsamba/wscript @@ -196,6 +196,10 @@ def set_options(opt): help='tag release in git at the same time', type='string', action='store', dest='TAG_RELEASE') + opt.add_option('--disable-python', + help='do not generate python modules', + action='store_true', dest='disable_python', default=False) + opt.add_option('--extra-python', type=str, help=("build selected libraries for the specified " "additional version of Python " @@ -279,8 +283,14 @@ def configure(conf): conf.env.AUTOCONF_HOST = Options.options.AUTOCONF_HOST conf.env.AUTOCONF_PROGRAM_PREFIX = Options.options.AUTOCONF_PROGRAM_PREFIX + conf.env.disable_python = Options.options.disable_python + conf.env.EXTRA_PYTHON = Options.options.EXTRA_PYTHON + if (conf.env.disable_python and conf.env.EXTRA_PYTHON): + Logs.error('ERROR: cannot specify both --disable-python and --extra-python.') + sys.exit(1) + if (conf.env.AUTOCONF_HOST and conf.env.AUTOCONF_BUILD and conf.env.AUTOCONF_BUILD != conf.env.AUTOCONF_HOST): -- 2.10.2 From aa45c2ad81f0f3f1243b1d3337fa9f936d4c9368 Mon Sep 17 00:00:00 2001 From: Ian Stakenvicius Date: Fri, 27 Jan 2017 14:07:21 -0500 Subject: [PATCH 02/15] waf: disable-python - configuration adjustments Adjust configuration to accomodate when --disable-python is set: - Error when AD-DC is still enabled (and others later as needed) - Set mandatory=false on SAMBA_CHECK_PYTHON_HEADERS Signed-off-by: Ian Stakenvicius --- wscript | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wscript b/wscript index 407bcdc..4fd56ed 100644 --- a/wscript +++ b/wscript @@ -107,8 +107,12 @@ def configure(conf): conf.SAMBA_CHECK_PERL(mandatory=True) conf.find_program('xsltproc', var='XSLTPROC') + if conf.env.disable_python: + if not (Options.options.without_ad_dc): + raise Utils.WafError('--disable-python requires --without-ad-dc') + conf.SAMBA_CHECK_PYTHON(mandatory=True, version=(2, 6, 0)) - conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=True) + conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=(not conf.env.disable_python)) if sys.platform == 'darwin' and not conf.env['HAVE_ENVIRON_DECL']: # Mac OSX needs to have this and it's also needed that the python is compiled with this -- 2.10.2 From 5d171c688b69227f8bf6b069407b73d778d15d2b Mon Sep 17 00:00:00 2001 From: Ian Stakenvicius Date: Fri, 27 Jan 2017 14:27:50 -0500 Subject: [PATCH 03/15] waf: disable-python - align talloc's wscript Drop the configure option for --disable-python as it is now global in wafsamba If samba is set to use a system copy of talloc, and talloc wasn't built with python support, then the system pytalloc-util will not be found. If samba is being built without python support then pytalloc-util is not needed, so do not bother to try and find it. The build configuration for pytalloc-util needs to exist even if it's not being built, so that dependency resolution can occur throughout the rest of the samba build system -- this required dropping the higher level conditional and using the enabled= parameter instead. Signed-off-by: Ian Stakenvicius --- lib/talloc/wscript | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/talloc/wscript b/lib/talloc/wscript index af93910..df7e6be 100644 --- a/lib/talloc/wscript +++ b/lib/talloc/wscript @@ -32,9 +32,6 @@ def set_options(opt): opt.add_option('--enable-talloc-compat1', help=("Build talloc 1.x.x compat library [False]"), action="store_true", dest='TALLOC_COMPAT1', default=False) - opt.add_option('--disable-python', - help=("disable the pytalloc module"), - action="store_true", dest='disable_python', default=False) def configure(conf): @@ -46,8 +43,6 @@ def configure(conf): conf.define('TALLOC_BUILD_VERSION_MINOR', int(VERSION.split('.')[1])) conf.define('TALLOC_BUILD_VERSION_RELEASE', int(VERSION.split('.')[2])) - conf.env.disable_python = getattr(Options.options, 'disable_python', False) - conf.env.TALLOC_COMPAT1 = False if conf.env.standalone_talloc: conf.env.TALLOC_COMPAT1 = Options.options.TALLOC_COMPAT1 @@ -142,7 +137,7 @@ def build(bld): private_library=private_library, manpages='man/talloc.3') - if not bld.CONFIG_SET('USING_SYSTEM_PYTALLOC_UTIL') and not bld.env.disable_python: + if not bld.CONFIG_SET('USING_SYSTEM_PYTALLOC_UTIL'): for env in bld.gen_python_environments(['PKGCONFIGDIR']): name = bld.pyembed_libname('pytalloc-util') @@ -156,16 +151,19 @@ def build(bld): abi_match='pytalloc_* _pytalloc_*', private_library=private_library, public_headers=('' if private_library else 'pytalloc.h'), - pc_files='pytalloc-util.pc' + pc_files='pytalloc-util.pc', + enabled=bld.PYTHON_BUILD_IS_ENABLED() ) bld.SAMBA_PYTHON('pytalloc', 'pytalloc.c', deps='talloc ' + name, + enabled=bld.PYTHON_BUILD_IS_ENABLED(), realname='talloc.so') bld.SAMBA_PYTHON('test_pytalloc', 'test_pytalloc.c', deps='pytalloc', + enabled=bld.PYTHON_BUILD_IS_ENABLED(), realname='_test_pytalloc.so', install=False) -- 2.10.2 From 5d699ea7db027d6dcba1186c74375a2052d7af20 Mon Sep 17 00:00:00 2001 From: Ian Stakenvicius Date: Fri, 27 Jan 2017 14:34:25 -0500 Subject: [PATCH 04/15] waf: disable-python - align ldb's wscript If samba is set to use a system copy of ldb, and ldb wasn't built with python support, then no system pyldb-util will be found. If samba is being built without python support then pyldb-util isn not needed, so do not bother to try and find it. The system ldb check had to be duplicated due to the earlier commits which changed order of ldb and pyldb-util checks, and by association also added a dependency of pyldb-util onto ldb. This seemed cleaner than messing with variables. The build configuration for pyldb-util needs to exist even if it's not being built, so that dependency resolution can occur throughout the rest of the samba build system -- this required dropping the higher level conditional and using the enabled= parameter instead. Signed-off-by: Ian Stakenvicius --- lib/ldb/wscript | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/lib/ldb/wscript b/lib/ldb/wscript index a12af00..c877f3b 100644 --- a/lib/ldb/wscript +++ b/lib/ldb/wscript @@ -46,7 +46,7 @@ def configure(conf): conf.find_program('xsltproc', var='XSLTPROC') conf.check_tool('python') conf.check_python_version((2,4,2)) - conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=True) + conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=not conf.env.disable_python) # where does the default LIBDIR end up? in conf.env somewhere? # @@ -55,23 +55,30 @@ def configure(conf): conf.env.standalone_ldb = conf.IN_LAUNCH_DIR() if not conf.env.standalone_ldb: - using_system_pyldb_util = True - if not conf.CHECK_BUNDLED_SYSTEM_PKG('pyldb-util', minversion=VERSION, + if conf.env.disable_python: + if conf.CHECK_BUNDLED_SYSTEM_PKG('ldb', minversion=VERSION, + onlyif='talloc tdb tevent', + implied_deps='replace talloc tdb tevent'): + conf.define('USING_SYSTEM_LDB', 1) + else: + using_system_pyldb_util = True + if not conf.CHECK_BUNDLED_SYSTEM_PKG('pyldb-util', minversion=VERSION, onlyif='talloc tdb tevent', implied_deps='replace talloc tdb tevent ldb'): - using_system_pyldb_util = False - - # We need to get a pyldb-util for all the python versions - # we are building for - if conf.env['EXTRA_PYTHON']: - name = 'pyldb-util' + conf.all_envs['extrapython']['PYTHON_SO_ABI_FLAG'] - if not conf.CHECK_BUNDLED_SYSTEM_PKG(name, minversion=VERSION, - onlyif='talloc tdb tevent', - implied_deps='replace talloc tdb tevent ldb'): using_system_pyldb_util = False - if using_system_pyldb_util: - conf.define('USING_SYSTEM_PYLDB_UTIL', 1) + # We need to get a pyldb-util for all the python versions + # we are building for + if conf.env['EXTRA_PYTHON']: + name = 'pyldb-util' + conf.all_envs['extrapython']['PYTHON_SO_ABI_FLAG'] + if not conf.CHECK_BUNDLED_SYSTEM_PKG(name, minversion=VERSION, + onlyif='talloc tdb tevent', + implied_deps='replace talloc tdb tevent ldb'): + using_system_pyldb_util = False + + if using_system_pyldb_util: + conf.define('USING_SYSTEM_PYLDB_UTIL', 1) + if conf.CHECK_BUNDLED_SYSTEM_PKG('ldb', minversion=VERSION, onlyif='talloc tdb tevent pyldb-util', implied_deps='replace talloc tdb tevent'): @@ -125,7 +132,7 @@ def build(bld): internal_module=False, subsystem='ldb') - if not bld.env.disable_python: + if bld.PYTHON_BUILD_IS_ENABLED(): if not bld.CONFIG_SET('USING_SYSTEM_PYLDB_UTIL'): for env in bld.gen_python_environments(['PKGCONFIGDIR']): # we're not currently linking against the ldap libs, but ldb.pc.in @@ -146,6 +153,7 @@ def build(bld): private_library=private_library, pc_files='pyldb-util.pc', pyembed=True, + enabled=bld.PYTHON_BUILD_IS_ENABLED(), abi_directory='ABI', abi_match='pyldb_*') @@ -155,7 +163,7 @@ def build(bld): realname='ldb.so', cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION) - for env in bld.gen_python_environments(['PKGCONFIGDIR']): + for env in bld.gen_python_environments(['PKGCONFIGDIR']): bld.SAMBA_SCRIPT('_ldb_text.py', pattern='_ldb_text.py', installdir='python') -- 2.10.2 From 985865fa86a259d60a8b5bedabaa7cdbc29b473f Mon Sep 17 00:00:00 2001 From: Ian Stakenvicius Date: Fri, 27 Jan 2017 14:37:39 -0500 Subject: [PATCH 05/15] waf: disable-python - align tevent wscript Drop the configure option for --disable-python as it is now global in wafsamba. If samba is set to use a system copy of tevent, and tevent wasn't built with python support, then the system pytevent will not be found. If samba is being built without python support then pytevent is not needed, so do not bother to try and find it. Signed-off-by: Ian Stakenvicius --- lib/tevent/wscript | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/tevent/wscript b/lib/tevent/wscript index 580ca4d..0c02f70 100644 --- a/lib/tevent/wscript +++ b/lib/tevent/wscript @@ -22,10 +22,6 @@ def set_options(opt): opt.PRIVATE_EXTENSION_DEFAULT('tevent', noextension='tevent') opt.RECURSE('lib/replace') opt.RECURSE('lib/talloc') - if opt.IN_LAUNCH_DIR(): - opt.add_option('--disable-python', - help=("disable the pytevent module"), - action="store_true", dest='disable_python', default=False) def configure(conf): @@ -38,7 +34,8 @@ def configure(conf): if conf.CHECK_BUNDLED_SYSTEM_PKG('tevent', minversion=VERSION, onlyif='talloc', implied_deps='replace talloc'): conf.define('USING_SYSTEM_TEVENT', 1) - if conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytevent', 'tevent', minversion=VERSION): + if not conf.env.disable_python and \ + conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytevent', 'tevent', minversion=VERSION): conf.define('USING_SYSTEM_PYTEVENT', 1) if conf.CHECK_FUNCS('epoll_create', headers='sys/epoll.h'): @@ -61,8 +58,6 @@ def configure(conf): if not conf.CONFIG_SET('USING_SYSTEM_TEVENT'): conf.DEFINE('TEVENT_NUM_SIGNALS', tevent_num_signals) - conf.env.disable_python = getattr(Options.options, 'disable_python', False) - if not conf.env.disable_python: # also disable if we don't have the python libs installed conf.find_program('python', var='PYTHON') -- 2.10.2 From 2995f8c35f682a5db16e8425404235d6edce90e6 Mon Sep 17 00:00:00 2001 From: Ian Stakenvicius Date: Fri, 27 Jan 2017 14:42:05 -0500 Subject: [PATCH 06/15] waf: disable-python - align tdb's wscript Drop the configure option for --disable-python as it is now global in wafsamba. If samba is set to use a system copy of tdb, and tdb wasn't built with python support, then the system pytevent will not be found. If samba is being built without python support then pytdb is not needed, so do not bother to try and find it. Signed-off-by: Ian Stakenvicius --- lib/tdb/wscript | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/tdb/wscript b/lib/tdb/wscript index 34058e4..0d682eb 100644 --- a/lib/tdb/wscript +++ b/lib/tdb/wscript @@ -60,10 +60,6 @@ def set_options(opt): help=("Disable the use of pthread robust mutexes"), action="store_true", dest='disable_tdb_mutex_locking', default=False) - if opt.IN_LAUNCH_DIR(): - opt.add_option('--disable-python', - help=("disable the pytdb module"), - action="store_true", dest='disable_python', default=False) def configure(conf): @@ -82,11 +78,10 @@ def configure(conf): implied_deps='replace'): conf.define('USING_SYSTEM_TDB', 1) conf.env.building_tdb = False - if conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytdb', 'tdb', minversion=VERSION): + if not conf.env.disable_python and \ + conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytdb', 'tdb', minversion=VERSION): conf.define('USING_SYSTEM_PYTDB', 1) - conf.env.disable_python = getattr(Options.options, 'disable_python', False) - if (conf.CONFIG_SET('HAVE_ROBUST_MUTEXES') and conf.env.building_tdb and not conf.env.disable_tdb_mutex_locking): -- 2.10.2 From a46de87bd4abf136e32c6371ca147741208bcfcc Mon Sep 17 00:00:00 2001 From: Ian Stakenvicius Date: Fri, 27 Jan 2017 16:38:36 -0500 Subject: [PATCH 07/15] waf: disable-python - don't build python/ Signed-off-by: Ian Stakenvicius --- python/wscript_build | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/python/wscript_build b/python/wscript_build index fa3b8b5..87da26f 100644 --- a/python/wscript_build +++ b/python/wscript_build @@ -5,7 +5,8 @@ bld.SAMBA_LIBRARY('samba_python', deps='LIBPYTHON pytalloc-util pyrpc_util', grouping_library=True, private_library=True, - pyembed=True) + pyembed=True, + enabled=bld.PYTHON_BUILD_IS_ENABLED()) bld.SAMBA_SUBSYSTEM('LIBPYTHON', source='modules.c', @@ -13,7 +14,7 @@ bld.SAMBA_SUBSYSTEM('LIBPYTHON', init_function_sentinel='{NULL,NULL}', deps='talloc', pyext=True, - ) + enabled=bld.PYTHON_BUILD_IS_ENABLED()) for env in bld.gen_python_environments(): pytalloc_util = bld.pyembed_libname('pytalloc-util') @@ -25,7 +26,8 @@ for env in bld.gen_python_environments(): realname='samba/_glue.so' ) -for env in bld.gen_python_environments(): +if bld.PYTHON_BUILD_IS_ENABLED(): + for env in bld.gen_python_environments(): # install out various python scripts for use by make test bld.SAMBA_SCRIPT('samba_python_files', pattern='samba/**/*.py', -- 2.10.2 From d26b140d96614cb60a07116e6755c73b4cfd2a9c Mon Sep 17 00:00:00 2001 From: Ian Stakenvicius Date: Fri, 27 Jan 2017 16:49:29 -0500 Subject: [PATCH 08/15] waf: disable-python - don't build PROVISION, pyparam_util Signed-off-by: Ian Stakenvicius --- source4/param/wscript_build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source4/param/wscript_build b/source4/param/wscript_build index b7a551f..4a2b3b1 100644 --- a/source4/param/wscript_build +++ b/source4/param/wscript_build @@ -4,6 +4,7 @@ bld.SAMBA_SUBSYSTEM('PROVISION', source='provision.c pyparam.c', deps='LIBPYTHON pyparam_util ldb pytalloc-util pyldb-util', pyext=True, + enabled=bld.PYTHON_BUILD_IS_ENABLED(), ) @@ -48,8 +49,9 @@ for env in bld.gen_python_environments(): bld.SAMBA_SUBSYSTEM(pyparam_util, source='pyparam_util.c', deps='LIBPYTHON samba-hostconfig %s' % pytalloc_util, - pyext=True - ) + pyext=True, + enabled=bld.PYTHON_BUILD_IS_ENABLED() + ) bld.SAMBA_SUBSYSTEM('param_options', source='loadparm.c', -- 2.10.2 From 64995c6a08f4357cfe5162932413c5c613edb816 Mon Sep 17 00:00:00 2001 From: Ian Stakenvicius Date: Fri, 27 Jan 2017 17:04:18 -0500 Subject: [PATCH 09/15] waf: disable-python - don't build pyrpc_util, dcerpc.py Signed-off-by: Ian Stakenvicius --- source4/librpc/wscript_build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source4/librpc/wscript_build b/source4/librpc/wscript_build index 07625cd..5d01cca 100644 --- a/source4/librpc/wscript_build +++ b/source4/librpc/wscript_build @@ -183,6 +183,7 @@ for env in bld.gen_python_environments(): source='rpc/pyrpc_util.c', public_deps='%s %s dcerpc MESSAGING' % (pytalloc_util, pyparam_util), pyext=True, + enabled=bld.PYTHON_BUILD_IS_ENABLED(), ) bld.SAMBA_PYTHON('python_dcerpc', @@ -393,9 +394,10 @@ bld.SAMBA_PYTHON('python_dcerpc_smb_acl', realname='samba/dcerpc/smb_acl.so' ) -bld.SAMBA_SCRIPT('python_dcerpc_init', +if bld.PYTHON_BUILD_IS_ENABLED(): + bld.SAMBA_SCRIPT('python_dcerpc_init', pattern='rpc/dcerpc.py', installdir='python/samba/dcerpc', installname='__init__.py') -bld.INSTALL_FILES('${PYTHONARCHDIR}/samba/dcerpc', 'rpc/dcerpc.py', destname='__init__.py') + bld.INSTALL_FILES('${PYTHONARCHDIR}/samba/dcerpc', 'rpc/dcerpc.py', destname='__init__.py') -- 2.10.2 From 39151a8304f5c9435448f19f25096ad218ad1284 Mon Sep 17 00:00:00 2001 From: Ian Stakenvicius Date: Fri, 27 Jan 2017 21:31:21 -0500 Subject: [PATCH 10/15] waf: disable-python - don't build samba-net samba-net requires PROVISION, which is disabled when python isn't available. Signed-off-by: Ian Stakenvicius --- source4/libnet/wscript_build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source4/libnet/wscript_build b/source4/libnet/wscript_build index db113b2..e192eb5 100644 --- a/source4/libnet/wscript_build +++ b/source4/libnet/wscript_build @@ -4,7 +4,8 @@ bld.SAMBA_LIBRARY('samba-net', source='libnet.c libnet_passwd.c libnet_time.c libnet_rpc.c libnet_join.c libnet_site.c libnet_become_dc.c libnet_unbecome_dc.c libnet_vampire.c libnet_samdump.c libnet_samsync_ldb.c libnet_user.c libnet_group.c libnet_share.c libnet_lookup.c libnet_domain.c userinfo.c groupinfo.c userman.c groupman.c prereq_domain.c libnet_samsync.c', autoproto='libnet_proto.h', public_deps='samba-credentials dcerpc dcerpc-samr RPC_NDR_LSA RPC_NDR_SRVSVC RPC_NDR_DRSUAPI cli_composite LIBCLI_RESOLVE LIBCLI_FINDDCS cli_cldap LIBCLI_FINDDCS gensec_schannel LIBCLI_AUTH ndr smbpasswdparser PROVISION LIBCLI_SAMSYNC LIBTSOCKET', - private_library=True + private_library=True, + enabled=bld.PYTHON_BUILD_IS_ENABLED() ) -- 2.10.2 From 5f5b8dd2666afa398c721ce9f6dac10a2d04ace4 Mon Sep 17 00:00:00 2001 From: Ian Stakenvicius Date: Fri, 27 Jan 2017 21:32:22 -0500 Subject: [PATCH 11/15] waf: disable-python - don't build samba-policy samba-policy requires samba-net which requires PROVISION, which is disabled when python isn't available. Signed-off-by: Ian Stakenvicius --- source4/lib/policy/wscript_build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source4/lib/policy/wscript_build b/source4/lib/policy/wscript_build index b8ba638..f7c5909 100644 --- a/source4/lib/policy/wscript_build +++ b/source4/lib/policy/wscript_build @@ -6,7 +6,8 @@ bld.SAMBA_LIBRARY('samba-policy', public_deps='ldb samba-net', vnum='0.0.1', pyembed=True, - public_headers='policy.h' + public_headers='policy.h', + enabled=bld.PYTHON_BUILD_IS_ENABLED() ) bld.SAMBA_PYTHON('py_policy', -- 2.10.2 From ec91a7e3f1e1842ae423b0241147ad78b5835c6b Mon Sep 17 00:00:00 2001 From: Ian Stakenvicius Date: Fri, 27 Jan 2017 22:53:39 -0500 Subject: [PATCH 12/15] waf: disable-python - don't build torture bits samba-net being disabled causes a chain of dependency or proto.h-based missing code issues that require a number of modules or subsystems to be disabled in samba4/torture. Signed-off-by: Ian Stakenvicius --- source4/torture/drs/wscript_build | 3 ++- source4/torture/local/wscript_build | 3 ++- source4/torture/wscript_build | 28 +++++++++++++++++++--------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/source4/torture/drs/wscript_build b/source4/torture/drs/wscript_build index cfdd8a2..67bf034 100644 --- a/source4/torture/drs/wscript_build +++ b/source4/torture/drs/wscript_build @@ -6,6 +6,7 @@ bld.SAMBA_MODULE('TORTURE_DRS', subsystem='smbtorture', init_function='torture_drs_init', deps='samba-util ldb POPT_SAMBA samba-errors torture ldbsamba talloc dcerpc ndr NDR_DRSUAPI gensec samba-hostconfig RPC_NDR_DRSUAPI DSDB_MODULE_HELPERS asn1util samdb NDR_DRSBLOBS samba-credentials samdb-common LIBCLI_RESOLVE LP_RESOLVE torturemain', - internal_module=True + internal_module=True, + enabled=bld.PYTHON_BUILD_IS_ENABLED() ) diff --git a/source4/torture/local/wscript_build b/source4/torture/local/wscript_build index 3a12b6b..087b842 100644 --- a/source4/torture/local/wscript_build +++ b/source4/torture/local/wscript_build @@ -32,5 +32,6 @@ bld.SAMBA_MODULE('TORTURE_LOCAL', subsystem='smbtorture', init_function='torture_local_init', deps=TORTURE_LOCAL_DEPS, - internal_module=True + internal_module=True, + enabled=bld.PYTHON_BUILD_IS_ENABLED() ) diff --git a/source4/torture/wscript_build b/source4/torture/wscript_build index c065eaa..fe06629 100644 --- a/source4/torture/wscript_build +++ b/source4/torture/wscript_build @@ -14,7 +14,8 @@ bld.SAMBA_MODULE('TORTURE_BASIC', deps='LIBCLI_SMB popt POPT_CREDENTIALS TORTURE_UTIL smbclient-raw TORTURE_RAW', internal_module=True, autoproto='basic/proto.h', - init_function='torture_base_init' + init_function='torture_base_init', + enabled=bld.PYTHON_BUILD_IS_ENABLED() ) @@ -24,7 +25,8 @@ bld.SAMBA_MODULE('TORTURE_RAW', subsystem='smbtorture', init_function='torture_raw_init', deps='LIBCLI_SMB LIBCLI_LSA LIBCLI_SMB_COMPOSITE popt POPT_CREDENTIALS TORTURE_UTIL', - internal_module=True + internal_module=True, + enabled=bld.PYTHON_BUILD_IS_ENABLED() ) bld.RECURSE('smb2') @@ -67,7 +69,8 @@ bld.SAMBA_SUBSYSTEM('TORTURE_NDR', ndr/charset.c ''', autoproto='ndr/proto.h', - deps='torture krb5samba' + deps='torture krb5samba', + enabled=bld.PYTHON_BUILD_IS_ENABLED() ) torture_rpc_backupkey = '' @@ -181,7 +184,8 @@ bld.SAMBA_MODULE('torture_rpc', RPC_NDR_BACKUPKEY RPC_NDR_WINSPOOL ''' + ntvfs_specific['deps'], - internal_module=True) + internal_module=True, + enabled=bld.PYTHON_BUILD_IS_ENABLED()) bld.RECURSE('drs') bld.RECURSE('dns') @@ -192,7 +196,8 @@ bld.SAMBA_MODULE('TORTURE_RAP', subsystem='smbtorture', init_function='torture_rap_init', deps='TORTURE_UTIL LIBCLI_SMB NDR_RAP LIBCLI_RAP', - internal_module=True + internal_module=True, + enabled=bld.PYTHON_BUILD_IS_ENABLED() ) bld.SAMBA_MODULE('TORTURE_DFS', @@ -252,7 +257,8 @@ bld.SAMBA_MODULE('TORTURE_NBT', subsystem='smbtorture', init_function='torture_nbt_init', deps='LIBCLI_SMB cli-nbt LIBCLI_DGRAM LIBCLI_WREPL torture_rpc', - internal_module=True + internal_module=True, + enabled=bld.PYTHON_BUILD_IS_ENABLED() ) @@ -262,7 +268,8 @@ bld.SAMBA_MODULE('TORTURE_NET', subsystem='smbtorture', init_function='torture_net_init', deps='samba-net popt POPT_CREDENTIALS torture_rpc PROVISION', - internal_module=True + internal_module=True, + enabled=bld.PYTHON_BUILD_IS_ENABLED() ) @@ -272,7 +279,8 @@ bld.SAMBA_MODULE('TORTURE_NTP', subsystem='smbtorture', init_function='torture_ntp_init', deps='popt POPT_CREDENTIALS torture_rpc', - internal_module=True + internal_module=True, + enabled=bld.PYTHON_BUILD_IS_ENABLED() ) bld.SAMBA_MODULE('TORTURE_VFS', @@ -290,6 +298,7 @@ bld.SAMBA_SUBSYSTEM('torturemain', source='smbtorture.c torture.c shell.c', subsystem_name='smbtorture', deps='torture popt POPT_SAMBA POPT_CREDENTIALS dcerpc LIBCLI_SMB SMBREADLINE ' + TORTURE_MODULES, + enabled=bld.PYTHON_BUILD_IS_ENABLED() ) bld.SAMBA_BINARY('smbtorture', @@ -297,7 +306,8 @@ bld.SAMBA_BINARY('smbtorture', manpages='man/smbtorture.1', private_headers='smbtorture.h', deps='torturemain torture popt POPT_SAMBA POPT_CREDENTIALS dcerpc LIBCLI_SMB SMBREADLINE ' + TORTURE_MODULES, - pyembed=True + pyembed=True, + enabled=bld.PYTHON_BUILD_IS_ENABLED() ) bld.SAMBA_BINARY('gentest', -- 2.10.2 From 01b3080a7068ceb0d32fc4df6da9508acd8e765c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 30 Jan 2017 09:36:31 -0500 Subject: [PATCH 13/15] autobuild: Add nopython environment to test --disable-python builds (but without tests) This ensures we keep this option building as we extend our use of python. The rule is that new features and changes to existing features that require python are most welcome, they just need to be disabled for the minimalistic targets we still ecourage Samba on, that typically just want smbd --- .travis.yml | 1 + script/autobuild.py | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 483ad50..ce0e745 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ env: - TASK=samba-libs - TASK=samba-static - TASK=samba-o3 + - TASK=samba-nopython - TASK=ldb - TASK=tdb - TASK=talloc diff --git a/script/autobuild.py b/script/autobuild.py index 76b70fd..1e12d69 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -32,6 +32,7 @@ builddirs = { "samba-static" : ".", "samba-test-only" : ".", "samba-systemkrb5" : ".", + "samba-nopython" : ".", "ldb" : "lib/ldb", "tdb" : "lib/tdb", "talloc" : "lib/talloc", @@ -43,7 +44,7 @@ builddirs = { "retry" : "." } -defaulttasks = [ "ctdb", "samba", "samba-xc", "samba-o3", "samba-ctdb", "samba-libs", "samba-static", "samba-systemkrb5", "ldb", "tdb", "talloc", "replace", "tevent", "pidl" ] +defaulttasks = [ "ctdb", "samba", "samba-xc", "samba-o3", "samba-ctdb", "samba-libs", "samba-static", "samba-systemkrb5", "samba-nopython", "ldb", "tdb", "talloc", "replace", "tevent", "pidl" ] if os.environ.get("AUTOBUILD_SKIP_SAMBA_O3", "0") == "1": defaulttasks.remove("samba-o3") @@ -178,6 +179,21 @@ tasks = { ("clean", "make clean", "text/plain") ], + # Test Samba without python still builds. When this test fails + # due to more use of Python, the expectations is that the newly + # failing part of the code should be disabled when + # --disable-python is set (rather than major work being done to + # support this environment). The target here is for vendors + # shipping a minimal smbd. + "samba-nopython" : [ + ("random-sleep", "script/random-sleep.sh 60 600", "text/plain"), + ("configure", "./configure.developer --picky-developer ${PREFIX} --with-profiling-data --disable-python --without-ad-dc", "text/plain"), + ("make", "make -j", "text/plain"), + ("install", "make install", "text/plain"), + ("check-clean-tree", "script/clean-source-tree.sh", "text/plain"), + ("clean", "make clean", "text/plain") + ], + "ldb" : [ -- 2.10.2 From 3421fdd89b0aeae3e983975a3263c645be8bb82a Mon Sep 17 00:00:00 2001 From: Ian Stakenvicius Date: Mon, 30 Jan 2017 10:11:46 -0500 Subject: [PATCH 14/15] waf: disable-python - don't include python.h in test_headers.c Signed-off-by: Ian Stakenvicius --- testsuite/headers/test_headers.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testsuite/headers/test_headers.c b/testsuite/headers/test_headers.c index a36575f..4e63e99 100644 --- a/testsuite/headers/test_headers.c +++ b/testsuite/headers/test_headers.c @@ -23,7 +23,9 @@ #define _GNU_SOURCE 1 -#include +#ifdef HAVE_PYTHON_H +# include +#endif #include #include #include -- 2.10.2 From 7416024dc992ed60527f4a0db4a78c8408947524 Mon Sep 17 00:00:00 2001 From: Ian Stakenvicius Date: Thu, 23 Feb 2017 10:16:25 -0500 Subject: [PATCH 15/15] waf: disable-python - fix ctdb configuration When ctdb is built in standalone mode, it turned off the python requirement for submodules by setting Options.options.disable_python to True before checking for its own (non-optional) python support. Ad ctdb does not need python for itself or any of the submodules it is built against, the safest solution seems to be to allow the python and python-headers checks to not find python. Signed-off-by: Ian Stakenvicius --- ctdb/wscript | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ctdb/wscript b/ctdb/wscript index 4c8db60..9e99fa2 100644 --- a/ctdb/wscript +++ b/ctdb/wscript @@ -107,8 +107,8 @@ def configure(conf): if conf.env.standalone_ctdb: conf.SAMBA_CHECK_PERL(mandatory=True) - conf.SAMBA_CHECK_PYTHON(mandatory=True, version=(2,5,0)) - conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=True) + conf.SAMBA_CHECK_PYTHON(mandatory=False, version=(2,5,0)) + conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False) if conf.CHECK_FOR_THIRD_PARTY(): conf.RECURSE('third_party/popt') -- 2.10.2