9 # find the buildtools directory
11 while not os
.path
.exists(srcdir
+'/buildtools') and len(srcdir
.split('/')) < 5:
12 srcdir
= srcdir
+ '/..'
13 sys
.path
.insert(0, srcdir
+ '/buildtools/wafsamba')
15 import wafsamba
, samba_dist
, Options
, Logs
, Utils
16 import samba_utils
, samba_version
18 env
= samba_utils
.LOAD_ENVIRONMENT()
19 if os
.path
.isfile('./VERSION'):
21 elif os
.path
.isfile('../VERSION'):
24 Logs
.error("VERSION file not found")
26 version
= samba_version
.samba_version_file('%s/VERSION' % vdir
, vdir
, env
)
27 VERSION
= version
.STRING
.replace('-', '.')
29 Options
.default_prefix
= '/usr/local'
31 samba_dist
.DIST_DIRS('''ctdb:. lib/replace:lib/replace lib/talloc:lib/talloc
32 lib/tevent:lib/tevent lib/tdb:lib/tdb
33 lib/socket_wrapper:lib/socket_wrapper
34 third_party/popt:third_party/popt
35 lib/util:lib/util lib/tdb_wrap:lib/tdb_wrap
36 lib/ccan:lib/ccan libcli/util:libcli/util
37 buildtools:buildtools''')
41 opt
.PRIVATE_EXTENSION_DEFAULT('ctdb')
43 opt
.RECURSE('lib/replace')
45 opt
.RECURSE('lib/util')
47 opt
.RECURSE('lib/talloc')
48 opt
.RECURSE('lib/tevent')
49 opt
.RECURSE('lib/tdb')
51 opt
.add_option('--enable-infiniband',
52 help=("Turn on infiniband support (default=no)"),
53 action
="store_true", dest
='ctdb_infiniband', default
=False)
54 opt
.add_option('--enable-pmda',
55 help=("Turn on PCP pmda support (default=no)"),
56 action
="store_true", dest
='ctdb_pmda', default
=False)
58 opt
.add_option('--with-logdir',
59 help=("Path to log directory"),
60 action
="store", dest
='ctdb_logdir', default
=None)
61 opt
.add_option('--with-socketpath',
62 help=("path to CTDB daemon socket"),
63 action
="store_true", dest
='ctdb_sockpath', default
=False)
68 # CTDB relies on nested event loops
69 conf
.env
.TEVENT_DEPRECATED
= 1
71 # No need to build python bindings for talloc/tevent/tdb
72 if conf
.IN_LAUNCH_DIR():
73 Options
.options
.disable_python
= True
75 conf
.RECURSE('lib/replace')
77 conf
.SAMBA_CHECK_PERL(mandatory
=True)
79 conf
.SAMBA_CHECK_PYTHON(mandatory
=True, version
=(2,5,0))
80 conf
.SAMBA_CHECK_PYTHON_HEADERS(mandatory
=True)
82 if conf
.CHECK_FOR_THIRD_PARTY():
83 conf
.RECURSE('third_party/popt')
85 if not conf
.CHECK_POPT():
86 raise Utils
.WafError('popt development packages have not been found\nIf third_party is installed, check that it is in the proper place.')
88 conf
.define('USING_SYSTEM_POPT', 1)
90 conf
.RECURSE('lib/util')
92 conf
.RECURSE('lib/talloc')
93 conf
.RECURSE('lib/tevent')
94 conf
.RECURSE('lib/tdb')
95 conf
.RECURSE('lib/socket_wrapper')
97 conf
.CHECK_HEADERS('sched.h')
98 conf
.CHECK_HEADERS('procinfo.h')
99 if sys
.platform
.startswith('aix') and not conf
.CHECK_FUNCS('thread_setsched'):
100 Logs
.error('Need thread_setsched() on AIX')
102 elif not conf
.CHECK_FUNCS('sched_setscheduler'):
103 Logs
.error('Need sched_setscheduler()')
105 conf
.CHECK_FUNCS('mlockall')
107 if not conf
.CHECK_VARIABLE('ETIME', headers
='errno.h'):
108 conf
.DEFINE('ETIME', 'ETIMEDOUT')
110 if sys
.platform
.startswith('linux'):
111 conf
.SET_TARGET_TYPE('pcap', 'EMPTY')
113 if not conf
.CHECK_HEADERS('pcap.h'):
114 Logs
.error('Need libpcap')
116 if not conf
.CHECK_FUNCS_IN('pcap_open_live', 'pcap', headers
='pcap.h'):
117 Logs
.error('Need libpcap')
120 if not conf
.CHECK_FUNCS_IN('backtrace backtrace_symbols', 'execinfo',
121 checklibc
=True, headers
='execinfo.h'):
122 Logs
.error('backtrace support not available')
125 if Options
.options
.ctdb_pmda
:
128 if not conf
.CHECK_HEADERS('pcp/pmapi.h pcp/impl.h pcp/pmda.h',
131 if not conf
.CHECK_FUNCS_IN('pmProgname', 'pcp'):
133 if not conf
.CHECK_FUNCS_IN('pmdaDaemon', 'pcp_pmda'):
138 Logs
.error("PMDA support not available")
140 Logs
.info('Building with PMDA support')
141 conf
.define('HAVE_PMDA', 1)
142 conf
.env
.CTDB_PMDADIR
= os
.path
.join(conf
.env
.LOCALSTATEDIR
,
143 'lib/pcp/pmdas/ctdb')
145 have_infiniband
= False
146 if Options
.options
.ctdb_infiniband
:
149 if not conf
.CHECK_HEADERS('infiniband/verbs.h rdma/rdma_cma.h'):
151 if not conf
.CHECK_FUNCS_IN('ibv_create_qp', 'ibverbs'):
153 if not conf
.CHECK_FUNCS_IN('rdma_connect', 'rdmacm'):
156 have_infiniband
= True
158 Logs
.error("Infiniband support not available")
160 Logs
.info('Building with Infiniband support')
161 conf
.define('HAVE_INFINIBAND', 1)
162 conf
.define('USE_INFINIBAND', 1)
164 conf
.env
.CTDB_BINDIR
= os
.path
.join(conf
.env
.EXEC_PREFIX
, 'bin')
165 conf
.env
.CTDB_ETCDIR
= os
.path
.join(conf
.env
.SYSCONFDIR
, 'ctdb')
166 conf
.env
.CTDB_VARDIR
= os
.path
.join(conf
.env
.LOCALSTATEDIR
, 'lib/ctdb')
167 conf
.env
.CTDB_RUNDIR
= os
.path
.join(conf
.env
.LOCALSTATEDIR
, 'run/ctdb')
169 if Options
.options
.ctdb_logdir
:
170 conf
.env
.CTDB_LOGDIR
= Options
.options
.ctdb_logdir
172 conf
.env
.CTDB_LOGDIR
= os
.path
.join(conf
.env
.LOCALSTATEDIR
, 'log')
174 if Options
.options
.ctdb_sockpath
:
175 conf
.env
.CTDB_SOCKPATH
= Options
.options
.ctdb_sockpath
177 conf
.env
.CTDB_SOCKPATH
= os
.path
.join(conf
.env
.CTDB_RUNDIR
,
180 conf
.ADD_CFLAGS('''-DBINDIR=\"%s\"
185 -DCTDB_RUNDIR=\"%s\"''' % (
186 conf
.env
.CTDB_BINDIR
,
187 conf
.env
.CTDB_LOGDIR
,
188 conf
.env
.CTDB_SOCKPATH
,
189 conf
.env
.CTDB_ETCDIR
,
190 conf
.env
.CTDB_VARDIR
,
191 conf
.env
.CTDB_RUNDIR
))
193 conf
.env
.CTDB_TEST_DATADIR
= os
.path
.join(conf
.env
.EXEC_PREFIX
,
195 conf
.env
.CTDB_TEST_LIBDIR
= os
.path
.join(conf
.env
.LIBDIR
, 'ctdb-tests')
197 # Allow unified compilation and separate compilation of utilities
200 # Building from tarball
201 conf
.ADD_EXTRA_INCLUDES('#include')
202 conf
.ADD_EXTRA_INCLUDES('#include/internal')
204 # Building standalone CTDB from within Samba tree
205 conf
.ADD_EXTRA_INCLUDES('#ctdb/include')
206 conf
.ADD_EXTRA_INCLUDES('#ctdb/include/internal')
207 conf
.ADD_EXTRA_INCLUDES('#ctdb')
208 conf
.ADD_EXTRA_INCLUDES('#lib #lib/replace')
210 conf
.SET_TARGET_TYPE('systemd-daemon', 'EMPTY')
212 del(conf
.env
.defines
['PYTHONDIR'])
213 del(conf
.env
.defines
['PYTHONARCHDIR'])
215 conf
.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags
=True)
216 conf
.DEFINE('SAMBA_UTIL_CORE_ONLY', 1, add_to_cflags
=True)
217 conf
.SAMBA_CONFIG_H()
221 t
= bld
.SAMBA_GENERATOR('ctdb-version-header',
222 target
='include/ctdb_version.h',
223 rule
='../packaging/mkversion.sh ${TGT} %s' % (VERSION
),
224 dep_vars
=['VERSION'])
225 t
.env
.VERSION
= VERSION
227 version_h
= samba_utils
.os_path_relpath(os
.path
.join(Options
.launch_dir
,
230 t
.bld
.SAMBA_GENERATOR('ctdb-samba-version-header',
232 rule
='printf "#include \\"ctdb_version.h\\" \\n#define SAMBA_VERSION_STRING CTDB_VERSION_STRING\\n" > ${TGT}',
233 dep_vars
=['VERSION'])
234 t
.env
.VERSION
= VERSION
236 bld
.RECURSE('lib/replace')
237 if bld
.CHECK_FOR_THIRD_PARTY():
238 bld
.RECURSE('third_party/popt')
240 bld
.RECURSE('lib/tdb_wrap')
241 bld
.RECURSE('lib/util')
243 bld
.RECURSE('lib/talloc')
244 bld
.RECURSE('lib/tevent')
245 bld
.RECURSE('lib/tdb')
246 bld
.RECURSE('lib/socket_wrapper')
248 # When a combined build is implemented, CTDB will wanted to build
249 # against samba-util rather than samba-util-core. Similarly,
250 # other Samba subsystems expect samba-util. So, for a standalone
251 # build, just define a fake samba-util subsystem that pulls in
253 bld
.SAMBA_SUBSYSTEM('samba-util',
255 deps
='samba-util-core')
257 bld
.SAMBA_SUBSYSTEM('ctdb-tcp',
258 source
=bld
.SUBDIR('tcp',
259 'tcp_connect.c tcp_init.c tcp_io.c'),
260 includes
='include include/internal',
261 deps
='replace tdb talloc tevent')
264 if bld
.env
.HAVE_INFINIBAND
:
265 bld
.SAMBA_SUBSYSTEM('ctdb-ib',
266 source
=bld
.SUBDIR('ib',
267 '''ibwrapper.c ibw_ctdb.c
269 includes
='include include/internal',
271 ib_deps
= ' ctdb-ib rdmacm ibverbs'
273 bld
.SAMBA_SUBSYSTEM('ctdb-common',
274 source
=bld
.SUBDIR('common',
275 '''ctdb_io.c ctdb_util.c ctdb_ltdb.c
276 ctdb_message.c cmdline.c rb_tree.c
277 system_common.c ctdb_fork.c'''),
278 includes
='include include/internal common .',
279 deps
='replace popt talloc tevent tdb popt')
281 bld
.SAMBA_SUBSYSTEM('ctdb-common-util',
282 source
=bld
.SUBDIR('common',
283 'system_util.c ctdb_logging.c'),
284 includes
='include include/internal',
285 deps
='replace tevent tdb')
287 if sys
.platform
.startswith('linux'):
288 CTDB_SYSTEM_SRC
= bld
.SUBDIR('common', 'system_linux.c')
289 elif sys
.platform
.startswith('aix'):
290 CTDB_SYSTEM_SRC
= bld
.SUBDIR('common', 'system_aix.c')
291 elif sys
.platform
.startswith('freebsd'):
292 CTDB_SYSTEM_SRC
= bld
.SUBDIR('common', 'system_freebsd.c')
293 elif sys
.platform
== 'kfreebsd':
294 CTDB_SYSTEM_SRC
= bld
.SUBDIR('common', 'system_kfreebsd.c')
295 elif sys
.platform
== 'gnu':
296 CTDB_SYSTEM_SRC
= bld
.SUBDIR('common', 'system_gnu.c')
298 Logs
.error("Platform %s not supported" % sys
.platform
)
300 bld
.SAMBA_SUBSYSTEM('ctdb-system',
301 source
=CTDB_SYSTEM_SRC
,
302 includes
='include include/internal',
303 deps
='replace talloc tevent tdb pcap')
305 bld
.SAMBA_SUBSYSTEM('ctdb-client',
306 source
=bld
.SUBDIR('client', 'ctdb_client.c'),
307 includes
='include include/internal',
308 public_headers
='include/ctdb_client.h',
309 deps
='''replace popt talloc tevent tdb
310 samba-util tdb-wrap''')
312 bld
.SAMBA_SUBSYSTEM('ctdb-server',
313 source
='server/ctdbd.c ' +
315 '''ctdb_daemon.c ctdb_recoverd.c
316 ctdb_recover.c ctdb_freeze.c
317 ctdb_tunables.c ctdb_monitor.c
318 ctdb_server.c ctdb_control.c
319 ctdb_call.c ctdb_ltdb_server.c
320 ctdb_traverse.c eventscript.c
321 ctdb_takeover.c ctdb_serverids.c
322 ctdb_persistent.c ctdb_keepalive.c
323 ctdb_logging.c ctdb_uptime.c
324 ctdb_vacuum.c ctdb_banning.c
328 includes
='include include/internal',
329 public_headers
='''include/ctdb.h
330 include/ctdb_private.h
331 include/ctdb_protocol.h
332 include/ctdb_typesafe_cb.h''',
333 deps
='replace popt talloc tevent tdb')
335 bld
.SAMBA_BINARY('ctdbd',
337 deps
='''ctdb-server ctdb-client ctdb-common
338 ctdb-common-util ctdb-system ctdb-tcp''' +
340 install_path
='${SBINDIR}',
341 manpages
='doc/ctdbd.1')
343 bld
.SAMBA_BINARY('ctdb',
344 source
='tools/ctdb.c tools/ctdb_vacuum.c',
345 deps
='''ctdb-client ctdb-common ctdb-common-util
347 includes
='include include/internal',
348 install_path
='${BINDIR}',
349 manpages
='doc/ctdb.1')
351 bld
.SAMBA_BINARY('ltdbtool',
352 source
='tools/ltdbtool.c',
355 install_path
='${BINDIR}',
356 manpages
='doc/ltdbtool.1')
358 bld
.SAMBA_BINARY('ctdb_lock_helper',
359 source
='server/ctdb_lock_helper.c',
360 deps
='samba-util ctdb-common-util talloc tdb',
361 includes
='include include/internal',
362 install_path
='${BINDIR}')
364 bld
.SAMBA_BINARY('ctdb_event_helper',
365 source
='server/ctdb_event_helper.c',
366 includes
='include include/internal',
367 deps
='samba-util ctdb-common-util replace tdb',
368 install_path
='${BINDIR}')
370 bld
.SAMBA_GENERATOR('ctdb-smnotify-h',
371 source
='utils/smnotify/smnotify.x',
372 target
='utils/smnotify/smnotify.h',
373 rule
='rpcgen -h ${SRC} > ${TGT}')
375 xdr_buf_hack
= 'sed -e "s@^\([ \t]*register int32_t \*buf\);@\\1 = buf;@"'
377 bld
.SAMBA_GENERATOR('ctdb-smnotify-x',
378 source
='utils/smnotify/smnotify.x',
379 target
='utils/smnotify/gen_xdr.c',
380 rule
='rpcgen -c ${SRC} | ' + xdr_buf_hack
+ ' > ${TGT}')
382 bld
.SAMBA_GENERATOR('ctdb-smnotify-c',
383 source
='utils/smnotify/smnotify.x',
384 target
='utils/smnotify/gen_smnotify.c',
385 rule
='rpcgen -l ${SRC} > ${TGT}')
387 bld
.SAMBA_BINARY('smnotify',
388 source
=bld
.SUBDIR('utils/smnotify',
389 'smnotify.c gen_smnotify.c gen_xdr.c'),
390 deps
='ctdb-smnotify-h ctdb-smnotify-c ctdb-smnotify-x popt',
391 includes
='utils utils/smnotify',
392 install_path
='${BINDIR}')
394 bld
.SAMBA_BINARY('ping_pong',
395 source
='utils/ping_pong/ping_pong.c',
397 install_path
='${BINDIR}',
398 manpages
='doc/ping_pong.1')
400 if bld
.env
.HAVE_PMDA
:
401 bld
.SAMBA_BINARY('pmdactdb',
402 source
='utils/pmda/pmda_ctdb.c',
403 includes
='include include/internal',
404 deps
='''ctdb-client ctdb-common ctdb-system
406 install_path
='${CTDB_PMDADIR}')
407 bld
.INSTALL_FILES('${CTDB_PMDADIR}', 'utils/pmda/Install',
409 bld
.INSTALL_FILES('${CTDB_PMDADIR}', 'utils/pmda/Remove',
411 bld
.INSTALL_FILES('${CTDB_PMDADIR}', 'utils/pmda/pmns',
413 bld
.INSTALL_FILES('${CTDB_PMDADIR}', 'utils/pmda/domain.h',
415 bld
.INSTALL_FILES('${CTDB_PMDADIR}', 'utils/pmda/help',
417 bld
.INSTALL_FILES('${CTDB_PMDADIR}', 'utils/pmda/README',
420 bld
.MANPAGES('''doc/onnode.1 doc/ctdbd_wrapper.1 doc/ctdbd.conf.5
421 doc/ctdb.7 doc/ctdb-statistics.7 doc/ctdb-tunables.7''',
424 bld
.INSTALL_FILES('${BINDIR}', 'tools/onnode',
425 destname
='onnode', chmod
=0755)
426 bld
.INSTALL_FILES('${BINDIR}', 'tools/ctdb_diagnostics',
427 destname
='ctdb_diagnostics', chmod
=0755)
428 bld
.INSTALL_FILES('${SBINDIR}', 'config/ctdbd_wrapper',
429 destname
='ctdbd_wrapper', chmod
=0755)
431 def SUBDIR_MODE_callback(arg
, dirname
, fnames
):
433 fl
= os
.path
.join(dirname
, f
)
434 if os
.path
.isdir(fl
) or os
.path
.islink(fl
):
436 mode
= os
.lstat(fl
).st_mode
& 0777
438 fl
= samba_utils
.os_path_relpath(fl
, arg
['trim_path'])
439 arg
['file_list'].append([fl
, mode
])
441 def SUBDIR_MODE(path
, trim_path
=None):
442 pd
= {'trim_path': trim_path
, 'file_list': []}
443 os
.path
.walk(path
, SUBDIR_MODE_callback
, pd
)
444 return pd
['file_list']
451 for t
in etc_subdirs
:
452 files
= SUBDIR_MODE('config/%s' % t
, trim_path
='config')
454 bld
.INSTALL_FILES(bld
.env
.CTDB_ETCDIR
, 'config/%s' % fmode
[0],
455 destname
=fmode
[0], chmod
=fmode
[1])
457 bld
.INSTALL_FILES(bld
.env
.CTDB_ETCDIR
, 'config/functions',
458 destname
='functions')
461 'ctdb-crash-cleanup.sh',
462 'debug-hung-script.sh',
469 for t
in etc_scripts
:
470 bld
.INSTALL_FILES(bld
.env
.CTDB_ETCDIR
, 'config/' + t
,
471 destname
=t
, chmod
=0755)
473 bld
.INSTALL_FILES('${SYSCONFDIR}/sudoers.d', 'config/ctdb.sudoers',
476 bld
.INSTALL_FILES('${CTDB_ETCDIR}/notify.d', 'config/notify.d.README',
479 bld
.install_dir(bld
.env
.CTDB_LOGDIR
)
480 bld
.install_dir(bld
.env
.CTDB_RUNDIR
)
481 bld
.install_dir(bld
.env
.CTDB_VARDIR
)
483 sed_expr
= 's/@PACKAGE_VERSION@/%s/g' % VERSION
484 t
= bld
.SAMBA_GENERATOR('ctdb-pc',
487 rule
='sed -e "%s" ${SRC} > ${TGT}' % sed_expr
,
488 dep_vars
=['VERSION'])
489 t
.env
.VERSION
= VERSION
490 bld
.INSTALL_FILES('${LIBDIR}/pkgconfig', 'ctdb.pc')
498 'ctdb_fetch_readonly_once',
499 'ctdb_fetch_readonly_loop',
500 'ctdb_trackingdb_test',
501 'ctdb_update_record',
502 'ctdb_update_record_persistent',
507 'ctdb_porting_tests',
512 for target
in ctdb_tests
:
513 src
= 'tests/src/' + target
+ '.c'
515 bld
.SAMBA_BINARY(target
,
517 includes
='include include/internal',
518 deps
='''ctdb-client ctdb-common ctdb-common-util
520 install_path
='${CTDB_TEST_LIBDIR}')
522 bld
.SAMBA_BINARY('ctdb_takeover_tests',
523 source
='tests/src/ctdb_takeover_tests.c',
524 deps
='''replace popt tdb tevent talloc ctdb-system
525 samba-util tdb-wrap''' +
527 includes
='include include/internal',
528 install_path
='${CTDB_TEST_LIBDIR}')
530 bld
.SAMBA_BINARY('ctdb_functest',
531 source
='tests/src/ctdb_functest.c',
532 deps
='''replace tdb tevent talloc popt ctdb-system
533 samba-util tdb-wrap''',
534 includes
='include include/internal',
535 install_path
='${CTDB_TEST_LIBDIR}')
537 bld
.SAMBA_BINARY('ctdb_stubtest',
538 source
='tests/src/ctdb_test.c',
539 deps
='''replace tdb tevent talloc popt ctdb-system
540 samba-util tdb-wrap''',
541 includes
='include include/internal',
542 install_path
='${CTDB_TEST_LIBDIR}')
544 if bld
.env
.HAVE_INFINIBAND
:
545 bld
.SAMBA_BINARY('ibwrapper_test',
546 source
='ib/ibwrapper_test.c',
547 includes
='include include/internal',
548 deps
='''replace talloc ctdb-client ctdb-common
551 install_path
='${CTDB_TEST_LIBDIR}')
563 for t
in test_subdirs
:
564 files
= SUBDIR_MODE('tests/%s' % t
, trim_path
='tests')
566 bld
.INSTALL_FILES(bld
.env
.CTDB_TEST_DATADIR
, 'tests/%s' % fmode
[0],
567 destname
=fmode
[0], chmod
=fmode
[1])
569 # Install tests/scripts directory without test_wrap
576 for t
in test_scripts
:
577 bld
.INSTALL_FILES(bld
.env
.CTDB_TEST_DATADIR
,
578 os
.path
.join('tests/scripts', t
),
579 destname
=os
.path
.join('scripts', t
))
581 sed_expr
= 's@^TEST_SCRIPTS_DIR=.*@&\\nexport TEST_BIN_DIR=\"%s\"@' % (
582 bld
.env
.CTDB_TEST_LIBDIR
)
583 bld
.SAMBA_GENERATOR('ctdb-test-wrap',
584 source
='tests/scripts/test_wrap',
586 rule
='sed -e "%s" ${SRC} > ${TGT}' % sed_expr
)
587 bld
.INSTALL_FILES(bld
.env
.CTDB_TEST_DATADIR
+"/scripts", 'test_wrap',
588 destname
='test_wrap', chmod
=0755)
590 sed_expr1
= 's@^test_dir=.*@test_dir=%s\\nexport TEST_BIN_DIR=\"%s\"@' % (
591 bld
.env
.CTDB_TEST_DATADIR
, bld
.env
.CTDB_TEST_LIBDIR
)
592 sed_expr2
= 's@^\(export CTDB_TESTS_ARE_INSTALLED\)=false@\\1=true@'
593 bld
.SAMBA_GENERATOR('ctdb-test-runner',
594 source
='tests/run_tests.sh',
595 target
='ctdb_run_tests.sh',
596 rule
='sed -e "%s" -e "%s" ${SRC} > ${TGT}' % (
597 sed_expr1
, sed_expr2
))
598 bld
.INSTALL_FILES('${BINDIR}', 'ctdb_run_tests.sh',
599 destname
='ctdb_run_tests', chmod
=0755)
600 bld
.symlink_as(os
.path
.join(bld
.env
.BINDIR
, 'ctdb_run_cluster_tests'),
603 test_eventscript_links
= [
609 test_link_dir
= os
.path
.join(bld
.env
.CTDB_TEST_DATADIR
,
610 'eventscripts/etc-ctdb')
611 for t
in test_eventscript_links
:
612 bld
.symlink_as(os
.path
.join(test_link_dir
, t
),
613 os
.path
.join(bld
.env
.CTDB_ETCDIR
, t
))
617 cmd
= 'tests/run_tests.sh -V tests/var'
618 ret
= samba_utils
.RUN_COMMAND(cmd
)
620 print('tests exited with exit status %d' % ret
)
626 Scripting
.commands
.append('build')
627 Scripting
.commands
.append('testonly')
631 cmd
= 'LD_PRELOAD=bin/shared/libsocket-wrapper.so tests/run_tests.sh -e -S -C'
632 ret
= samba_utils
.RUN_COMMAND(cmd
)
634 print('autotest exited with exit status %d' % ret
)
638 def show_version(ctx
):
643 samba_dist
.DIST_FILES('VERSION:VERSION', extend
=True)
645 t
= 'include/ctdb_version.h'
646 cmd
= 'packaging/mkversion.sh %s %s' % (t
, VERSION
)
647 ret
= samba_utils
.RUN_COMMAND(cmd
)
649 print('Command "%s" failed with exit status %d' % (cmd
, ret
))
651 samba_dist
.DIST_FILES('ctdb/%s:%s' % (t
, t
), extend
=True)
654 sed_expr1
= 's/@VERSION@/%s/g' % VERSION
655 sed_expr2
= 's/@RELEASE@/%s/g' % '1'
656 cmd
= 'sed -e "%s" -e "%s" packaging/RPM/ctdb.spec.in > %s' % (
657 sed_expr1
, sed_expr2
, t
)
658 ret
= samba_utils
.RUN_COMMAND(cmd
)
660 print('Command "%s" failed with exit status %d' % (cmd
, ret
))
662 samba_dist
.DIST_FILES('ctdb/%s:%s' % (t
, t
), extend
=True)
676 ret
= samba_utils
.RUN_COMMAND(cmd
)
678 print('Command "%s" failed with exit status %d' % (cmd
, ret
))
681 samba_dist
.DIST_FILES('ctdb/doc/%s:doc/%s' % (t
, t
), extend
=True)
682 samba_dist
.DIST_FILES('ctdb/doc/%s.html:doc/%s.html' % (t
, t
),
689 cmd
= 'rpmbuild -ta --clean --rmsource ctdb-%s.tar.gz' % VERSION
690 ret
= samba_utils
.RUN_COMMAND(cmd
)
692 print('rpmbuild exited with exit status %d' % ret
)
698 Scripting
.commands
.append('dist')
699 Scripting
.commands
.append('rpmonly')
703 "build 'tags' file using ctags"
705 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
706 cmd
= 'ctags $(find %s -name "*.[ch]")' % source_root
707 print("Running: %s" % cmd
)
708 ret
= samba_utils
.RUN_COMMAND(cmd
)
710 print('ctags failed with exit status %d' % ret
)