from waflib import Options, Logs, Errors, Context
import wafsamba
from wafsamba import samba_dist, samba_utils
+from samba_utils import MODE_644, MODE_744, MODE_755, MODE_777
if os.path.isfile('./VERSION'):
vdir = '.'
Logs.info(" %s: no" % (m))
def gen_ctdb_version(task):
- fp = file(task.outputs[0].bldpath(task.env), 'w')
+ fp = open(task.outputs[0].bldpath(task.env), 'w')
fp.write('/* This file is auto-generated from waf */\n')
fp.write('#include "version.h"\n')
fp.write('\n')
target='onnode',
rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
bld.INSTALL_FILES('${BINDIR}', 'onnode',
- destname='onnode', chmod=0o755)
+ destname='onnode', chmod=MODE_755)
bld.SAMBA_GENERATOR('ctdb-diagnostics',
source='tools/ctdb_diagnostics',
target='ctdb_diagnostics',
rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
bld.INSTALL_FILES('${BINDIR}', 'ctdb_diagnostics',
- destname='ctdb_diagnostics', chmod=0o755)
+ destname='ctdb_diagnostics', chmod=MODE_755)
if bld.env.etcd_reclock:
bld.SAMBA_GENERATOR('ctdb-etcd-lock',
target='ctdb_etcd_lock',
rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
bld.INSTALL_FILES('${CTDB_HELPER_BINDIR}', 'ctdb_etcd_lock',
- destname='ctdb_etcd_lock', chmod=0o744)
+ destname='ctdb_etcd_lock', chmod=MODE_744)
bld.SAMBA_GENERATOR('ctdb-natgw',
source='tools/ctdb_natgw',
target='ctdb_natgw',
rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
bld.INSTALL_FILES('${CTDB_HELPER_BINDIR}', 'ctdb_natgw',
- destname='ctdb_natgw', chmod=0o755)
+ destname='ctdb_natgw', chmod=MODE_755)
bld.SAMBA_GENERATOR('ctdb-lvs',
source='tools/ctdb_lvs',
target='ctdb_lvs',
rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
bld.INSTALL_FILES('${CTDB_HELPER_BINDIR}', 'ctdb_lvs',
- destname='ctdb_lvs', chmod=0o755)
+ destname='ctdb_lvs', chmod=MODE_755)
bld.SAMBA_GENERATOR('ctdbd-wrapper',
source='config/ctdbd_wrapper',
target='ctdbd_wrapper',
rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
bld.INSTALL_FILES('${SBINDIR}', 'ctdbd_wrapper',
- destname='ctdbd_wrapper', chmod=0o755)
+ destname='ctdbd_wrapper', chmod=MODE_755)
def SUBDIR_MODE_callback(arg, dirname, fnames):
for f in fnames:
fl = os.path.join(dirname, f)
if os.path.isdir(fl) or os.path.islink(fl):
continue
- mode = os.lstat(fl).st_mode & 0o777
+ mode = os.lstat(fl).st_mode & MODE_777
if arg['trim_path']:
fl = samba_utils.os_path_relpath(fl, arg['trim_path'])
arg['file_list'].append([fl, mode])
def SUBDIR_MODE(path, trim_path=None):
pd = {'trim_path': trim_path, 'file_list': []}
- os.path.walk(path, SUBDIR_MODE_callback, pd)
+ for dirname, _subdirs, fnames in os.walk(path):
+ SUBDIR_MODE_callback(pd, dirname, fnames)
return pd['file_list']
event_script_subdirs = [
for t in etc_scripts:
bld.INSTALL_FILES(bld.env.CTDB_ETCDIR, 'config/%s' % t,
- destname=t, chmod=0o755)
+ destname=t, chmod=MODE_755)
bld.SAMBA_GENERATOR('ctdb-sudoers',
source='config/ctdb.sudoers',
LIBASYNC_REQ samba-util sys_rw''',
install_path='${CTDB_TEST_LIBEXECDIR}')
+ bld.SAMBA_BINARY('ctdb_io_test',
+ source='tests/src/ctdb_io_test.c',
+ deps='''talloc tevent tdb samba-util sys_rw''',
+ install_path='${CTDB_TEST_LIBEXECDIR}')
+
+
bld.SAMBA_SUBSYSTEM('ctdb-protocol-tests-basic',
source=bld.SUBDIR('tests/src',
'protocol_common_basic.c'),
'complex',
'ctdb_eventd',
'cunit',
+ 'etc-ctdb',
'eventd',
'eventscripts',
'onnode',
target='test_wrap',
rule='sed -e "%s" ${SRC} > ${TGT}' % sed_expr)
bld.INSTALL_FILES(bld.env.CTDB_TEST_DATADIR+"/scripts", 'test_wrap',
- destname='test_wrap', chmod=0o755)
+ destname='test_wrap', chmod=MODE_755)
bld.SAMBA_GENERATOR('ctdb-test-script-install-paths',
source='tests/scripts/script_install_paths.sh',
rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
bld.INSTALL_FILES(bld.env.CTDB_TEST_DATADIR+"/scripts",
'script_install_paths.sh',
- destname='script_install_paths.sh', chmod=0o644)
+ destname='script_install_paths.sh', chmod=MODE_644)
- sed_expr1 = 's@^\(export %s\)=.*@\\1=%s\\nexport %s=\"%s\"@''' % (
- 'CTDB_TEST_DIR', bld.env.CTDB_TEST_DATADIR,
- 'TEST_BIN_DIR', bld.env.CTDB_TEST_LIBEXECDIR)
+ sed_expr1 = 's@^\(export %s\)=.*@\\1=%s@' % (
+ 'CTDB_TEST_DIR', bld.env.CTDB_TEST_DATADIR)
sed_expr2 = 's@^\(export CTDB_TESTS_ARE_INSTALLED\)=false@\\1=true@'
bld.SAMBA_GENERATOR('ctdb-test-runner',
source='tests/run_tests.sh',
rule='sed -e "%s" -e "%s" ${SRC} > ${TGT}' % (
sed_expr1, sed_expr2))
bld.INSTALL_FILES('${BINDIR}', 'ctdb_run_tests.sh',
- destname='ctdb_run_tests', chmod=0o755)
+ destname='ctdb_run_tests', chmod=MODE_755)
bld.symlink_as(os.path.join(bld.env.BINDIR, 'ctdb_run_cluster_tests'),
'ctdb_run_tests')
+ bld.SAMBA_GENERATOR('ctdb-local-daemons',
+ source='tests/local_daemons.sh',
+ target='ctdb_local_daemons.sh',
+ rule='sed -e "%s" -e "%s" ${SRC} > ${TGT}' % (
+ sed_expr1, sed_expr2))
+ bld.INSTALL_FILES('${BINDIR}', 'ctdb_local_daemons.sh',
+ destname='ctdb_local_daemons', chmod=MODE_755)
+
def testonly(ctx):
cmd = 'tests/run_tests.sh -V tests/var'
version = get_version()
- distfile = file('.distversion', 'w')
+ distfile = open('.distversion', 'w')
for field in version.vcs_fields:
distfile.write('%s=%s\n' % (field, str(version.vcs_fields[field])))
distfile.close()