2014-01-30 11:45:06 +04:00
#!/usr/bin/env python
APPNAME = 'ctdb'
import sys, os
# find the buildtools directory
2018-06-27 14:56:32 +03:00
top = '.'
while not os.path.exists(top+'/buildtools') and len(top.split('/')) < 5:
top = top + '/..'
sys.path.insert(0, top + '/buildtools/wafsamba')
out = 'bin'
2014-01-30 11:45:06 +04:00
2018-06-27 14:56:32 +03:00
from waflib import Options, Logs, Errors, Context
2018-07-04 11:05:10 +03:00
import wafsamba
from wafsamba import samba_dist, samba_utils
2018-12-05 02:05:36 +03:00
from samba_utils import MODE_644, MODE_744, MODE_755, MODE_777
2014-01-30 11:45:06 +04:00
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")
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
2017-11-07 12:51:11 +03:00
third_party/socket_wrapper:third_party/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
2020-05-21 13:19:17 +03:00
lib/pthreadpool:lib/pthreadpool
2019-06-28 16:10:38 +03:00
lib/messaging:lib/messaging
2015-03-25 14:13:40 +03:00
buildtools:buildtools third_party/waf:third_party/waf''')
2014-01-30 11:45:06 +04:00
2016-12-08 07:38:36 +03:00
manpages_binary = [
2015-08-13 08:17:51 +03:00
'ctdb.1',
'ctdbd.1',
2016-12-08 07:38:36 +03:00
'ltdbtool.1',
'ping_pong.1'
]
manpages_misc = [
'ctdb_diagnostics.1',
'onnode.1',
2018-05-13 08:41:38 +03:00
'ctdb.conf.5',
2018-04-04 12:17:59 +03:00
'ctdb-script.options.5',
2018-04-24 07:11:23 +03:00
'ctdb.sysconfig.5',
2016-12-08 07:38:36 +03:00
'ctdb.7',
2015-08-13 08:17:51 +03:00
'ctdb-statistics.7',
'ctdb-tunables.7',
2016-12-08 07:38:36 +03:00
]
manpages_etcd = [
'ctdb-etcd.7',
2015-08-13 08:17:51 +03:00
]
2016-12-01 16:22:45 +03:00
manpages_ceph = [
'ctdb_mutex_ceph_rados_helper.7',
]
2018-07-04 11:05:10 +03:00
VERSION = ''
def get_version():
import samba_version
env = samba_utils.LOAD_ENVIRONMENT()
2018-09-09 01:11:33 +03:00
return samba_version.samba_version_file('%s/VERSION' % vdir, vdir, env)
def get_version_string():
if Context.g_module.VERSION:
return Context.g_module.VERSION
version = get_version()
2018-07-04 11:05:10 +03:00
Context.g_module.VERSION = version.STRING.replace('-', '.')
return Context.g_module.VERSION
2014-07-08 06:00:00 +04:00
2018-02-02 17:34:30 +03:00
def options(opt):
2014-01-30 11:45:06 +04:00
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)
2016-12-06 15:52:47 +03:00
opt.add_option('--enable-etcd-reclock',
help=("Enable etcd recovery lock helper (default=no)"),
action="store_true", dest='ctdb_etcd_reclock', default=False)
2022-08-08 04:26:54 +03:00
opt.add_option('--enable-pcap',
help=("Use pcap for packet capture (default=no)"),
action="store_true", dest='ctdb_pcap', default=False)
2018-07-09 15:53:00 +03:00
opt.add_option('--with-libcephfs',
help=("Directory under which libcephfs is installed"),
action="store", dest='libcephfs_dir', default=None)
2016-12-01 15:33:22 +03:00
opt.add_option('--enable-ceph-reclock',
help=("Enable Ceph CTDB recovery lock helper (default=no)"),
action="store_true", dest='ctdb_ceph_reclock', default=False)
2014-01-30 11:45:06 +04:00
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
2018-06-29 07:54:17 +03:00
conf.CHECK_HEADERS(headers='''sys/socket.h
netinet/in.h
netinet/if_ether.h
netinet/ip.h
netinet/ip6.h
netinet/icmp6.h''',
together=True)
2018-06-29 06:17:01 +03:00
conf.CHECK_CODE('int s = socket(AF_PACKET, SOCK_RAW, 0);',
define='HAVE_AF_PACKET',
headers='sys/socket.h linux/if_packet.h')
conf.CHECK_CODE('struct sockaddr_ll sall; sall.sll_family = AF_PACKET;',
define='HAVE_PACKETSOCKET',
headers='sys/socket.h linux/if_packet.h')
2021-02-12 11:13:11 +03:00
conf.CHECK_CODE('''pthread_mutex_t m;
int pid = 0;
m.__data.__owner = pid;
''',
'HAVE_PTHREAD_INTERNAL_MUTEX_OWNER',
headers='pthread.h',
msg='Checking for internal POSIX mutex owner field')
if not conf.env.HAVE_PTHREAD_INTERNAL_MUTEX_OWNER:
# This is unsupported - please see note in debug_locks.sh
Logs.info('Building without unsupported mutex debugging hack')
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
2019-02-15 06:13:48 +03:00
# This is just for consistency and to check the version for the
# build system, see Options.options.disable_python = True above
conf.SAMBA_CHECK_PYTHON()
conf.SAMBA_CHECK_PYTHON_HEADERS()
2014-08-15 10:41:57 +04:00
2019-06-28 16:07:34 +03:00
# We just want gnutls_rnd for rand subsystem
conf.CHECK_FUNCS_IN('gnutls_rnd', 'gnutls')
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')
2017-11-07 12:51:11 +03:00
if conf.env.standalone_ctdb or conf.CONFIG_GET('ENABLE_SELFTEST'):
conf.RECURSE('third_party/socket_wrapper')
conf.env.SOCKET_WRAPPER_SO_PATH = conf.CONFIG_GET('LIBSOCKET_WRAPPER_SO_PATH')
2014-07-23 08:34:17 +04:00
else:
if not conf.CHECK_POPT():
2018-06-15 17:01:59 +03:00
raise Errors.WafError('popt development packages have not been found\nIf third_party is installed, check that it is in the proper place.')
2014-07-23 08:34:17 +04:00
else:
conf.define('USING_SYSTEM_POPT', 1)
2017-11-07 12:51:11 +03:00
conf.env.SOCKET_WRAPPER_SO_PATH = ''
if conf.env.standalone_ctdb or conf.CONFIG_GET('ENABLE_SELFTEST'):
if not conf.CHECK_SOCKET_WRAPPER():
2018-06-15 17:01:59 +03:00
raise Errors.WafError('socket_wrapper package has not been found.\nIf third_party is installed, check that it is in the proper place.')
2017-11-07 12:51:11 +03:00
else:
conf.define('USING_SYSTEM_SOCKET_WRAPPER', 1)
conf.env.SOCKET_WRAPPER_SO_PATH = conf.CONFIG_GET('LIBSOCKET_WRAPPER_SO_PATH')
2014-07-23 08:34:17 +04:00
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')
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')
2019-01-18 09:43:44 +03:00
conf.CHECK_FUNCS('getrusage', headers="sys/time.h sys/resource.h")
2014-09-15 05:01:21 +04:00
2014-09-15 09:52:38 +04:00
if not conf.CHECK_VARIABLE('ETIME', headers='errno.h'):
conf.DEFINE('ETIME', 'ETIMEDOUT')
2022-08-08 04:26:54 +03:00
if Options.options.ctdb_pcap or not sys.platform.startswith('linux'):
conf.DEFINE('ENABLE_PCAP', 1)
if not conf.env.ENABLE_PCAP:
2014-09-15 10:10:16 +04:00
conf.SET_TARGET_TYPE('pcap', 'EMPTY')
else:
2021-07-23 07:39:05 +03:00
conf.find_program('pcap-config', var='PCAP_CONFIG')
if conf.env.PCAP_CONFIG:
conf.CHECK_CFG(path=conf.env.PCAP_CONFIG,
args="--cflags --libs",
package="",
uselib_store="PCAP")
2014-09-15 10:10:16 +04:00
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)
ctdb-common: Set immediate mode for pcap capture
Fix a problem where ctdb_killtcp (almost always) fails to capture
packets with --enable-pcap and libpcap ≥ 1.9.1. The problem is due to
a gradual change in libpcap semantics when using
pcap_get_selectable_fd(3PCAP) to get a file descriptor and then using
that file descriptor in non-blocking mode.
pcap_set_immediate_mode(3PCAP) says:
pcap_set_immediate_mode() sets whether immediate mode should be set
on a capture handle when the handle is activated. In immediate
mode, packets are always delivered as soon as they arrive, with no
buffering.
and
On Linux, with previous releases of libpcap, capture devices are
always in immediate mode; however, in 1.5.0 and later, they are, by
default, not in immediate mode, so if pcap_set_immediate_mode() is
available, it should be used.
However, it wasn't until libpcap commit
2ade7676101366983bd4f86bc039ffd25da8c126 (before libpcap 1.9.1) that
it became a requirement to use pcap_set_immediate_mode(), even with a
timeout of 0.
More explanation in this libpcap issue comment:
https://github.com/the-tcpdump-group/libpcap/issues/860#issuecomment-541204548
Do a configure check for pcap_set_immediate_mode() even though it has
existed for 10 years. It is easy enough.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15451
Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Aug 15 10:53:52 UTC 2023 on atb-devel-224
2023-08-15 05:34:20 +03:00
conf.CHECK_FUNCS_IN('pcap_set_immediate_mode', 'pcap', headers='pcap.h')
2014-09-15 10:10:16 +04:00
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:
2018-03-01 04:32:26 +03:00
conf.CHECK_TYPE_IN('__pmID_int', 'pcp/pmapi.h pcp/impl.h')
2014-01-30 11:45:06 +04:00
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)
2016-12-06 15:52:47 +03:00
have_etcd_reclock = False
if Options.options.ctdb_etcd_reclock:
try:
conf.check_python_module('etcd')
have_etcd_reclock = True
except:
Logs.error('etcd support not available')
sys.exit(1)
if have_etcd_reclock:
Logs.info('Building with etcd support')
conf.env.etcd_reclock = have_etcd_reclock
2019-06-18 15:35:02 +03:00
if Options.options.libcephfs_dir:
Logs.error('''--with-libcephfs no longer supported, please use compiler
flags instead, e.g. GCC LIBRARY_PATH and C_INCLUDE_PATH''')
sys.exit(1)
2018-07-09 15:53:00 +03:00
2019-06-18 15:35:02 +03:00
if Options.options.ctdb_ceph_reclock:
2016-12-01 15:33:22 +03:00
if (conf.CHECK_HEADERS('rados/librados.h', False, False, 'rados') and
conf.CHECK_LIB('rados', shlib=True)):
Logs.info('Building with Ceph librados recovery lock support')
conf.define('HAVE_LIBRADOS', 1)
else:
Logs.error("Missing librados for Ceph recovery lock support")
sys.exit(1)
2014-01-30 11:45:06 +04:00
conf.env.CTDB_BINDIR = os.path.join(conf.env.EXEC_PREFIX, 'bin')
2018-07-06 09:37:55 +03:00
conf.env.CTDB_DATADIR = os.path.join(conf.env.EXEC_PREFIX, 'share/ctdb')
2014-01-30 11:45:06 +04:00
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\"
2018-07-06 09:37:55 +03:00
-DCTDB_DATADIR=\"%s\"
2014-06-23 12:03:17 +04:00
-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,
2018-07-06 09:37:55 +03:00
conf.env.CTDB_DATADIR,
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
2018-07-06 09:37:55 +03:00
conf.env.CTDB_TEST_DATADIR = os.path.join(conf.env.CTDB_DATADIR, 'tests')
2016-08-03 14:23:31 +03:00
conf.env.CTDB_TEST_LIBEXECDIR = os.path.join(conf.env.LIBEXECDIR, 'ctdb/tests')
2014-01-30 11:45:06 +04:00
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:
2018-06-27 14:56:32 +03:00
if Context.g_module.top == '.':
2014-08-25 07:46:00 +04:00
# 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 = []
2016-12-06 15:52:47 +03:00
manpages = manpages_binary + manpages_misc
if conf.env.etcd_reclock:
2016-12-01 16:22:45 +03:00
manpages += manpages_etcd
if conf.env.HAVE_LIBRADOS:
manpages += manpages_ceph
2015-11-10 02:14:56 +03:00
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
2014-08-25 07:46:00 +04:00
if bld.env.standalone_ctdb:
2017-04-21 08:39:45 +03:00
bld.SAMBA_MKVERSION('version.h', '%s/VERSION' % vdir)
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')
2017-11-07 12:51:11 +03:00
if bld.env.standalone_ctdb or bld.CONFIG_GET('SOCKET_WRAPPER'):
bld.RECURSE('third_party/socket_wrapper')
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')
2019-06-28 16:10:38 +03:00
bld.RECURSE('lib/pthreadpool')
bld.RECURSE('lib/messaging')
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')
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'
bld.SAMBA_SUBSYSTEM('ctdb-system',
2015-11-11 08:52:30 +03:00
source=bld.SUBDIR('common',
2018-06-28 14:12:04 +03:00
'system_socket.c system.c'),
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-09-16 09:13:18 +03:00
sock_io.c'''),
2015-10-13 09:57:49 +03:00
includes='include',
2017-09-19 16:44:31 +03:00
deps='''replace popt talloc tevent tdb popt ctdb-system
ctdb-protocol-util''')
2015-08-03 08:38:32 +03:00
2015-03-17 04:35:31 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-util',
source=bld.SUBDIR('common',
2022-05-04 02:17:40 +03:00
'''cmdline.c
comm.c
conf.c
db_hash.c
event_script.c
2018-07-12 06:20:55 +03:00
hash_count.c
2022-05-04 02:17:40 +03:00
line.c
logging.c
path.c
pidfile.c
pkt_read.c
pkt_write.c
rb_tree.c
reqid.c
run_event.c
run_proc.c
2019-03-15 04:14:27 +03:00
sock_client.c
2022-05-04 02:17:40 +03:00
srvid.c
2022-02-01 03:44:48 +03:00
tmon.c
2022-05-04 02:17:40 +03:00
tunable.c
2018-04-24 16:17:18 +03:00
'''),
2022-02-01 03:44:48 +03:00
deps='''samba-util
LIBASYNC_REQ
sys_rw
tevent-util
replace
talloc
tevent
tdb
popt
''')
2015-03-17 04:35:31 +03:00
2017-12-15 10:38:40 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-logging-conf',
source='common/logging_conf.c',
deps='ctdb-util talloc')
2018-03-01 10:20:19 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-protocol-basic',
source=bld.SUBDIR('protocol', 'protocol_basic.c'),
deps='talloc tdb')
2015-04-14 10:20:05 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-protocol',
source=bld.SUBDIR('protocol',
'''protocol_header.c protocol_packet.c
2018-03-01 10:20:19 +03:00
protocol_types.c
2017-07-13 10:28:42 +03:00
protocol_call.c
2015-04-14 10:20:05 +03:00
protocol_message.c
protocol_control.c
2017-06-28 09:50:53 +03:00
protocol_keepalive.c
2017-04-05 09:25:42 +03:00
protocol_tunnel.c
2015-04-14 10:20:05 +03:00
protocol_client.c
2016-03-10 06:00:56 +03:00
protocol_debug.c
2017-07-07 10:21:54 +03:00
protocol_sock.c'''),
2018-03-01 10:20:19 +03:00
deps='ctdb-protocol-basic replace talloc tdb')
2015-04-14 10:20:05 +03:00
2017-09-04 09:00:48 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-protocol-util',
source='protocol/protocol_util.c',
2018-07-11 11:35:46 +03:00
deps='ctdb-util replace talloc tdb')
2017-09-04 09:00:48 +03:00
2018-04-30 12:38:47 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-client',
2015-04-14 17:14:25 +03:00
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
2018-06-21 09:56:43 +03:00
client_tunnel.c
2015-04-14 17:14:25 +03:00
'''),
2022-05-02 07:25:42 +03:00
deps='''ctdb-protocol
ctdb-util
samba-util
replace
talloc
tevent
tdb
tdb-wrap
''')
2015-04-14 17:14:25 +03:00
2016-09-03 16:27:23 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-server-util',
source=bld.SUBDIR('common',
'''sock_daemon.c'''),
2018-02-06 08:42:39 +03:00
deps='''samba-util ctdb-util ctdb-system tevent-util
2017-11-02 09:33:19 +03:00
LIBASYNC_REQ replace talloc tevent''')
2016-09-03 16:27:23 +03:00
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',
2017-09-04 09:00:48 +03:00
deps='ctdb-protocol-util replace talloc tevent')
2015-11-23 08:18:16 +03:00
2018-05-08 06:23:15 +03:00
bld.SAMBA_BINARY('ctdb-path',
source='common/path_tool.c',
cflags='-DCTDB_PATH_TOOL',
deps='''ctdb-util samba-util talloc replace popt''',
install_path='${CTDB_HELPER_BINDIR}')
2018-04-20 10:11:59 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-cluster-conf',
source='cluster/cluster_conf.c',
deps='ctdb-util')
2018-04-20 10:10:51 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-database-conf',
source='database/database_conf.c',
deps='ctdb-util')
2018-04-23 07:02:43 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-event-conf',
source='event/event_conf.c',
deps='ctdb-util')
2018-08-21 04:30:39 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-failover-conf',
source='failover/failover_conf.c',
deps='ctdb-util')
2018-04-11 13:36:45 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-legacy-conf',
source='server/legacy_conf.c',
deps='ctdb-util')
2018-04-27 10:21:00 +03:00
bld.SAMBA_BINARY('ctdb-config',
source='common/conf_tool.c',
cflags='-DCTDB_CONF_TOOL',
2018-04-17 15:15:41 +03:00
deps='''ctdb-logging-conf
2018-04-17 05:38:30 +03:00
ctdb-event-conf
2018-05-11 15:26:16 +03:00
ctdb-cluster-conf
2018-05-11 15:42:42 +03:00
ctdb-database-conf
2018-08-21 04:44:03 +03:00
ctdb-failover-conf
2018-05-11 15:49:46 +03:00
ctdb-legacy-conf
2018-04-17 15:15:41 +03:00
ctdb-util samba-util talloc replace popt''',
2018-04-27 10:21:00 +03:00
install_path='${CTDB_HELPER_BINDIR}')
2018-02-15 09:33:12 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-event-protocol',
source=bld.SUBDIR('event',
'''event_protocol.c
event_protocol_util.c
'''),
deps='ctdb-protocol-basic')
2018-04-24 10:22:42 +03:00
bld.SAMBA_LIBRARY('ctdb-event-client',
source='event/event_client.c',
deps='ctdb-event-protocol ctdb-util tevent talloc',
private_library=True)
2018-03-03 18:11:16 +03:00
bld.SAMBA_BINARY('ctdb-eventd',
source=bld.SUBDIR('event',
'''event_cmd.c
event_config.c
event_context.c
event_daemon.c
event_request.c
'''),
deps='''ctdb-event-protocol
ctdb-event-conf ctdb-logging-conf
ctdb-server-util samba-util ctdb-util
talloc tevent replace popt''',
install_path='${CTDB_HELPER_BINDIR}')
2018-04-26 11:46:27 +03:00
bld.SAMBA_BINARY('ctdb-event',
source='event/event_tool.c',
cflags='-DCTDB_EVENT_TOOL',
deps='''ctdb-event-client ctdb-event-protocol
ctdb-util samba-util talloc replace''',
install_path='${CTDB_HELPER_BINDIR}')
2018-03-03 18:11:16 +03:00
2016-08-30 10:27:47 +03:00
bld.SAMBA_BINARY('ctdbd',
source='server/ctdbd.c ' +
2014-01-30 11:45:06 +04:00
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_uptime.c
2014-01-30 11:45:06 +04:00
ctdb_vacuum.c ctdb_banning.c
ctdb_statistics.c
ctdb_update_record.c
2017-04-06 12:03:51 +03:00
ctdb_lock.c ctdb_fork.c
2018-04-18 13:21:07 +03:00
ctdb_tunnel.c ctdb_client.c
ctdb_config.c
'''),
2016-08-30 10:27:47 +03:00
includes='include',
2018-04-30 12:36:43 +03:00
deps='''ctdb-common ctdb-system ctdb-protocol
2016-08-30 10:27:47 +03:00
ctdb-tcp ctdb-util replace sys_rw popt
2018-04-18 13:21:07 +03:00
ctdb-logging-conf
ctdb-cluster-conf
ctdb-database-conf
ctdb-event-conf
2018-08-21 06:41:22 +03:00
ctdb-failover-conf
2018-04-18 13:21:07 +03:00
ctdb-legacy-conf
2018-06-21 10:16:07 +03:00
ctdb-event-protocol
2018-04-30 12:36:43 +03:00
talloc tevent tdb-wrap tdb talloc_report''' +
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
2015-07-17 15:45:04 +03:00
bld.SAMBA_BINARY('ctdb',
source='tools/ctdb.c',
2018-04-30 12:38:47 +03:00
deps='''ctdb-client ctdb-protocol ctdb-protocol-util
2017-09-04 09:00:48 +03:00
ctdb-util ctdb-system samba-util sys_rw popt''',
2015-07-17 15:45:04 +03:00
install_path='${BINDIR}',
manpages='ctdb.1')
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',
2017-09-04 09:00:48 +03:00
deps='''ctdb-protocol-util ctdb-util ctdb-system
2016-03-03 02:34:48 +03:00
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',
2016-11-29 09:20:45 +03:00
deps='''samba-util sys_rw ctdb-system tevent-util
talloc tevent 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
2015-06-29 07:56:53 +03:00
bld.SAMBA_BINARY('ctdb_recovery_helper',
source='server/ctdb_recovery_helper.c',
2018-04-30 12:38:47 +03:00
deps='''ctdb-client ctdb-protocol ctdb-util
2016-11-29 04:55:06 +03:00
samba-util sys_rw replace tdb''',
2016-02-12 02:12:13 +03:00
install_path='${CTDB_HELPER_BINDIR}')
2016-11-10 08:47:38 +03:00
bld.SAMBA_BINARY('ctdb_takeover_helper',
source='server/ctdb_takeover_helper.c',
2018-04-30 12:38:47 +03:00
deps='''ctdb-client ctdb-protocol ctdb-util
2016-11-10 08:47:38 +03:00
samba-util sys_rw replace ctdb-ipalloc popt''',
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',
2022-01-21 05:37:17 +03:00
deps='''sys_rw ctdb-system tevent-util ctdb-util
2019-06-27 06:45:01 +03:00
talloc tevent
''',
2015-12-08 08:23:50 +03:00
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}')
2019-06-25 03:03:44 +03:00
xdr_buf_hack = 'grep -Fv "register int32_t *buf;"'
2014-08-04 08:52:00 +04:00
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'),
2018-01-16 19:48:10 +03:00
deps='ctdb-smnotify-h ctdb-smnotify-c ctdb-smnotify-x popt tirpc',
2014-01-30 11:45:06 +04:00
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
2021-02-12 11:13:11 +03:00
if bld.env.HAVE_PTHREAD_INTERNAL_MUTEX_OWNER:
bld.SAMBA_BINARY('tdb_mutex_check',
source='utils/tdb/tdb_mutex_check.c',
deps='tdb pthread',
install_path='${CTDB_HELPER_BINDIR}')
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',
2018-04-30 12:38:47 +03:00
deps='''ctdb-client ctdb-protocol ctdb-util
2015-10-14 07:49:12 +03:00
samba-util 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')
2016-12-01 15:33:22 +03:00
if bld.env.HAVE_LIBRADOS:
bld.SAMBA_BINARY('ctdb_mutex_ceph_rados_helper',
source='utils/ceph/ctdb_mutex_ceph_rados_helper.c',
2019-06-13 18:20:02 +03:00
deps='talloc tevent rados',
2019-06-18 15:35:02 +03:00
includes='include',
2016-12-01 15:33:22 +03:00
install_path='${CTDB_HELPER_BINDIR}')
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)
2018-07-06 09:37:55 +03:00
sed_expr8 = 's|/usr/local/share/ctdb|%s|g' % (bld.env.CTDB_DATADIR)
sed_cmdline = '-e "%s" ' * 8 % \
2016-02-12 02:12:13 +03:00
(sed_expr1, sed_expr2, sed_expr3, sed_expr4, sed_expr5,
2018-07-06 09:37:55 +03:00
sed_expr6, sed_expr7, sed_expr8)
2015-08-13 08:17:51 +03:00
2020-09-10 20:50:53 +03:00
manpages_extra = list(manpages_misc)
2016-12-06 15:52:47 +03:00
if bld.env.etcd_reclock:
2016-12-01 16:22:45 +03:00
manpages_extra += manpages_etcd
if bld.env.HAVE_LIBRADOS:
manpages_extra += manpages_ceph
2016-12-08 07:38:36 +03:00
for f in manpages_binary + manpages_extra:
2015-08-13 08:17:51 +03:00
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:
2016-12-08 07:38:36 +03:00
bld.MANPAGES(' '.join(manpages_extra), 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',
2018-12-05 02:05:36 +03:00
destname='onnode', chmod=MODE_755)
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',
2018-12-05 02:05:36 +03:00
destname='ctdb_diagnostics', chmod=MODE_755)
2015-08-17 13:47:58 +03:00
2016-12-06 15:52:47 +03:00
if bld.env.etcd_reclock:
bld.SAMBA_GENERATOR('ctdb-etcd-lock',
source='utils/etcd/ctdb_etcd_lock',
target='ctdb_etcd_lock',
rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
bld.INSTALL_FILES('${CTDB_HELPER_BINDIR}', 'ctdb_etcd_lock',
2018-12-05 02:05:36 +03:00
destname='ctdb_etcd_lock', chmod=MODE_744)
2016-07-25 22:58:16 +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',
2018-12-05 02:05:36 +03:00
destname='ctdb_natgw', chmod=MODE_755)
2015-12-14 03:34:41 +03:00
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',
2018-12-05 02:05:36 +03:00
destname='ctdb_lvs', chmod=MODE_755)
2016-04-07 10:30:28 +03:00
2014-01-30 11:45:06 +04:00
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
2018-12-05 02:05:36 +03:00
mode = os.lstat(fl).st_mode & MODE_777
2014-01-30 11:45:06 +04:00
if arg['trim_path']:
2019-11-04 07:07: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': []}
2018-11-19 14:05:29 +03:00
for dirname, _subdirs, fnames in os.walk(path):
SUBDIR_MODE_callback(pd, dirname, fnames)
2014-07-08 06:00:00 +04:00
return pd['file_list']
2014-01-30 11:45:06 +04:00
2018-07-06 09:38:43 +03:00
event_script_subdirs = [
2018-05-15 06:39:15 +03:00
'events/legacy',
2018-07-06 09:38:43 +03:00
]
etc_subdirs = [
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'
2018-07-06 09:38:43 +03:00
for t in event_script_subdirs:
bld.INSTALL_DIR(os.path.join(bld.env.CTDB_ETCDIR, t))
files = SUBDIR_MODE('%s/%s' % (configdir, t), trim_path=configdir)
for fmode in files:
bld.INSTALL_FILES(bld.env.CTDB_DATADIR, 'config/%s' % fmode[0],
destname=fmode[0], chmod=fmode[1])
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])
2018-07-07 08:23:27 +03:00
# If this is a direct install and there are no event scripts
# linked/enabled then enable some standard ones
if os.environ.get('DESTDIR') is None:
fmt = 'events/legacy/%s.script'
required_script = '00.ctdb'
required_path = os.path.join(bld.env.CTDB_ETCDIR,
fmt % (required_script))
if not os.path.islink(required_path) and \
not os.path.exists(required_path):
default_scripts = [ required_script,
'01.reclock',
'05.system',
'10.interface',
]
for t in default_scripts:
tgt = os.path.join(bld.env.CTDB_DATADIR, fmt % (t))
name = os.path.join(bld.env.CTDB_ETCDIR, fmt % (t))
bld.symlink_as(name, tgt)
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',
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,
2018-12-05 02:05:36 +03:00
destname=t, chmod=MODE_755)
2014-01-30 11:45:06 +04:00
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')
2018-05-16 05:18:46 +03:00
bld.INSTALL_FILES('${CTDB_ETCDIR}/events/notification',
'config/notification.README',
2014-01-30 11:45:06 +04:00
destname='README')
2018-09-09 13:34:31 +03:00
bld.INSTALL_DIR(bld.env.CTDB_LOGDIR)
bld.INSTALL_DIR(bld.env.CTDB_RUNDIR)
bld.INSTALL_DIR(bld.env.CTDB_VARDIR)
2014-01-30 11:45:06 +04:00
2018-05-14 08:41:35 +03:00
for d in ['volatile', 'persistent', 'state']:
2018-09-09 13:34:31 +03:00
bld.INSTALL_DIR(os.path.join(bld.env.CTDB_VARDIR, d))
2018-05-14 08:41:35 +03:00
2017-02-16 11:23:44 +03:00
#
# Test-only below this point
#
if not bld.env.standalone_ctdb and not bld.CONFIG_GET('ENABLE_SELFTEST'):
return
2018-07-10 10:38:42 +03:00
bld.SAMBA_BINARY('errcode',
source='tests/src/errcode.c',
deps='replace',
install_path='${CTDB_TEST_LIBEXECDIR}')
2018-07-10 12:09:00 +03:00
bld.SAMBA_BINARY('sigcode',
source='tests/src/sigcode.c',
deps='replace',
install_path='${CTDB_TEST_LIBEXECDIR}')
2018-07-10 10:38:42 +03:00
2015-03-17 04:35:31 +03:00
# Unit tests
2022-05-04 02:17:40 +03:00
ctdb_util_tests = [
'cmdline_test',
'comm_client_test',
'comm_server_test',
'comm_test',
'conf_test',
2015-03-17 04:35:31 +03:00
'db_hash_test',
2022-05-04 02:17:40 +03:00
'event_script_test',
'hash_count_test',
'line_test',
'pidfile_test',
2015-09-02 15:32:50 +03:00
'pkt_read_test',
2015-04-06 10:26:29 +03:00
'pkt_write_test',
2022-05-04 02:17:40 +03:00
'run_event_test',
2016-08-30 10:33:42 +03:00
'run_proc_test',
2017-01-04 16:48:32 +03:00
'sock_io_test',
2022-05-04 02:17:40 +03:00
'srvid_test',
2022-01-31 06:36:23 +03:00
'tunable_test',
2015-03-17 04:35:31 +03:00
]
2022-05-04 02:17:40 +03:00
for target in ctdb_util_tests:
2015-03-17 04:35:31 +03:00
src = 'tests/src/' + target + '.c'
bld.SAMBA_BINARY(target,
source=src,
2022-05-04 02:21:38 +03:00
deps='''ctdb-tests-backtrace
LIBASYNC_REQ
samba-util
sys_rw
tevent-util
talloc
tevent
tdb
popt
''',
2016-08-03 14:23:31 +03:00
install_path='${CTDB_TEST_LIBEXECDIR}')
2015-03-17 04:35:31 +03:00
2015-03-17 05:29:44 +03:00
bld.SAMBA_BINARY('reqid_test',
source='tests/src/reqid_test.c',
2022-07-22 04:41:57 +03:00
deps='samba-util talloc',
2016-08-03 14:23:31 +03:00
install_path='${CTDB_TEST_LIBEXECDIR}')
2015-03-17 05:29:44 +03:00
2016-04-20 08:56:13 +03:00
bld.SAMBA_BINARY('rb_test',
source='tests/src/rb_test.c',
deps='samba-util talloc',
2016-08-03 14:23:31 +03:00
install_path='${CTDB_TEST_LIBEXECDIR}')
2016-04-20 08:56:13 +03:00
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',
2016-08-03 14:23:31 +03:00
install_path='${CTDB_TEST_LIBEXECDIR}')
2016-03-10 07:44:24 +03:00
2018-08-11 11:32:17 +03:00
bld.SAMBA_BINARY('system_socket_test',
source='tests/src/system_socket_test.c',
2022-05-04 02:02:12 +03:00
deps='''ctdb-tests-backtrace
2022-02-28 07:44:59 +03:00
talloc
ctdb-protocol-util
pcap
''',
2018-08-11 11:32:17 +03:00
install_path='${CTDB_TEST_LIBEXECDIR}')
2016-04-20 09:14:39 +03:00
bld.SAMBA_BINARY('porting_tests',
source='tests/src/porting_tests.c',
deps='samba-util ctdb-system popt',
2016-08-03 14:23:31 +03:00
install_path='${CTDB_TEST_LIBEXECDIR}')
2018-02-06 08:42:39 +03:00
bld.SAMBA_BINARY('sock_daemon_test',
source='tests/src/sock_daemon_test.c',
deps='''ctdb-system talloc tevent tevent-util
LIBASYNC_REQ samba-util sys_rw''',
install_path='${CTDB_TEST_LIBEXECDIR}')
2016-04-20 09:14:39 +03:00
2019-02-19 23:59:05 +03:00
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}')
2019-08-01 08:33:52 +03:00
bld.SAMBA_BINARY('ctdb-db-test',
source='tests/src/db_test_tool.c',
cflags='-DCTDB_DB_TEST_TOOL',
deps='''ctdb-client ctdb-protocol
ctdb-util samba-util talloc tevent replace''',
install_path='${CTDB_TEST_LIBEXECDIR}')
2019-02-19 23:59:05 +03:00
2022-02-02 13:47:59 +03:00
for target in ['tmon_ping_test', 'tmon_test']:
src = 'tests/src/' + target + '.c'
bld.SAMBA_BINARY(target,
source=src,
deps='''ctdb-util
ctdb-tests-backtrace
LIBASYNC_REQ
samba-util
sys_rw
tevent-util
talloc
tevent
tdb
popt
''',
install_path='${CTDB_TEST_LIBEXECDIR}')
2018-03-05 08:45:42 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-protocol-tests-basic',
source=bld.SUBDIR('tests/src',
'protocol_common_basic.c'),
2022-01-04 14:19:19 +03:00
deps='samba-util replace talloc')
2018-03-05 08:45:42 +03:00
2018-04-26 10:37:03 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-protocol-tests-common',
2017-07-14 10:09:57 +03:00
source=bld.SUBDIR('tests/src',
'''protocol_common.c
protocol_common_ctdb.c
'''),
2018-03-05 08:45:42 +03:00
deps='ctdb-protocol-tests-basic replace talloc tdb')
bld.SAMBA_BINARY('protocol_basic_test',
source=bld.SUBDIR('tests/src', 'protocol_basic_test.c'),
deps='ctdb-protocol-tests-basic talloc',
install_path='${CTDB_TEST_LIBEXECDIR}')
2017-07-14 10:09:57 +03:00
ctdb_protocol_tests = [
'protocol_types_test',
'protocol_ctdb_test',
'protocol_util_test',
2017-08-14 09:28:16 +03:00
'protocol_types_compat_test',
2017-08-15 08:41:26 +03:00
'protocol_ctdb_compat_test',
2017-07-14 10:09:57 +03:00
]
for target in ctdb_protocol_tests:
src = 'tests/src/' + target + '.c'
bld.SAMBA_BINARY(target,
source=src,
2018-04-26 10:37:03 +03:00
deps='''ctdb-protocol-tests-common
2018-07-11 11:35:46 +03:00
samba-util ctdb-util talloc tdb''',
2017-07-14 10:09:57 +03:00
install_path='${CTDB_TEST_LIBEXECDIR}')
2014-01-30 11:45:06 +04:00
2018-02-15 09:33:12 +03:00
bld.SAMBA_BINARY('event_protocol_test',
source='event/event_protocol_test.c',
deps='''ctdb-protocol-tests-basic
ctdb-protocol-basic talloc''',
install_path='${CTDB_TEST_LIBEXECDIR}')
2015-11-18 04:18:14 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-tests-common',
source=bld.SUBDIR('tests/src',
2022-01-05 05:45:33 +03:00
'''cluster_wait.c
test_options.c
'''),
2022-05-02 07:25:42 +03:00
deps='''ctdb-client
samba-util
replace
popt
talloc
tevent
tdb''')
2015-11-18 04:18:14 +03:00
2022-05-04 02:02:12 +03:00
bld.SAMBA_SUBSYSTEM('ctdb-tests-backtrace',
source=bld.SUBDIR('tests/src',
'test_backtrace.c'),
deps='''samba-util
replace''')
2016-05-23 04:53:26 +03:00
# Test binaries
2016-04-19 09:18:54 +03:00
ctdb_tests = [
2015-11-10 08:00:07 +03:00
'g_lock_loop',
2015-11-18 00:51:41 +03:00
'message_ring',
2015-11-20 08:24:34 +03:00
'fetch_ring',
2016-04-20 07:49:47 +03:00
'fetch_loop',
2016-05-05 07:51:07 +03:00
'fetch_loop_key',
2015-11-21 14:50:59 +03:00
'fetch_readonly',
2016-04-18 10:11:36 +03:00
'fetch_readonly_loop',
2016-04-20 07:27:40 +03:00
'transaction_loop',
2016-04-20 07:29:56 +03:00
'update_record',
2016-04-20 09:03:41 +03:00
'update_record_persistent',
2017-08-30 06:05:32 +03:00
'lock_tdb',
2017-06-26 11:06:18 +03:00
'dummy_client',
'tunnel_test',
2017-08-11 08:53:28 +03:00
'tunnel_cmd',
2016-04-19 09:18:54 +03:00
]
for target in ctdb_tests:
src = 'tests/src/' + target + '.c'
bld.SAMBA_BINARY(target,
source=src,
includes='include',
2018-04-30 12:38:47 +03:00
deps='''ctdb-client ctdb-protocol ctdb-util
2016-04-19 09:18:54 +03:00
samba-util ctdb-tests-common''',
2016-08-03 14:23:31 +03:00
install_path='${CTDB_TEST_LIBEXECDIR}')
2016-04-19 09:18:54 +03:00
2014-08-21 11:26:14 +04:00
bld.SAMBA_BINARY('ctdb_takeover_tests',
2016-12-03 08:20:01 +03:00
source='''tests/src/ctdb_takeover_tests.c
tests/src/ipalloc_read_known_ips.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',
2016-08-03 14:23:31 +03:00
install_path='${CTDB_TEST_LIBEXECDIR}')
2014-01-30 11:45:06 +04:00
2016-04-22 10:30:52 +03:00
bld.SAMBA_BINARY('fake_ctdbd',
2016-12-03 09:11:25 +03:00
source='''tests/src/fake_ctdbd.c
tests/src/ipalloc_read_known_ips.c''',
2017-09-04 09:00:48 +03:00
deps='''ctdb-util ctdb-protocol ctdb-protocol-util
ctdb-system samba-util tevent-util
LIBASYNC_REQ popt''',
2016-08-03 14:23:31 +03:00
install_path='${CTDB_TEST_LIBEXECDIR}')
2016-04-22 10:30:52 +03:00
2019-07-04 14:52:00 +03:00
bld.SAMBA_BINARY('cluster_mutex_test',
source='tests/src/cluster_mutex_test.c',
2022-05-04 02:02:12 +03:00
deps='''ctdb-tests-backtrace
2022-02-28 07:44:59 +03:00
samba-util
talloc
tevent
''',
2019-07-04 14:52:00 +03:00
install_path='${CTDB_TEST_LIBEXECDIR}')
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',
2018-04-30 12:37:04 +03:00
deps='replace talloc ctdb-common sys_rw' +
2014-01-30 11:45:06 +04:00
ib_deps,
2016-08-03 14:23:31 +03:00
install_path='${CTDB_TEST_LIBEXECDIR}')
2014-01-30 11:45:06 +04:00
2019-07-12 11:49:13 +03:00
if bld.env.HAVE_ROBUST_MUTEXES and sys.platform.startswith('linux') and bld.env.DEVELOPER:
2017-01-31 06:50:53 +03:00
bld.SAMBA_BINARY('test_mutex_raw',
source='tests/src/test_mutex_raw.c',
deps='pthread',
install_path='${CTDB_TEST_LIBEXECDIR}')
2016-12-02 07:11:20 +03:00
2014-01-30 11:45:06 +04:00
test_subdirs = [
2019-09-09 08:59:31 +03:00
'CLUSTER',
2019-09-09 09:00:52 +03:00
'INTEGRATION',
2019-09-09 03:42:11 +03:00
'UNIT',
2019-09-09 09:00:52 +03:00
'etc-ctdb'
2014-01-30 11:45:06 +04:00
]
2017-02-01 07:53:47 +03:00
if bld.env.standalone_ctdb:
testdir = 'tests'
else:
testdir = 'ctdb/tests'
2014-01-30 11:45:06 +04:00
for t in test_subdirs:
2017-02-01 07:53:47 +03:00
files = SUBDIR_MODE('%s/%s' % (testdir, t), trim_path=testdir)
2014-01-30 11:45:06 +04:00
for fmode in files:
bld.INSTALL_FILES(bld.env.CTDB_TEST_DATADIR, 'tests/%s' % fmode[0],
destname=fmode[0], chmod=fmode[1])
2019-09-05 07:01:20 +03:00
# Install tests/scripts directory, excluding files that need munging
2014-06-23 10:31:25 +04:00
test_scripts = [
2019-09-11 08:44:20 +03:00
'cluster.bash',
2014-06-23 10:31:25 +04:00
'common.sh',
'integration.bash',
2019-09-05 07:01:20 +03:00
'integration_local_daemons.bash',
'integration_real_cluster.bash',
2014-06-23 10:31:25 +04:00
'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))
2019-08-12 15:10:41 +03:00
bld.INSTALL_FILES(bld.env.CTDB_TEST_DATADIR,
'tests/scripts/test_wrap',
destname='scripts/test_wrap',
chmod=MODE_755)
2014-01-30 11:45:06 +04:00
2016-07-14 04:58:51 +03:00
bld.SAMBA_GENERATOR('ctdb-test-script-install-paths',
source='tests/scripts/script_install_paths.sh',
target='script_install_paths.sh',
rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline))
bld.INSTALL_FILES(bld.env.CTDB_TEST_DATADIR+"/scripts",
'script_install_paths.sh',
2018-12-05 02:05:36 +03:00
destname='script_install_paths.sh', chmod=MODE_644)
2016-07-14 04:58:51 +03:00
2019-08-05 03:18:08 +03:00
sed_expr1 = 's@^\\(%s\\)=.*@\\1=%s@' % (
2018-10-09 08:43:12 +03:00
'CTDB_TEST_DIR', bld.env.CTDB_TEST_DATADIR)
2019-08-05 03:18:08 +03:00
sed_expr2 = 's@^\\(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',
2018-12-05 02:05:36 +03:00
destname='ctdb_run_tests', chmod=MODE_755)
2014-01-30 11:45:06 +04:00
bld.symlink_as(os.path.join(bld.env.BINDIR, 'ctdb_run_cluster_tests'),
'ctdb_run_tests')
2018-10-11 11:32:09 +03:00
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',
2018-12-05 02:05:36 +03:00
destname='ctdb_local_daemons', chmod=MODE_755)
2018-10-11 11:32:09 +03:00
2014-01-30 11:45:06 +04:00
def testonly(ctx):
2019-10-17 08:19:58 +03:00
cmd = 'tests/run_tests.sh'
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):
2018-07-04 11:05:10 +03:00
Options.commands.append('build')
Options.commands.append('testonly')
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 autotest(ctx):
2016-06-21 10:50:53 +03:00
env = samba_utils.LOAD_ENVIRONMENT()
2019-10-17 08:19:33 +03:00
cmd = 'tests/run_tests.sh -eL -S %s' % env.SOCKET_WRAPPER_SO_PATH
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):
2018-07-27 16:37:29 +03:00
print(get_version_string())
2014-01-30 11:45:06 +04:00
2014-07-08 06:00:00 +04:00
2017-02-21 14:30:30 +03:00
def manpages(ctx):
BASE_URL = 'http://docbook.sourceforge.net/release/xsl/current'
MAN_XSL = '%s/manpages/docbook.xsl' % BASE_URL
HTML_XSL = '%s/html/docbook.xsl' % BASE_URL
CMD_TEMPLATE = 'xsltproc --xinclude -o %s --nonet %s %s'
manpages = manpages_binary + manpages_misc + manpages_etcd + manpages_ceph
for t in manpages:
cmd = CMD_TEMPLATE % ('doc/%s' % t, MAN_XSL, 'doc/%s.xml' % t)
ret = samba_utils.RUN_COMMAND(cmd)
if ret != 0:
print('Command %s failed with exit status %d' % (cmd, ret))
sys.exit(ret)
cmd = CMD_TEMPLATE % ('doc/%s.html' % t, HTML_XSL, 'doc/%s.xml' % t)
ret = samba_utils.RUN_COMMAND(cmd)
if ret != 0:
print('Command %s failed with exit status %d' % (cmd, ret))
sys.exit(ret)
def distonly(ctx):
2014-01-30 11:45:06 +04:00
samba_dist.DIST_FILES('VERSION:VERSION', extend=True)
t = 'ctdb.spec'
2018-09-09 01:11:33 +03:00
sed_expr1 = 's/@VERSION@/%s/g' % get_version_string()
2014-01-30 11:45:06 +04:00
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)
2016-12-01 16:22:45 +03:00
manpages = manpages_binary + manpages_misc + manpages_etcd + manpages_ceph
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
2017-02-21 14:30:30 +03:00
def dist():
2018-07-04 11:05:10 +03:00
Options.commands.append('manpages')
Options.commands.append('distonly')
2017-02-21 14:30:30 +03: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 ''
2018-09-09 01:11:33 +03:00
cmd = 'rpmbuild -ta --clean --rmsource %s ctdb-%s.tar.gz' % \
(opts, get_version_string())
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):
2018-07-04 11:05:10 +03:00
Options.commands.append('manpages')
Options.commands.append('distonly')
Options.commands.append('rpmonly')
2014-06-10 10:30:38 +04:00
2014-07-08 06:00:00 +04:00
2014-01-30 11:45:06 +04:00
def ctags(ctx):
"build 'tags' file using ctags"
2018-06-27 14:56:32 +03:00
source_root = os.path.dirname(Context.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)