python:tests: Store keys as bytes rather than as lists of ints
[Samba.git] / wscript
blobc833764e8fe97dcea50438603b774817379eba3e
1 #!/usr/bin/env python
3 top = '.'
4 out = 'bin'
6 APPNAME='samba'
7 VERSION=None
9 import sys, os, tempfile
10 sys.path.insert(0, top+"/buildtools/wafsamba")
11 import shutil
12 import wafsamba, samba_dist, samba_git, samba_version, samba_utils
13 from waflib import Options, Scripting, Logs, Context, Errors
14 from waflib.Tools import bison
16 samba_dist.DIST_DIRS('.')
17 samba_dist.DIST_BLACKLIST('.gitignore .bzrignore source4/selftest/provisions')
19 DEFAULT_PRIVATE_LIBS = ["ldb"]
21 # install in /usr/local/samba by default
22 default_prefix = Options.default_prefix = '/usr/local/samba'
24 # This callback optionally takes a list of paths as arguments:
25 # --with-system_mitkrb5 /path/to/krb5 /another/path
26 def system_mitkrb5_callback(option, opt, value, parser):
27 setattr(parser.values, option.dest, True)
28 value = []
29 for arg in parser.rargs:
30 # stop on --foo like options
31 if arg[:2] == "--" and len(arg) > 2:
32 break
33 value.append(arg)
34 if len(value)>0:
35 del parser.rargs[:len(value)]
36 setattr(parser.values, option.dest, value)
38 def options(opt):
39 opt.BUILTIN_DEFAULT('NONE')
40 opt.PRIVATE_EXTENSION_DEFAULT('private-samba')
41 opt.RECURSE('lib/replace')
42 opt.RECURSE('dynconfig')
43 opt.RECURSE('packaging')
44 opt.RECURSE('lib/ldb')
45 opt.RECURSE('selftest')
46 opt.RECURSE('source4/dsdb/samdb/ldb_modules')
47 opt.RECURSE('pidl')
48 opt.RECURSE('source3')
49 opt.RECURSE('lib/util')
50 opt.RECURSE('ctdb')
52 # Optional Libraries
53 # ------------------
55 # Most of the calls to opt.add_option() use default=True for the --with case
57 # To assist users and distributors to build Samba with the full feature
58 # set, the build system will abort if our dependent libraries and their
59 # header files are not found on the target system. This will mean for
60 # example, that xattr, acl and ldap headers must be installed for the
61 # default build to complete. The configure system will check for these
62 # headers, and the error message will indicate the option (such as
63 # --without-acl-support) that can be specified to skip this requirement.
65 # This will assist users and in particular distributors in building fully
66 # functional packages, while allowing those on systems truly without these
67 # facilities to continue to build Samba after careful consideration.
69 # It also ensures our container image generation in bootstrap/ is correct
70 # as otherwise a missing package there would just silently work
72 opt.samba_add_onoff_option('pthreadpool', with_name="enable", without_name="disable", default=True)
74 opt.add_option('--with-system-mitkrb5',
75 help='build Samba with system MIT Kerberos. ' +
76 'You may specify list of paths where Kerberos is installed (e.g. /usr/local /usr/kerberos) to search krb5-config',
77 action='callback', callback=system_mitkrb5_callback, dest='with_system_mitkrb5', default=False)
79 opt.add_option('--with-experimental-mit-ad-dc',
80 help='Enable the experimental MIT Kerberos-backed AD DC. ' +
81 'Note that security patches are not issued for this configuration',
82 action='store_true',
83 dest='with_experimental_mit_ad_dc',
84 default=False)
86 opt.add_option('--with-system-mitkdc',
87 help=('Specify the path to the krb5kdc binary from MIT Kerberos'),
88 type="string",
89 dest='with_system_mitkdc',
90 default=None)
92 opt.add_option('--with-system-heimdalkrb5',
93 help=('build Samba with system Heimdal Kerberos. ' +
94 'Requires --without-ad-dc' and
95 'conflicts with --with-system-mitkrb5'),
96 action='store_true',
97 dest='with_system_heimdalkrb5',
98 default=False)
100 opt.add_option('--without-ad-dc',
101 help='disable AD DC functionality (enables only Samba FS (File Server, Winbind, NMBD) and client utilities.',
102 action='store_true', dest='without_ad_dc', default=False)
104 opt.add_option('--with-pie',
105 help=("Build Position Independent Executables " +
106 "(default if supported by compiler)"),
107 action="store_true", dest='enable_pie')
108 opt.add_option('--without-pie',
109 help=("Disable Position Independent Executable builds"),
110 action="store_false", dest='enable_pie')
112 opt.add_option('--with-relro',
113 help=("Build with full RELocation Read-Only (RELRO)" +
114 "(default if supported by compiler)"),
115 action="store_true", dest='enable_relro')
116 opt.add_option('--without-relro',
117 help=("Disable RELRO builds"),
118 action="store_false", dest='enable_relro')
120 opt.add_option('--with-kernel-keyring',
121 help=('Enable kernely keyring support for credential storage ' +
122 '(default if keyutils libraries are available)'),
123 action='store_true', dest='enable_keyring')
124 opt.add_option('--without-kernel-keyring',
125 help=('Disable kernely keyring support for credential storage'),
126 action='store_false', dest='enable_keyring')
128 opt.samba_add_onoff_option('ldap')
130 opt.option_group('developer options')
132 opt.load('python') # options for disabling pyc or pyo compilation
133 # enable options related to building python extensions
135 opt.add_option('--with-json',
136 action='store_true', dest='with_json',
137 help=("Build with JSON support (default=True). This "
138 "requires the jansson development headers."))
139 opt.add_option('--without-json',
140 action='store_false', dest='with_json',
141 help=("Build without JSON support."))
143 opt.samba_add_onoff_option('smb1-server',
144 dest='with_smb1server',
145 help=("Build smbd with SMB1 support (default=yes)."))
147 def configure(conf):
148 version = samba_version.load_version(env=conf.env)
150 conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
151 conf.DEFINE('_SAMBA_BUILD_', version.MAJOR, add_to_cflags=True)
152 conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
154 if Options.options.developer:
155 conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
156 conf.env.DEVELOPER = True
157 # if we are in a git tree without a pre-commit hook, install a
158 # simple default.
159 # we need git for 'waf dist'
160 githooksdir = None
161 conf.find_program('git', var='GIT')
162 if 'GIT' in conf.env:
163 githooksdir = conf.CHECK_COMMAND('%s rev-parse --git-path hooks' % conf.env.GIT[0],
164 msg='Finding githooks directory',
165 define=None,
166 on_target=False)
167 if githooksdir and os.path.isdir(githooksdir):
168 pre_commit_hook = os.path.join(githooksdir, 'pre-commit')
169 if not os.path.exists(pre_commit_hook):
170 Logs.info("Installing script/git-hooks/pre-commit-hook as %s" %
171 pre_commit_hook)
172 shutil.copy(os.path.join(Context.g_module.top, 'script/git-hooks/pre-commit-hook'),
173 pre_commit_hook)
175 conf.ADD_EXTRA_INCLUDES('#include/public #source4 #lib #source4/lib #source4/include #include #lib/replace')
177 conf.env.replace_add_global_pthread = True
178 conf.RECURSE('lib/replace')
180 conf.RECURSE('examples/fuse')
181 conf.RECURSE('examples/winexe')
183 conf.SAMBA_CHECK_PERL(mandatory=True)
184 conf.CHECK_XSLTPROC_MANPAGES()
186 if conf.env.disable_python:
187 if not (Options.options.without_ad_dc):
188 raise Errors.WafError('--disable-python requires --without-ad-dc')
190 conf.SAMBA_CHECK_PYTHON()
191 conf.SAMBA_CHECK_PYTHON_HEADERS()
193 if sys.platform == 'darwin' and not conf.env['HAVE_ENVIRON_DECL']:
194 # Mac OSX needs to have this and it's also needed that the python is compiled with this
195 # otherwise you face errors about common symbols
196 if not conf.CHECK_SHLIB_W_PYTHON("Checking if -fno-common is needed"):
197 conf.ADD_CFLAGS('-fno-common')
198 if not conf.CHECK_SHLIB_W_PYTHON("Checking if -undefined dynamic_lookup is not need"):
199 conf.env.append_value('cshlib_LINKFLAGS', ['-undefined', 'dynamic_lookup'])
201 if sys.platform == 'darwin':
202 conf.ADD_LDFLAGS('-framework CoreFoundation')
204 conf.RECURSE('dynconfig')
205 conf.RECURSE('selftest')
207 conf.PROCESS_SEPARATE_RULE('system_gnutls')
209 conf.CHECK_CFG(package='zlib', minversion='1.2.3',
210 args='--cflags --libs',
211 mandatory=True)
212 conf.CHECK_FUNCS_IN('inflateInit2', 'z')
214 if Options.options.enable_keyring is not False:
215 conf.env['WITH_KERNEL_KEYRING'] = 'auto'
216 if Options.options.enable_keyring is True:
217 conf.env['WITH_KERNEL_KEYRING'] = True
218 else:
219 conf.env['WITH_KERNEL_KEYRING'] = False
221 if conf.CHECK_FOR_THIRD_PARTY():
222 conf.RECURSE('third_party')
223 else:
225 if not conf.CHECK_POPT():
226 raise Errors.WafError('popt development packages have not been found.\nIf third_party is installed, check that it is in the proper place.')
227 else:
228 conf.define('USING_SYSTEM_POPT', 1)
230 if not conf.CHECK_CMOCKA():
231 raise Errors.WafError('cmocka development packages has not been found.\nIf third_party is installed, check that it is in the proper place.')
232 else:
233 conf.define('USING_SYSTEM_CMOCKA', 1)
235 if conf.CONFIG_GET('ENABLE_SELFTEST'):
236 if not conf.CHECK_SOCKET_WRAPPER():
237 raise Errors.WafError('socket_wrapper package has not been found.\nIf third_party is installed, check that it is in the proper place.')
238 else:
239 conf.define('USING_SYSTEM_SOCKET_WRAPPER', 1)
241 if not conf.CHECK_NSS_WRAPPER():
242 raise Errors.WafError('nss_wrapper package has not been found.\nIf third_party is installed, check that it is in the proper place.')
243 else:
244 conf.define('USING_SYSTEM_NSS_WRAPPER', 1)
246 if not conf.CHECK_RESOLV_WRAPPER():
247 raise Errors.WafError('resolv_wrapper package has not been found.\nIf third_party is installed, check that it is in the proper place.')
248 else:
249 conf.define('USING_SYSTEM_RESOLV_WRAPPER', 1)
251 if not conf.CHECK_UID_WRAPPER():
252 raise Errors.WafError('uid_wrapper package has not been found.\nIf third_party is installed, check that it is in the proper place.')
253 else:
254 conf.define('USING_SYSTEM_UID_WRAPPER', 1)
256 if not conf.CHECK_PAM_WRAPPER():
257 raise Errors.WafError('pam_wrapper package has not been found.\nIf third_party is installed, check that it is in the proper place.')
258 else:
259 conf.define('USING_SYSTEM_PAM_WRAPPER', 1)
261 # Check for LDAP
262 if Options.options.with_ldap:
263 conf.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
264 conf.CHECK_TYPE('ber_tag_t', 'unsigned int', headers='ldap.h lber.h')
265 conf.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
266 conf.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers='ldap.h')
268 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
269 # for the samba logs
270 conf.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
271 define='HAVE_LBER_LOG_PRINT_FN', headers='lber.h')
273 conf.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
274 conf.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
276 # Check if ldap_set_rebind_proc() takes three arguments
277 if conf.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
278 'LDAP_SET_REBIND_PROC_ARGS',
279 msg="Checking whether ldap_set_rebind_proc takes 3 arguments",
280 headers='ldap.h lber.h', link=False):
281 conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
282 else:
283 conf.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
285 # last but not least, if ldap_init() exists, we want to use ldap
286 if conf.CONFIG_SET('HAVE_LDAP_INIT') and conf.CONFIG_SET('HAVE_LDAP_H'):
287 conf.DEFINE('HAVE_LDAP', '1')
288 conf.DEFINE('LDAP_DEPRECATED', '1')
289 conf.env['HAVE_LDAP'] = '1'
290 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
291 # SASL wrapping hooks
292 if conf.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
293 conf.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
294 conf.DEFINE('HAVE_LDAP_TRANSPORT_WRAPPING', 1)
295 conf.env.ENABLE_LDAP_BACKEND = True
296 else:
297 conf.fatal("LDAP support not found. "
298 "Try installing libldap2-dev or openldap-devel. "
299 "Otherwise, use --without-ldap to build without "
300 "LDAP support. "
301 "LDAP support is required for the LDAP passdb backend, "
302 "LDAP idmap backends and ADS. "
303 "ADS support improves communication with "
304 "Active Directory domain controllers.")
305 else:
306 conf.SET_TARGET_TYPE('ldap', 'EMPTY')
307 conf.SET_TARGET_TYPE('lber', 'EMPTY')
309 conf.RECURSE('lib/tdb')
310 conf.RECURSE('lib/tevent')
311 conf.RECURSE('lib/ldb')
313 if conf.CHECK_LDFLAGS(['-Wl,--wrap=test']):
314 conf.env['HAVE_LDWRAP'] = True
315 conf.define('HAVE_LDWRAP', 1)
317 if not (Options.options.without_ad_dc):
318 conf.DEFINE('AD_DC_BUILD_IS_ENABLED', 1)
320 # Check for flex before doing the embedded heimdal checks so we can bail if we don't have it.
321 Logs.info("Checking for flex")
322 conf.find_program('flex', var='FLEX')
323 if conf.env['FLEX']:
324 conf.CHECK_COMMAND('%s --version' % conf.env.FLEX[0],
325 msg='Using flex version',
326 define=None,
327 on_target=False)
328 conf.env.FLEXFLAGS = ['-t']
330 # #line statements in these generated files cause issues for lcov
331 conf.env.FLEXFLAGS += ["--noline"]
333 Logs.info("Checking for bison")
334 bison.configure(conf)
335 if conf.env['BISON']:
336 conf.CHECK_COMMAND('%s --version | head -n1' % conf.env.BISON[0],
337 msg='Using bison version',
338 define=None,
339 on_target=False)
341 # #line statements in these generated files cause issues for lcov
342 conf.env.BISONFLAGS += ["--no-line"]
344 if Options.options.with_system_mitkrb5:
345 if not Options.options.with_experimental_mit_ad_dc and \
346 not Options.options.without_ad_dc:
347 raise Errors.WafError('The MIT Kerberos build of Samba as an AD DC ' +
348 'is experimental. Therefore '
349 '--with-system-mitkrb5 requires either ' +
350 '--with-experimental-mit-ad-dc or ' +
351 '--without-ad-dc')
353 conf.PROCESS_SEPARATE_RULE('system_mitkrb5')
355 if not (Options.options.without_ad_dc or Options.options.with_system_mitkrb5):
356 conf.DEFINE('AD_DC_BUILD_IS_ENABLED', 1)
358 if Options.options.with_system_heimdalkrb5:
359 if Options.options.with_system_mitkrb5:
360 raise Errors.WafError('--with-system-heimdalkrb5 conflicts with ' +
361 '--with-system-mitkrb5')
362 if not Options.options.without_ad_dc:
363 raise Errors.WafError('--with-system-heimdalkrb5 requires ' +
364 '--without-ad-dc')
365 conf.env.SYSTEM_LIBS += ('heimdal', 'asn1', 'com_err', 'roken',
366 'hx509', 'wind', 'gssapi', 'hcrypto',
367 'krb5', 'heimbase', 'asn1_compile',
368 'compile_et', 'kdc', 'hdb', 'heimntlm')
369 conf.PROCESS_SEPARATE_RULE('system_heimdal')
371 if not conf.CONFIG_GET('KRB5_VENDOR'):
372 conf.PROCESS_SEPARATE_RULE('embedded_heimdal')
374 conf.RECURSE('source4/dsdb/samdb/ldb_modules')
375 conf.RECURSE('source4/ntvfs/sysdep')
376 conf.RECURSE('lib/util')
377 conf.RECURSE('lib/util/charset')
378 conf.RECURSE('source4/auth')
379 conf.RECURSE('nsswitch')
380 conf.RECURSE('libcli/smbreadline')
381 conf.RECURSE('pidl')
382 if conf.CONFIG_GET('ENABLE_SELFTEST'):
383 if not (Options.options.without_ad_dc):
384 conf.DEFINE('WITH_NTVFS_FILESERVER', 1)
385 conf.RECURSE('testsuite/unittests')
387 if Options.options.with_pthreadpool:
388 if conf.CONFIG_SET('HAVE_PTHREAD'):
389 conf.DEFINE('WITH_PTHREADPOOL', '1')
390 else:
391 Logs.warn("pthreadpool support cannot be enabled when pthread support was not found")
392 conf.undefine('WITH_PTHREADPOOL')
394 conf.SET_TARGET_TYPE('jansson', 'EMPTY')
396 if Options.options.with_json is not False:
397 if conf.CHECK_CFG(package='jansson', args='--cflags --libs',
398 msg='Checking for jansson'):
399 conf.CHECK_FUNCS_IN('json_object', 'jansson')
401 if not conf.CONFIG_GET('HAVE_JSON_OBJECT'):
402 if Options.options.with_json is not False:
403 conf.fatal("Jansson JSON support not found. "
404 "Try installing libjansson-dev or jansson-devel. "
405 "Otherwise, use --without-json to build without "
406 "JSON support. "
407 "JSON support is required for the JSON "
408 "formatted audit log feature, the AD DC, and "
409 "the JSON printers of the net utility")
410 if not Options.options.without_ad_dc:
411 raise Errors.WafError('--without-json requires --without-ad-dc. '
412 'Jansson JSON library is required for '
413 'building the AD DC')
414 Logs.info("Building without Jansson JSON log support")
416 conf.RECURSE('source3')
417 conf.RECURSE('lib/texpect')
418 conf.RECURSE('lib/tsocket')
419 conf.RECURSE('python')
420 if conf.env.with_ctdb:
421 conf.RECURSE('ctdb')
422 conf.RECURSE('lib/socket')
423 conf.RECURSE('lib/mscat')
424 conf.RECURSE('packaging')
425 conf.RECURSE('lib/krb5_wrap')
427 conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
429 # gentoo always adds this. We want our normal build to be as
430 # strict as the strictest OS we support, so adding this here
431 # allows us to find problems on our development hosts faster.
432 # It also results in faster load time.
434 if (not Options.options.address_sanitizer
435 and conf.CHECK_LDFLAGS('-Wl,--as-needed')):
436 conf.env.append_unique('LINKFLAGS', '-Wl,--as-needed')
438 if not conf.CHECK_NEED_LC("-lc not needed"):
439 conf.ADD_LDFLAGS('-lc', testflags=False)
441 if not conf.CHECK_CODE('#include "tests/summary.c"',
442 define='SUMMARY_PASSES',
443 addmain=False,
444 msg='Checking configure summary'):
445 raise Errors.WafError('configure summary failed')
447 if Options.options.enable_pie is not False:
448 if Options.options.enable_pie is True:
449 need_pie = True
450 else:
451 # not specified, only build PIEs if supported by compiler
452 need_pie = False
453 if conf.check_cc(cflags='-fPIE', ldflags='-pie', mandatory=need_pie,
454 msg="Checking compiler for PIE support"):
455 conf.env['ENABLE_PIE'] = True
457 if Options.options.enable_relro is not False:
458 if Options.options.enable_relro is True:
459 need_relro = True
460 else:
461 # not specified, only build RELROs if supported by compiler
462 need_relro = False
463 if conf.check_cc(cflags='', ldflags='-Wl,-z,relro,-z,now', mandatory=need_relro,
464 msg="Checking compiler for full RELRO support"):
465 conf.env['ENABLE_RELRO'] = True
467 if conf.CONFIG_GET('ENABLE_SELFTEST') and \
468 Options.options.with_smb1server is False and \
469 Options.options.without_ad_dc is not True:
470 conf.fatal('--without-smb1-server cannot be specified with '
471 '--enable-selftest/--enable-developer if '
472 '--without-ad-dc is NOT set!')
474 if Options.options.with_smb1server is not False:
475 conf.DEFINE('WITH_SMB1SERVER', '1')
478 # FreeBSD is broken. It doesn't include 'extern char **environ'
479 # in any shared library, but statically inside crt0.o.
481 # If we're running on a FreeBSD with the GNU linker ld we
482 # can get around this by explicitly telling the linker to
483 # ignore 'environ' as an unresolved symbol in a shared library.
485 # However, the clang linker ld.lld-XX is broken in that it
486 # doesn't have that option.
488 # First try to see if have '-Wl,--ignore-unresolved-symbol,environ'
489 # and just use that if so.
491 # If not, we have to use '-Wl,--allow-shlib-undefined' instead
492 # and remove all instances of '-Wl,-no-undefined'.
494 if sys.platform.startswith('freebsd'):
495 # Do we have Wl,--ignore-unresolved-symbol,environ ?
496 flag_added = conf.ADD_LDFLAGS('-Wl,--ignore-unresolved-symbol,environ', testflags=True)
497 if not flag_added:
498 # No, fall back to -Wl,--allow-shlib-undefined.
499 conf.ADD_LDFLAGS('-Wl,--allow-shlib-undefined', testflags=True)
500 # Remove any uses of '-Wl,-no-undefined'
501 conf.env['EXTRA_LDFLAGS'] = list(filter(('-Wl,-no-undefined').__ne__, conf.env['EXTRA_LDFLAGS']))
502 # And make sure we don't try and remove it again when 'allow_undefined_symbols=true'
503 conf.env.undefined_ldflags = []
505 conf.SAMBA_CONFIG_H('include/config.h')
507 def etags(ctx):
508 '''build TAGS file using etags'''
509 source_root = os.path.dirname(Context.g_module.root_path)
510 cmd = r'rm -f %s/TAGS && (find %s -name "*.[ch]" | egrep -v \.inst\. | xargs -n 100 etags -a)' % (source_root, source_root)
511 print("Running: %s" % cmd)
512 status = os.system(cmd)
513 if os.WEXITSTATUS(status):
514 raise Errors.WafError('etags failed')
516 def ctags(ctx):
517 "build 'tags' file using ctags"
518 source_root = os.path.dirname(Context.g_module.root_path)
519 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)
520 print("Running: %s" % cmd)
521 status = os.system(cmd)
522 if os.WEXITSTATUS(status):
523 raise Errors.WafError('ctags failed')
526 # putting this here enabled build in the list
527 # of commands in --help
528 def build(bld):
529 '''build all targets'''
530 samba_version.load_version(env=bld.env, is_install=bld.is_install)
533 def pep8(ctx):
534 '''run pep8 validator'''
535 cmd='PYTHONPATH=bin/python pep8 -r bin/python/samba'
536 print("Running: %s" % cmd)
537 status = os.system(cmd)
538 if os.WEXITSTATUS(status):
539 raise Errors.WafError('pep8 failed')
542 def dist():
543 '''makes a tarball for distribution'''
544 sambaversion = samba_version.load_version(env=None)
546 os.system("make -C ctdb manpages")
547 samba_dist.DIST_FILES('ctdb/doc:ctdb/doc', extend=True)
549 os.system("DOC_VERSION='" + sambaversion.STRING + "' " + Context.g_module.top + "/release-scripts/build-manpages-nogit")
550 samba_dist.DIST_FILES('bin/docs:docs', extend=True)
552 if sambaversion.IS_SNAPSHOT:
553 # write .distversion file and add to tar
554 if not os.path.isdir(Context.g_module.out):
555 os.makedirs(Context.g_module.out)
556 distversionf = tempfile.NamedTemporaryFile(mode='w', prefix='.distversion',dir=Context.g_module.out)
557 for field in sambaversion.vcs_fields:
558 distveroption = field + '=' + str(sambaversion.vcs_fields[field])
559 distversionf.write(distveroption + '\n')
560 distversionf.flush()
561 samba_dist.DIST_FILES('%s:.distversion' % distversionf.name, extend=True)
563 samba_dist.dist()
564 distversionf.close()
565 else:
566 samba_dist.dist()
569 def distcheck():
570 '''test that distribution tarball builds and installs'''
571 samba_version.load_version(env=None)
573 def printversion(ctx):
574 '''print version'''
575 ver = samba_version.load_version(env=None)
576 print('Samba Version: ' + ver.STRING_WITH_NICKNAME)
578 def wildcard_cmd(cmd):
579 '''called on a unknown command'''
580 from samba_wildcard import run_named_build_task
581 run_named_build_task(cmd)
583 def main():
584 from samba_wildcard import wildcard_main
586 wildcard_main(wildcard_cmd)
587 Scripting.main = main
589 def reconfigure(ctx):
590 '''reconfigure if config scripts have changed'''
591 samba_utils.reconfigure(ctx)
594 if os.path.isdir(os.path.join(top, ".git")):
595 # Check if there are submodules that are checked out but out of date.
596 for submodule, status in samba_git.read_submodule_status(top):
597 if status == "out-of-date":
598 raise Errors.WafError("some submodules are out of date. Please run 'git submodule update'")