2014-01-30 11:45:06 +04:00
#!/usr/bin/env python
APPNAME = 'ctdb'
blddir = 'bin'
import sys, os
# find the buildtools directory
srcdir = '.'
while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5:
srcdir = srcdir + '/..'
sys.path.insert(0, srcdir + '/buildtools/wafsamba')
2014-07-23 08:34:17 +04:00
import wafsamba, samba_dist, Options, Logs, Utils
2014-01-30 11:45:06 +04:00
import samba_utils, samba_version
env = samba_utils.LOAD_ENVIRONMENT()
if os.path.isfile('./VERSION'):
2014-07-08 06:00:00 +04:00
vdir = '.'
2014-01-30 11:45:06 +04:00
elif os.path.isfile('../VERSION'):
2014-07-08 06:00:00 +04:00
vdir = '..'
2014-01-30 11:45:06 +04:00
else:
Logs.error("VERSION file not found")
version = samba_version.samba_version_file('%s/VERSION' % vdir, vdir, env)
VERSION = version.STRING.replace('-', '.')
2015-09-28 22:47:16 +03:00
default_prefix = Options.default_prefix = '/usr/local'
2014-01-30 11:45:06 +04:00
samba_dist.DIST_DIRS('''ctdb:. lib/replace:lib/replace lib/talloc:lib/talloc
2014-08-11 10:02:27 +04:00
lib/tevent:lib/tevent lib/tdb:lib/tdb
2014-01-30 11:45:06 +04:00
lib/socket_wrapper:lib/socket_wrapper
2014-08-11 10:02:27 +04:00
third_party/popt:third_party/popt
2014-08-15 10:41:57 +04:00
lib/util:lib/util lib/tdb_wrap:lib/tdb_wrap
lib/ccan:lib/ccan libcli/util:libcli/util
2016-05-27 05:38:20 +03:00
lib/async_req:lib/async_req
2015-03-25 14:13:40 +03:00
buildtools:buildtools third_party/waf:third_party/waf''')
2014-01-30 11:45:06 +04:00
2015-08-13 08:17:51 +03:00
manpages = [
'ctdb.1',
'ctdb.7',
'ctdbd.1',
'ctdbd.conf.5',
'ctdbd_wrapper.1',
'ctdb-statistics.7',
'ctdb-tunables.7',
'ltdbtool.1',
'onnode.1',
'ping_pong.1'
]
2014-07-08 06:00:00 +04:00
2014-01-30 11:45:06 +04:00
def set_options(opt):
opt.PRIVATE_EXTENSION_DEFAULT('ctdb')
2014-08-15 10:41:57 +04:00
2014-01-30 11:45:06 +04:00
opt.RECURSE('lib/replace')
2014-08-15 10:41:57 +04:00
opt.RECURSE('lib/util')
2014-01-30 11:45:06 +04:00
opt.RECURSE('lib/talloc')
opt.RECURSE('lib/tevent')
opt.RECURSE('lib/tdb')
opt.add_option('--enable-infiniband',
help=("Turn on infiniband support (default=no)"),
action="store_true", dest='ctdb_infiniband', default=False)
opt.add_option('--enable-pmda',
help=("Turn on PCP pmda support (default=no)"),
action="store_true", dest='ctdb_pmda', default=False)
opt.add_option('--with-logdir',
help=("Path to log directory"),
action="store", dest='ctdb_logdir', default=None)
opt.add_option('--with-socketpath',
2014-07-08 06:00:00 +04:00
help=("path to CTDB daemon socket"),
2015-06-21 21:53:29 +03:00
action="store", dest='ctdb_sockpath', default=None)
2014-07-08 06:00:00 +04:00
2014-01-30 11:45:06 +04:00
def configure(conf):
# No need to build python bindings for talloc/tevent/tdb
if conf.IN_LAUNCH_DIR():
2014-08-25 07:46:00 +04:00
conf.env.standalone_ctdb = True
2014-01-30 11:45:06 +04:00
Options.options.disable_python = True
conf.RECURSE('lib/replace')
2014-08-15 10:41:57 +04:00
2014-08-25 07:46:00 +04:00
if conf.env.standalone_ctdb:
conf.SAMBA_CHECK_PERL(mandatory=True)
2014-08-15 10:41:57 +04:00
2014-08-25 07:46:00 +04:00
conf.SAMBA_CHECK_PYTHON(mandatory=True, version=(2,5,0))
conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=True)
2014-08-15 10:41:57 +04:00
2014-07-23 08:34:17 +04:00
if conf.CHECK_FOR_THIRD_PARTY():
2014-08-11 10:02:00 +04:00
conf.RECURSE('third_party/popt')
2014-07-23 08:34:17 +04:00
else:
if not conf.CHECK_POPT():
raise Utils.WafError('popt development packages have not been found\nIf third_party is installed, check that it is in the proper place.')
else:
conf.define('USING_SYSTEM_POPT', 1)
2014-08-15 10:41:57 +04:00
conf.RECURSE('lib/util')
2014-01-30 11:45:06 +04:00
conf.RECURSE('lib/talloc')
conf.RECURSE('lib/tevent')
conf.RECURSE('lib/tdb')
2015-09-24 05:39:17 +03:00
if conf.env.standalone_ctdb or conf.CONFIG_GET('ENABLE_SELFTEST'):
conf.RECURSE('lib/socket_wrapper')
2016-06-21 10:50:53 +03:00
conf.env.SOCKET_WRAPPER_SO_PATH = conf.CONFIG_GET('LIBSOCKET_WRAPPER_SO_PATH')
2014-01-30 11:45:06 +04:00
2014-09-15 05:01:21 +04:00
conf.CHECK_HEADERS('sched.h')
conf.CHECK_HEADERS('procinfo.h')
if sys.platform.startswith('aix') and not conf.CHECK_FUNCS('thread_setsched'):
Logs.error('Need thread_setsched() on AIX')
sys.exit(1)
elif not conf.CHECK_FUNCS('sched_setscheduler'):
Logs.error('Need sched_setscheduler()')
sys.exit(1)
conf.CHECK_FUNCS('mlockall')
2014-09-15 09:52:38 +04:00
if not conf.CHECK_VARIABLE('ETIME', headers='errno.h'):
conf.DEFINE('ETIME', 'ETIMEDOUT')
2014-09-15 10:10:16 +04:00
if sys.platform.startswith('linux'):
conf.SET_TARGET_TYPE('pcap', 'EMPTY')
else:
if not conf.CHECK_HEADERS('pcap.h'):
Logs.error('Need libpcap')
sys.exit(1)
if not conf.CHECK_FUNCS_IN('pcap_open_live', 'pcap', headers='pcap.h'):
Logs.error('Need libpcap')
sys.exit(1)
2014-09-18 04:21:25 +04:00
if not conf.CHECK_FUNCS_IN('backtrace backtrace_symbols', 'execinfo',
checklibc=True, headers='execinfo.h'):
Logs.error('backtrace support not available')
2014-01-30 11:45:06 +04:00
have_pmda = False
if Options.options.ctdb_pmda:
pmda_support = True
if not conf.CHECK_HEADERS('pcp/pmapi.h pcp/impl.h pcp/pmda.h',
together=True):
pmda_support = False
if not conf.CHECK_FUNCS_IN('pmProgname', 'pcp'):
pmda_support = False
if not conf.CHECK_FUNCS_IN('pmdaDaemon', 'pcp_pmda'):
pmda_support = False
if pmda_support:
have_pmda = True
else:
Logs.error("PMDA support not available")
2016-06-27 11:26:34 +03:00
sys.exit(1)
2014-01-30 11:45:06 +04:00
if have_pmda:
Logs.info('Building with PMDA support')
conf.define('HAVE_PMDA', 1)
conf.env.CTDB_PMDADIR = os.path.join(conf.env.LOCALSTATEDIR,
'lib/pcp/pmdas/ctdb')
have_infiniband = False
if Options.options.ctdb_infiniband:
ib_support = True
if not conf.CHECK_HEADERS('infiniband/verbs.h rdma/rdma_cma.h'):
ib_support = False
if not conf.CHECK_FUNCS_IN('ibv_create_qp', 'ibverbs'):
ib_support = False
if not conf.CHECK_FUNCS_IN('rdma_connect', 'rdmacm'):
ib_support = False
if ib_support:
have_infiniband = True
else:
Logs.error("Infiniband support not available")
2016-06-27 11:26:34 +03:00
sys.exit(1)
2014-01-30 11:45:06 +04:00
if have_infiniband:
Logs.info('Building with Infiniband support')
conf.define('HAVE_INFINIBAND', 1)
conf.define('USE_INFINIBAND', 1)
conf.env.CTDB_BINDIR = os.path.join(conf.env.EXEC_PREFIX, 'bin')
conf.env.CTDB_ETCDIR = os.path.join(conf.env.SYSCONFDIR, 'ctdb')
conf.env.CTDB_VARDIR = os.path.join(conf.env.LOCALSTATEDIR, 'lib/ctdb')
conf.env.CTDB_RUNDIR = os.path.join(conf.env.LOCALSTATEDIR, 'run/ctdb')
2016-02-12 02:12:13 +03:00
conf.env.CTDB_HELPER_BINDIR = os.path.join(conf.env.LIBEXECDIR, 'ctdb')
2014-01-30 11:45:06 +04:00
if Options.options.ctdb_logdir:
conf.env.CTDB_LOGDIR = Options.options.ctdb_logdir
else:
conf.env.CTDB_LOGDIR = os.path.join(conf.env.LOCALSTATEDIR, 'log')
if Options.options.ctdb_sockpath:
conf.env.CTDB_SOCKPATH = Options.options.ctdb_sockpath
else:
conf.env.CTDB_SOCKPATH = os.path.join(conf.env.CTDB_RUNDIR,
'ctdbd.socket')
2015-10-26 07:58:36 +03:00
conf.define('CTDB_SOCKET', conf.env.CTDB_SOCKPATH)
2014-01-30 11:45:06 +04:00
2014-09-26 09:42:34 +04:00
conf.ADD_CFLAGS('''-DCTDB_HELPER_BINDIR=\"%s\"
2014-06-23 12:03:17 +04:00
-DLOGDIR=\"%s\"
-DCTDB_ETCDIR=\"%s\"
2014-06-23 09:20:44 +04:00
-DCTDB_VARDIR=\"%s\"
-DCTDB_RUNDIR=\"%s\"''' % (
2016-02-12 02:12:13 +03:00
conf.env.CTDB_HELPER_BINDIR,
2014-01-30 11:45:06 +04:00
conf.env.CTDB_LOGDIR,
2014-06-23 12:03:17 +04:00
conf.env.CTDB_ETCDIR,
2014-06-23 09:20:44 +04:00
conf.env.CTDB_VARDIR,
conf.env.CTDB_RUNDIR))
2014-01-30 11:45:06 +04:00
conf.env.CTDB_TEST_DATADIR = os.path.join(conf.env.EXEC_PREFIX,
'share/ctdb-tests')
conf.env.CTDB_TEST_LIBDIR = os.path.join(conf.env.LIBDIR, 'ctdb-tests')
2014-08-15 10:41:57 +04:00
# Allow unified compilation and separate compilation of utilities
# to find includes
2014-08-25 07:46:00 +04:00
if not conf.env.standalone_ctdb:
2015-10-29 10:28:29 +03:00
conf.ADD_EXTRA_INCLUDES('#include/public #ctdb/include #ctdb')
2014-08-25 07:46:00 +04:00
else:
if srcdir == '.':
# Building from tarball
conf.ADD_EXTRA_INCLUDES('#include')
else:
# Building standalone CTDB from within Samba tree
conf.ADD_EXTRA_INCLUDES('#ctdb/include')
conf.ADD_EXTRA_INCLUDES('#ctdb')
conf.ADD_EXTRA_INCLUDES('#lib #lib/replace')
2014-08-15 10:41:57 +04:00
2014-08-25 07:46:00 +04:00
conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
conf.DEFINE('SAMBA_UTIL_CORE_ONLY', 1, add_to_cflags=True)
conf.SAMBA_CONFIG_H()
2014-01-30 11:45:06 +04:00
2015-11-10 02:14:56 +03:00
if 'XSLTPROC_MANPAGES' in conf.env and conf.env['XSLTPROC_MANPAGES']:
conf.env.ctdb_generate_manpages = True
else:
conf.env.ctdb_generate_manpages = False
Logs.info("xsltproc unavailable, checking for pre-built manpages")
conf.env.ctdb_prebuilt_manpages = []
for m in manpages:
if os.path.exists(os.path.join("doc", m)):
Logs.info(" %s: yes" % (m))
conf.env.ctdb_prebuilt_manpages.append(m)
else:
Logs.info(" %s: no" % (m))
2014-07-08 06:00:00 +04:00
2014-01-30 11:45:06 +04:00
def build(bld):
2014-08-25 07:46:00 +04:00
if bld.env.standalone_ctdb:
# enable building of public headers in the build tree
bld.env.build_public_headers = 'include/public'
2014-08-29 15:17:30 +04:00
2015-05-28 17:17:15 +03:00
version_h = samba_utils.os_path_relpath(os.path.join(Options.launch_dir,
"version.h"),
bld.curdir)
2014-08-25 07:46:00 +04:00
if bld.env.standalone_ctdb:
ctdb_mkversion = '../packaging/mkversion.sh'
2015-05-28 17:17:15 +03:00
t = bld.SAMBA_GENERATOR('ctdb-version-header',
target='include/ctdb_version.h',
rule='%s ${TGT} %s' % (ctdb_mkversion, VERSION),
dep_vars=['VERSION'])
t.env.VERSION = VERSION
2014-08-25 07:21:12 +04:00
2015-06-08 13:47:34 +03:00
t = bld.SAMBA_GENERATOR('ctdb-samba-version-header',
target=version_h,
rule='printf "#include \\"ctdb_version.h\\" \\n#define SAMBA_VERSION_STRING CTDB_VERSION_STRING\\n" > ${TGT}',
dep_vars=['VERSION'])
2014-08-25 07:46:00 +04:00
t.env.VERSION = VERSION
2015-05-28 17:17:15 +03:00
else:
t = bld.SAMBA_GENERATOR('ctdb-samba-version-header',
target='include/ctdb_version.h',
rule='printf "#include \\"%s\\" \\n#define CTDB_VERSION_STRING SAMBA_VERSION_STRING\\n" > ${TGT}' % version_h,
dep_vars=['VERSION'])
t.env.VERSION = VERSION
2014-08-25 07:28:30 +04:00
2015-09-08 11:15:35 +03:00
bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
2014-01-30 11:45:06 +04:00
bld.RECURSE('lib/replace')
2014-07-23 08:34:17 +04:00
if bld.CHECK_FOR_THIRD_PARTY():
2014-08-11 10:02:00 +04:00
bld.RECURSE('third_party/popt')
2014-07-23 08:34:17 +04:00
2014-08-15 09:46:33 +04:00
bld.RECURSE('lib/tdb_wrap')
2014-08-17 08:29:32 +04:00
bld.RECURSE('lib/util')
2016-05-27 05:38:20 +03:00
bld.RECURSE('lib/async_req')
2014-08-17 08:29:32 +04:00
2014-01-30 11:45:06 +04:00
bld.RECURSE('lib/talloc')
bld.RECURSE('lib/tevent')
bld.RECURSE('lib/tdb')
2015-09-24 05:39:17 +03:00
if bld.env.standalone_ctdb or bld.CONFIG_GET('SOCKET_WRAPPER'):
bld.RECURSE('lib/socket_wrapper')
2014-01-30 11:45:06 +04:00
2014-08-25 07:46:00 +04:00
if bld.env.standalone_ctdb:
2015-10-14 12:21:52 +03:00
# If a combined build is implemented, CTDB will want to
2014-08-25 07:46:00 +04:00
# build against samba-util rather than samba-util-core.
# Similarly, other Samba subsystems expect samba-util. So,
# for a standalone build, just define a fake samba-util
# subsystem that pulls in samba-util-core.
bld.SAMBA_SUBSYSTEM('samba-util',
source='',
deps='samba-util-core')
2014-08-15 10:41:57 +04:00
2014-01-30 11:45:06 +04:00
bld.SAMBA_SUBSYSTEM('ctdb-tcp',
source=bld.SUBDIR('tcp',
'tcp_connect.c tcp_init.c tcp_io.c'),
2015-10-13 09:57:49 +03:00
includes='include',
2014-01-30 11:45:06 +04:00
deps='replace tdb talloc tevent')
ib_deps = ''
if bld.env.HAVE_INFINIBAND:
bld.SAMBA_SUBSYSTEM('ctdb-ib',
source=bld.SUBDIR('ib',
'''ibwrapper.c ibw_ctdb.c
ibw_ctdb_init.c'''),
2015-10-13 09:57:49 +03:00
includes='include',
2016-01-28 15:45:10 +03:00
deps='replace talloc tevent tdb')
2014-01-30 11:45:06 +04:00
ib_deps = ' ctdb-ib rdmacm ibverbs'
2014-09-15 09:55:27 +04:00
if sys.platform.startswith('linux'):
2014-01-30 11:45:06 +04:00
CTDB_SYSTEM_SRC = bld.SUBDIR('common', 'system_linux.c')
2014-09-15 09:55:27 +04:00
elif sys.platform.startswith('aix'):
2014-01-30 11:45:06 +04:00
CTDB_SYSTEM_SRC = bld.SUBDIR('common', 'system_aix.c')
2014-09-15 09:55:27 +04:00
elif sys.platform.startswith('freebsd'):
2014-01-30 11:45:06 +04:00
CTDB_SYSTEM_SRC = bld.SUBDIR('common', 'system_freebsd.c')
2016-02-11 05:27:29 +03:00
elif sys.platform.startswith('gnukfreebsd'):
2014-01-30 11:45:06 +04:00
CTDB_SYSTEM_SRC = bld.SUBDIR('common', 'system_kfreebsd.c')
elif sys.platform == 'gnu':
CTDB_SYSTEM_SRC = bld.SUBDIR('common', 'system_gnu.c')
else:
Logs.error("Platform %s not supported" % sys.platform)
bld.SAMBA_SUBSYSTEM('ctdb-system',
2015-11-11 08:52:30 +03:00
source=bld.SUBDIR('common',
'system_common.c system_util.c') +
CTDB_SYSTEM_SRC,
2015-10-13 09:57:49 +03:00
includes='include',
2016-04-22 09:51:41 +03:00
deps='replace talloc tevent tdb pcap samba-util')
2014-01-30 11:45:06 +04:00
2015-08-03 08:38:32 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-common',
source=bld.SUBDIR('common',
'''ctdb_io.c ctdb_util.c ctdb_ltdb.c
2016-03-16 23:05:51 +03:00
cmdline.c'''),
2015-10-13 09:57:49 +03:00
includes='include',
2015-08-03 08:38:32 +03:00
deps='replace popt talloc tevent tdb popt ctdb-system')
2015-03-17 04:35:31 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-util',
source=bld.SUBDIR('common',
2015-09-02 15:32:50 +03:00
'''db_hash.c srvid.c reqid.c
2015-08-01 15:36:04 +03:00
pkt_read.c pkt_write.c comm.c
2016-03-16 23:05:51 +03:00
logging.c rb_tree.c'''),
2016-06-02 10:17:19 +03:00
deps='replace talloc tevent tdb tevent-util')
2015-03-17 04:35:31 +03:00
2015-04-14 10:20:05 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-protocol',
source=bld.SUBDIR('protocol',
'''protocol_header.c protocol_packet.c
protocol_types.c protocol_call.c
protocol_message.c
protocol_control.c
protocol_client.c
2016-03-10 06:00:56 +03:00
protocol_debug.c
2015-04-14 10:20:05 +03:00
protocol_util.c'''),
includes='include',
deps='replace talloc tdb')
2014-01-30 11:45:06 +04:00
bld.SAMBA_SUBSYSTEM('ctdb-client',
source=bld.SUBDIR('client', 'ctdb_client.c'),
2015-10-13 09:57:49 +03:00
includes='include',
2014-08-15 09:46:33 +04:00
deps='''replace popt talloc tevent tdb
2015-04-08 07:38:26 +03:00
samba-util tdb-wrap ctdb-util''')
2014-01-30 11:45:06 +04:00
2015-04-14 17:14:25 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-client2',
source=bld.SUBDIR('client',
'''client_connect.c client_call.c
client_message.c client_control.c
client_message_sync.c
client_control_sync.c
client_db.c client_util.c
'''),
2015-10-13 09:57:49 +03:00
includes='include',
2015-04-14 17:14:25 +03:00
deps='replace talloc tevent tdb tdb-wrap')
2015-11-23 08:18:16 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-ipalloc',
source=bld.SUBDIR('server',
'''ipalloc_deterministic.c
ipalloc_nondeterministic.c
ipalloc_lcp2.c
ipalloc_common.c
ipalloc.c
'''),
includes='include',
deps='ctdb-protocol replace talloc tevent')
2014-01-30 11:45:06 +04:00
bld.SAMBA_SUBSYSTEM('ctdb-server',
source='server/ctdbd.c ' +
bld.SUBDIR('server',
'''ctdb_daemon.c ctdb_recoverd.c
ctdb_recover.c ctdb_freeze.c
ctdb_tunables.c ctdb_monitor.c
ctdb_server.c ctdb_control.c
ctdb_call.c ctdb_ltdb_server.c
ctdb_traverse.c eventscript.c
2016-04-21 08:18:33 +03:00
ctdb_takeover.c
2014-01-30 11:45:06 +04:00
ctdb_persistent.c ctdb_keepalive.c
2016-02-17 06:32:03 +03:00
ctdb_cluster_mutex.c
2014-08-08 14:54:54 +04:00
ctdb_logging.c
ctdb_logging_syslog.c
ctdb_logging_file.c
ctdb_uptime.c
2014-01-30 11:45:06 +04:00
ctdb_vacuum.c ctdb_banning.c
ctdb_statistics.c
ctdb_update_record.c
2016-03-11 07:57:44 +03:00
ctdb_lock.c ctdb_fork.c'''),
2015-10-13 09:57:49 +03:00
includes='include',
2015-11-23 08:18:16 +03:00
deps='ctdb-ipalloc replace popt talloc tevent tdb talloc_report')
2014-01-30 11:45:06 +04:00
2014-08-21 11:26:14 +04:00
bld.SAMBA_BINARY('ctdbd',
2014-01-30 11:45:06 +04:00
source='',
deps='''ctdb-server ctdb-client ctdb-common
2015-11-11 08:52:30 +03:00
ctdb-system ctdb-tcp ctdb-util''' +
2014-01-30 11:45:06 +04:00
ib_deps,
install_path='${SBINDIR}',
2015-08-13 08:17:51 +03:00
manpages='ctdbd.1')
2014-01-30 11:45:06 +04:00
2014-08-21 11:26:14 +04:00
bld.SAMBA_BINARY('ctdb',
2015-10-23 06:24:48 +03:00
source='tools/ctdb.c',
2015-11-11 08:52:30 +03:00
deps='ctdb-client ctdb-common ctdb-system ctdb-util',
2015-10-13 09:57:49 +03:00
includes='include',
2014-01-30 11:45:06 +04:00
install_path='${BINDIR}',
2015-08-13 08:17:51 +03:00
manpages='ctdb.1')
2014-01-30 11:45:06 +04:00
2016-03-03 02:34:48 +03:00
bld.SAMBA_BINARY('ctdb_killtcp',
2016-03-11 08:04:30 +03:00
source='tools/ctdb_killtcp.c',
2016-03-03 02:34:48 +03:00
deps='''ctdb-protocol ctdb-util ctdb-system
samba-util replace''',
install_path='${CTDB_HELPER_BINDIR}')
2014-08-21 11:26:14 +04:00
bld.SAMBA_BINARY('ltdbtool',
2014-01-30 11:45:06 +04:00
source='tools/ltdbtool.c',
includes='include',
deps='tdb',
install_path='${BINDIR}',
2015-08-13 08:17:51 +03:00
manpages='ltdbtool.1')
2014-01-30 11:45:06 +04:00
2014-08-21 11:26:14 +04:00
bld.SAMBA_BINARY('ctdb_lock_helper',
2014-01-30 11:45:06 +04:00
source='server/ctdb_lock_helper.c',
2015-11-11 08:52:30 +03:00
deps='samba-util ctdb-system talloc tdb',
2015-10-13 09:57:49 +03:00
includes='include',
2016-02-12 02:12:13 +03:00
install_path='${CTDB_HELPER_BINDIR}')
2014-01-30 11:45:06 +04:00
2014-08-21 11:26:14 +04:00
bld.SAMBA_BINARY('ctdb_event_helper',
2014-01-30 11:45:06 +04:00
source='server/ctdb_event_helper.c',
2015-10-13 09:57:49 +03:00
includes='include',
2015-11-11 08:52:30 +03:00
deps='samba-util ctdb-system replace tdb',
2016-02-12 02:12:13 +03:00
install_path='${CTDB_HELPER_BINDIR}')
2014-01-30 11:45:06 +04:00
2015-06-29 07:56:53 +03:00
bld.SAMBA_BINARY('ctdb_recovery_helper',
source='server/ctdb_recovery_helper.c',
deps='''ctdb-client2 ctdb-protocol ctdb-util
samba-util replace tdb''',
2016-02-12 02:12:13 +03:00
install_path='${CTDB_HELPER_BINDIR}')
2015-06-29 07:56:53 +03:00
2015-12-08 08:23:50 +03:00
bld.SAMBA_BINARY('ctdb_mutex_fcntl_helper',
source='server/ctdb_mutex_fcntl_helper.c',
deps='ctdb-system',
includes='include',
install_path='${CTDB_HELPER_BINDIR}')
2014-01-30 11:45:06 +04:00
bld.SAMBA_GENERATOR('ctdb-smnotify-h',
source='utils/smnotify/smnotify.x',
target='utils/smnotify/smnotify.h',
rule='rpcgen -h ${SRC} > ${TGT}')
2014-08-04 08:52:00 +04:00
xdr_buf_hack = 'sed -e "s@^\([ \t]*register int32_t \*buf\);@\\1 = buf;@"'
2014-01-30 11:45:06 +04:00
bld.SAMBA_GENERATOR('ctdb-smnotify-x',
source='utils/smnotify/smnotify.x',
target='utils/smnotify/gen_xdr.c',
2014-08-04 08:52:00 +04:00
rule='rpcgen -c ${SRC} | ' + xdr_buf_hack + ' > ${TGT}')
2014-01-30 11:45:06 +04:00
bld.SAMBA_GENERATOR('ctdb-smnotify-c',
source='utils/smnotify/smnotify.x',
target='utils/smnotify/gen_smnotify.c',
rule='rpcgen -l ${SRC} > ${TGT}')
2014-08-21 11:26:14 +04:00
bld.SAMBA_BINARY('smnotify',
2014-01-30 11:45:06 +04:00
source=bld.SUBDIR('utils/smnotify',
'smnotify.c gen_smnotify.c gen_xdr.c'),
deps='ctdb-smnotify-h ctdb-smnotify-c ctdb-smnotify-x popt',
includes='utils utils/smnotify',
2016-02-12 02:12:13 +03:00
install_path='${CTDB_HELPER_BINDIR}')
2014-01-30 11:45:06 +04:00
2014-08-21 11:26:14 +04:00
bld.SAMBA_BINARY('ping_pong',
2014-01-30 11:45:06 +04:00
source='utils/ping_pong/ping_pong.c',
deps='',
install_path='${BINDIR}',
2015-08-13 08:17:51 +03:00
manpages='ping_pong.1')
2014-01-30 11:45:06 +04:00
if bld.env.HAVE_PMDA:
2014-08-21 11:26:14 +04:00
bld.SAMBA_BINARY('pmdactdb',
2014-01-30 11:45:06 +04:00
source='utils/pmda/pmda_ctdb.c',
2015-10-13 09:57:49 +03:00
includes='include',
2015-11-11 08:52:30 +03:00
deps='ctdb-client ctdb-common pcp_pmda pcp',
2014-01-30 11:45:06 +04:00
install_path='${CTDB_PMDADIR}')
bld.INSTALL_FILES('${CTDB_PMDADIR}', 'utils/pmda/Install',
destname='Install')
bld.INSTALL_FILES('${CTDB_PMDADIR}', 'utils/pmda/Remove',
destname='Remove')
bld.INSTALL_FILES('${CTDB_PMDADIR}', 'utils/pmda/pmns',
destname='pmns')
bld.INSTALL_FILES('${CTDB_PMDADIR}', 'utils/pmda/domain.h',
destname='domain.h')
bld.INSTALL_FILES('${CTDB_PMDADIR}', 'utils/pmda/help',
destname='help')
bld.INSTALL_FILES('${CTDB_PMDADIR}', 'utils/pmda/README',
destname='README')
2015-08-13 08:17:51 +03:00
sed_expr1 = 's|/usr/local/var/lib/ctdb|%s|g' % (bld.env.CTDB_VARDIR)
2015-08-17 13:47:58 +03:00
sed_expr2 = 's|/usr/local/etc/ctdb|%s|g' % (bld.env.CTDB_ETCDIR)
sed_expr3 = 's|/usr/local/var/log|%s|g' % (bld.env.CTDB_LOGDIR)
sed_expr4 = 's|/usr/local/var/run/ctdb|%s|g' % (bld.env.CTDB_RUNDIR)
sed_expr5 = 's|/usr/local/sbin|%s|g' % (bld.env.SBINDIR)
2016-02-12 02:12:13 +03:00
sed_expr6 = 's|/usr/local/libexec/ctdb|%s|g' % (bld.env.CTDB_HELPER_BINDIR)
2016-06-08 13:08:35 +03:00
sed_expr7 = 's|/usr/local/bin|%s|g' % (bld.env.BINDIR)
sed_cmdline = '-e "%s" -e "%s" -e "%s" -e "%s" -e "%s" -e "%s" -e "%s"' % \
2016-02-12 02:12:13 +03:00
(sed_expr1, sed_expr2, sed_expr3, sed_expr4, sed_expr5,
2016-06-08 13:08:35 +03:00
sed_expr6, sed_expr7)
2015-08-13 08:17:51 +03:00
for f in manpages:
x = '%s.xml' % (f)
bld.SAMBA_GENERATOR(x,
source=os.path.join('doc', x),
target=x,
rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
2015-11-10 02:14:56 +03:00
if bld.env.ctdb_generate_manpages:
2015-08-13 08:17:51 +03:00
bld.MANPAGES('''onnode.1 ctdbd_wrapper.1 ctdbd.conf.5
ctdb.7 ctdb-statistics.7 ctdb-tunables.7''',
True)
2015-09-11 06:08:38 +03:00
else:
2015-11-10 02:14:56 +03:00
for m in bld.env.ctdb_prebuilt_manpages:
2015-09-11 06:08:38 +03:00
bld.SAMBA_GENERATOR(m,
source=os.path.join("doc", m),
target=m,
rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
bld.INSTALL_FILES('${MANDIR}/man%s' % m[-1], m)
2014-01-30 11:45:06 +04:00
2015-08-17 13:47:58 +03:00
bld.SAMBA_GENERATOR('ctdb-onnode',
source='tools/onnode',
target='onnode',
rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
bld.INSTALL_FILES('${BINDIR}', 'onnode',
2014-01-30 11:45:06 +04:00
destname='onnode', chmod=0755)
2015-08-17 13:47:58 +03:00
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',
2014-01-30 11:45:06 +04:00
destname='ctdb_diagnostics', chmod=0755)
2015-08-17 13:47:58 +03:00
2015-12-14 03:34:41 +03:00
bld.SAMBA_GENERATOR('ctdb-natgw',
source='tools/ctdb_natgw',
target='ctdb_natgw',
rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
2016-02-12 02:12:13 +03:00
bld.INSTALL_FILES('${CTDB_HELPER_BINDIR}', 'ctdb_natgw',
2015-12-14 03:34:41 +03:00
destname='ctdb_natgw', chmod=0755)
2016-04-07 10:30:28 +03:00
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=0755)
2015-08-17 13:47:58 +03:00
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',
2014-01-30 11:45:06 +04:00
destname='ctdbd_wrapper', chmod=0755)
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 & 0777
if arg['trim_path']:
2014-12-15 13:14:44 +03:00
fl = samba_utils.os_path_relpath(fl, arg['trim_path'])
2014-01-30 11:45:06 +04:00
arg['file_list'].append([fl, mode])
def SUBDIR_MODE(path, trim_path=None):
2014-07-08 06:00:00 +04:00
pd = {'trim_path': trim_path, 'file_list': []}
os.path.walk(path, SUBDIR_MODE_callback, pd)
return pd['file_list']
2014-01-30 11:45:06 +04:00
etc_subdirs = [
'events.d',
2015-06-19 09:35:12 +03:00
'nfs-checks.d'
2014-01-30 11:45:06 +04:00
]
2014-12-15 13:15:24 +03:00
if bld.env.standalone_ctdb:
configdir = 'config'
else:
configdir = 'ctdb/config'
2014-01-30 11:45:06 +04:00
for t in etc_subdirs:
2014-12-15 13:15:24 +03:00
files = SUBDIR_MODE('%s/%s' % (configdir, t), trim_path=configdir)
2014-01-30 11:45:06 +04:00
for fmode in files:
bld.INSTALL_FILES(bld.env.CTDB_ETCDIR, 'config/%s' % fmode[0],
destname=fmode[0], chmod=fmode[1])
2015-08-13 08:17:51 +03:00
bld.SAMBA_GENERATOR('ctdb-functions',
source='config/functions',
target='functions',
rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
bld.INSTALL_FILES(bld.env.CTDB_ETCDIR, 'functions', destname='functions')
2014-01-30 11:45:06 +04:00
etc_scripts = [
'ctdb-crash-cleanup.sh',
'debug-hung-script.sh',
'debug_locks.sh',
'gcore_trace.sh',
2015-06-24 14:36:14 +03:00
'nfs-linux-kernel-callout',
2014-01-30 11:45:06 +04:00
'notify.sh',
'statd-callout'
]
for t in etc_scripts:
2014-12-15 13:15:24 +03:00
bld.INSTALL_FILES(bld.env.CTDB_ETCDIR, 'config/%s' % t,
2014-01-30 11:45:06 +04:00
destname=t, chmod=0755)
2015-08-17 13:47:58 +03:00
bld.SAMBA_GENERATOR('ctdb-sudoers',
source='config/ctdb.sudoers',
target='ctdb.sudoers',
rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
bld.INSTALL_FILES('${SYSCONFDIR}/sudoers.d', 'ctdb.sudoers',
2014-01-30 11:45:06 +04:00
destname='ctdb')
bld.INSTALL_FILES('${CTDB_ETCDIR}/notify.d', 'config/notify.d.README',
destname='README')
bld.install_dir(bld.env.CTDB_LOGDIR)
bld.install_dir(bld.env.CTDB_RUNDIR)
bld.install_dir(bld.env.CTDB_VARDIR)
2015-03-17 04:35:31 +03:00
# Unit tests
ctdb_unit_tests = [
'db_hash_test',
2015-03-16 15:25:27 +03:00
'srvid_test',
2015-09-02 15:32:50 +03:00
'pkt_read_test',
2015-04-06 10:26:29 +03:00
'pkt_write_test',
2015-04-04 12:23:44 +03:00
'comm_test',
'comm_server_test',
'comm_client_test',
2015-04-14 10:20:05 +03:00
'protocol_types_test',
'protocol_client_test',
2015-03-17 04:35:31 +03:00
]
for target in ctdb_unit_tests:
src = 'tests/src/' + target + '.c'
bld.SAMBA_BINARY(target,
source=src,
2016-05-27 05:52:12 +03:00
deps='''talloc tevent tdb tevent-util
LIBASYNC_REQ samba-util''',
2015-03-17 04:35:31 +03:00
install_path='${CTDB_TEST_LIBDIR}')
2015-03-17 05:29:44 +03:00
bld.SAMBA_BINARY('reqid_test',
source='tests/src/reqid_test.c',
deps='samba-util',
install_path='${CTDB_TEST_LIBDIR}')
2016-03-10 07:44:24 +03:00
bld.SAMBA_BINARY('ctdb_packet_parse',
source='tests/src/ctdb_packet_parse.c',
deps='talloc tevent tdb ctdb-protocol',
install_path='${CTDB_TEST_LIBDIR}')
2014-01-30 11:45:06 +04:00
# Test binaries
ctdb_tests = [
'rb_test',
'ctdb_bench',
'ctdb_fetch',
'ctdb_fetch_one',
'ctdb_fetch_readonly_once',
'ctdb_fetch_readonly_loop',
'ctdb_trackingdb_test',
'ctdb_update_record',
'ctdb_update_record_persistent',
'ctdb_store',
'ctdb_traverse',
'ctdb_randrec',
'ctdb_persistent',
'ctdb_porting_tests',
'ctdb_transaction',
'ctdb_lock_tdb'
]
2014-08-21 11:26:14 +04:00
for target in ctdb_tests:
src = 'tests/src/' + target + '.c'
2014-01-30 11:45:06 +04:00
2014-07-08 06:00:00 +04:00
bld.SAMBA_BINARY(target,
source=src,
2015-10-13 09:57:49 +03:00
includes='include',
2015-11-11 08:52:30 +03:00
deps='ctdb-client ctdb-common ctdb-util',
2014-07-08 06:00:00 +04:00
install_path='${CTDB_TEST_LIBDIR}')
2014-01-30 11:45:06 +04:00
2014-08-21 11:26:14 +04:00
bld.SAMBA_BINARY('ctdb_takeover_tests',
2014-01-30 11:45:06 +04:00
source='tests/src/ctdb_takeover_tests.c',
2014-08-15 09:46:33 +04:00
deps='''replace popt tdb tevent talloc ctdb-system
2015-11-23 08:18:16 +03:00
samba-util tdb-wrap talloc_report
2016-05-26 09:26:51 +03:00
ctdb-ipalloc ctdb-protocol ctdb-util''',
2015-10-13 09:57:49 +03:00
includes='include',
2014-01-30 11:45:06 +04:00
install_path='${CTDB_TEST_LIBDIR}')
2016-04-22 10:30:52 +03:00
bld.SAMBA_BINARY('fake_ctdbd',
source='tests/src/fake_ctdbd.c',
deps='''ctdb-util ctdb-protocol ctdb-system
2016-05-27 05:38:20 +03:00
samba-util tevent-util LIBASYNC_REQ popt''',
2016-04-22 10:30:52 +03:00
install_path='${CTDB_TEST_LIBDIR}')
2014-01-30 11:45:06 +04:00
if bld.env.HAVE_INFINIBAND:
2014-08-21 11:26:14 +04:00
bld.SAMBA_BINARY('ibwrapper_test',
2014-01-30 11:45:06 +04:00
source='ib/ibwrapper_test.c',
2015-10-13 09:57:49 +03:00
includes='include',
2015-11-11 08:52:30 +03:00
deps='replace talloc ctdb-client ctdb-common' +
2014-01-30 11:45:06 +04:00
ib_deps,
install_path='${CTDB_TEST_LIBDIR}')
test_subdirs = [
'complex',
2015-03-17 04:35:31 +03:00
'cunit',
2014-01-30 11:45:06 +04:00
'events.d',
'eventscripts',
'onnode',
'simple',
'takeover',
'tool'
]
for t in test_subdirs:
files = SUBDIR_MODE('tests/%s' % t, trim_path='tests')
for fmode in files:
bld.INSTALL_FILES(bld.env.CTDB_TEST_DATADIR, 'tests/%s' % fmode[0],
destname=fmode[0], chmod=fmode[1])
2014-06-23 10:31:25 +04:00
# Install tests/scripts directory without test_wrap
test_scripts = [
'common.sh',
'integration.bash',
'unit.sh'
]
for t in test_scripts:
bld.INSTALL_FILES(bld.env.CTDB_TEST_DATADIR,
os.path.join('tests/scripts', t),
destname=os.path.join('scripts', t))
2014-01-30 11:45:06 +04:00
sed_expr = 's@^TEST_SCRIPTS_DIR=.*@&\\nexport TEST_BIN_DIR=\"%s\"@' % (
bld.env.CTDB_TEST_LIBDIR)
bld.SAMBA_GENERATOR('ctdb-test-wrap',
source='tests/scripts/test_wrap',
target='test_wrap',
rule='sed -e "%s" ${SRC} > ${TGT}' % sed_expr)
2014-06-23 10:31:25 +04:00
bld.INSTALL_FILES(bld.env.CTDB_TEST_DATADIR+"/scripts", 'test_wrap',
destname='test_wrap', chmod=0755)
2014-01-30 11:45:06 +04:00
sed_expr1 = 's@^test_dir=.*@test_dir=%s\\nexport TEST_BIN_DIR=\"%s\"@' % (
2014-06-23 09:48:37 +04:00
bld.env.CTDB_TEST_DATADIR, bld.env.CTDB_TEST_LIBDIR)
2014-06-23 09:58:06 +04:00
sed_expr2 = 's@^\(export CTDB_TESTS_ARE_INSTALLED\)=false@\\1=true@'
2014-01-30 11:45:06 +04:00
bld.SAMBA_GENERATOR('ctdb-test-runner',
source='tests/run_tests.sh',
target='ctdb_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=0755)
bld.symlink_as(os.path.join(bld.env.BINDIR, 'ctdb_run_cluster_tests'),
'ctdb_run_tests')
test_eventscript_links = [
'events.d',
'functions',
2015-06-19 09:35:12 +03:00
'nfs-checks.d',
2015-06-24 14:36:14 +03:00
'nfs-linux-kernel-callout',
2015-03-04 03:51:20 +03:00
'statd-callout'
2014-01-30 11:45:06 +04:00
]
test_link_dir = os.path.join(bld.env.CTDB_TEST_DATADIR,
'eventscripts/etc-ctdb')
for t in test_eventscript_links:
bld.symlink_as(os.path.join(test_link_dir, t),
os.path.join(bld.env.CTDB_ETCDIR, t))
2015-08-17 13:47:58 +03:00
# Tests that use onnode need to overwrite link to in-tree
# functions file when installed
bld.symlink_as(os.path.join(bld.env.CTDB_TEST_DATADIR, 'onnode/functions'),
os.path.join(bld.env.CTDB_ETCDIR, 'functions'))
bld.symlink_as(os.path.join(bld.env.CTDB_TEST_DATADIR, 'simple/functions'),
os.path.join(bld.env.CTDB_ETCDIR, 'functions'))
# Need a link to nodes file because $CTDB_BASE is overridden
bld.symlink_as(os.path.join(bld.env.CTDB_TEST_DATADIR, 'simple/nodes'),
os.path.join(bld.env.CTDB_ETCDIR, 'nodes'))
2014-01-30 11:45:06 +04:00
def testonly(ctx):
cmd = 'tests/run_tests.sh -V tests/var'
2014-07-08 05:40:52 +04:00
ret = samba_utils.RUN_COMMAND(cmd)
if ret != 0:
print('tests exited with exit status %d' % ret)
sys.exit(ret)
2014-01-30 11:45:06 +04:00
2014-07-08 06:00:00 +04:00
2014-01-30 11:45:06 +04:00
def test(ctx):
import Scripting
Scripting.commands.append('build')
Scripting.commands.append('testonly')
2014-07-08 06:00:00 +04:00
2014-01-30 11:45:06 +04:00
def autotest(ctx):
2016-06-21 10:50:53 +03:00
env = samba_utils.LOAD_ENVIRONMENT()
ld = 'LD_PRELOAD=%s' % env.SOCKET_WRAPPER_SO_PATH
2015-03-04 07:55:15 +03:00
cmd = '%s tests/run_tests.sh -e -S -C' % ld
2014-07-08 05:40:52 +04:00
ret = samba_utils.RUN_COMMAND(cmd)
if ret != 0:
print('autotest exited with exit status %d' % ret)
sys.exit(ret)
2014-01-30 11:45:06 +04:00
2014-07-08 06:00:00 +04:00
2014-06-23 06:55:19 +04:00
def show_version(ctx):
print VERSION
2014-01-30 11:45:06 +04:00
2014-07-08 06:00:00 +04:00
2014-06-23 06:55:19 +04:00
def dist():
2014-01-30 11:45:06 +04:00
samba_dist.DIST_FILES('VERSION:VERSION', extend=True)
t = 'include/ctdb_version.h'
2014-07-08 06:15:58 +04:00
cmd = 'packaging/mkversion.sh %s %s' % (t, VERSION)
ret = samba_utils.RUN_COMMAND(cmd)
if ret != 0:
print('Command "%s" failed with exit status %d' % (cmd, ret))
sys.exit(ret)
2014-01-30 11:45:06 +04:00
samba_dist.DIST_FILES('ctdb/%s:%s' % (t, t), extend=True)
t = 'ctdb.spec'
sed_expr1 = 's/@VERSION@/%s/g' % VERSION
sed_expr2 = 's/@RELEASE@/%s/g' % '1'
2014-07-08 06:15:58 +04:00
cmd = 'sed -e "%s" -e "%s" packaging/RPM/ctdb.spec.in > %s' % (
sed_expr1, sed_expr2, t)
ret = samba_utils.RUN_COMMAND(cmd)
if ret != 0:
print('Command "%s" failed with exit status %d' % (cmd, ret))
sys.exit(ret)
2014-01-30 11:45:06 +04:00
samba_dist.DIST_FILES('ctdb/%s:%s' % (t, t), extend=True)
2014-07-08 06:15:58 +04:00
cmd = 'make -C doc'
ret = samba_utils.RUN_COMMAND(cmd)
if ret != 0:
print('Command "%s" failed with exit status %d' % (cmd, ret))
sys.exit(ret)
2014-01-30 11:45:06 +04:00
for t in manpages:
samba_dist.DIST_FILES('ctdb/doc/%s:doc/%s' % (t, t), extend=True)
samba_dist.DIST_FILES('ctdb/doc/%s.html:doc/%s.html' % (t, t),
extend=True)
samba_dist.dist()
2014-07-08 06:00:00 +04:00
2014-06-10 10:30:38 +04:00
def rpmonly(ctx):
2015-06-25 09:19:35 +03:00
opts = os.getenv('RPM_OPTIONS') or ''
cmd = 'rpmbuild -ta --clean --rmsource %s ctdb-%s.tar.gz' % (opts, VERSION)
2014-07-08 05:40:52 +04:00
ret = samba_utils.RUN_COMMAND(cmd)
if ret != 0:
print('rpmbuild exited with exit status %d' % ret)
sys.exit(ret)
2014-06-10 10:30:38 +04:00
2014-07-08 06:00:00 +04:00
2014-06-10 10:30:38 +04:00
def rpm(ctx):
import Scripting
Scripting.commands.append('dist')
Scripting.commands.append('rpmonly')
2014-07-08 06:00:00 +04:00
2014-01-30 11:45:06 +04:00
def ctags(ctx):
"build 'tags' file using ctags"
import Utils
source_root = os.path.dirname(Utils.g_module.root_path)
2014-07-08 08:04:29 +04:00
cmd = 'ctags $(find %s -name "*.[ch]")' % source_root
2014-01-30 11:45:06 +04:00
print("Running: %s" % cmd)
2014-07-08 06:15:58 +04:00
ret = samba_utils.RUN_COMMAND(cmd)
if ret != 0:
print('ctags failed with exit status %d' % ret)
sys.exit(ret)