X-Git-Url: http://git.samba.org/samba.git/?p=vlendec%2Fsamba-autobuild%2F.git;a=blobdiff_plain;f=ctdb%2Fwscript;h=3fa525b564da837b3b82429236129d2d3d2aaf6c;hp=e12da085d902e9eece2da2f3d42c5d327b01a820;hb=e72c3c800a50fe746164e319e21180c44d041619;hpb=f9104d46596919dd0e55c841533b26c7f90526fe diff --git a/ctdb/wscript b/ctdb/wscript index e12da085d90..3fa525b564d 100644 --- a/ctdb/wscript +++ b/ctdb/wscript @@ -2,20 +2,21 @@ 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') +top = '.' +while not os.path.exists(top+'/buildtools') and len(top.split('/')) < 5: + top = top + '/..' +sys.path.insert(0, top + '/buildtools/wafsamba') + +out = 'bin' -import wafsamba, samba_dist, Options, Logs, Utils -import samba_utils, samba_version +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 -env = samba_utils.LOAD_ENVIRONMENT() if os.path.isfile('./VERSION'): vdir = '.' elif os.path.isfile('../VERSION'): @@ -23,9 +24,6 @@ elif os.path.isfile('../VERSION'): else: Logs.error("VERSION file not found") -version = samba_version.samba_version_file('%s/VERSION' % vdir, vdir, env) -VERSION = version.STRING.replace('-', '.') - default_prefix = Options.default_prefix = '/usr/local' samba_dist.DIST_DIRS('''ctdb:. lib/replace:lib/replace lib/talloc:lib/talloc @@ -64,8 +62,22 @@ manpages_ceph = [ 'ctdb_mutex_ceph_rados_helper.7', ] +VERSION = '' + +def get_version(): + import samba_version + env = samba_utils.LOAD_ENVIRONMENT() + + return samba_version.samba_version_file('%s/VERSION' % vdir, vdir, env) -def set_options(opt): +def get_version_string(): + if Context.g_module.VERSION: + return Context.g_module.VERSION + version = get_version() + Context.g_module.VERSION = version.STRING.replace('-', '.') + return Context.g_module.VERSION + +def options(opt): opt.PRIVATE_EXTENSION_DEFAULT('ctdb') opt.RECURSE('lib/replace') @@ -85,6 +97,10 @@ def set_options(opt): opt.add_option('--enable-etcd-reclock', help=("Enable etcd recovery lock helper (default=no)"), action="store_true", dest='ctdb_etcd_reclock', default=False) + + opt.add_option('--with-libcephfs', + help=("Directory under which libcephfs is installed"), + action="store", dest='libcephfs_dir', default=None) opt.add_option('--enable-ceph-reclock', help=("Enable Ceph CTDB recovery lock helper (default=no)"), action="store_true", dest='ctdb_ceph_reclock', default=False) @@ -98,7 +114,6 @@ def set_options(opt): def configure(conf): - # No need to build python bindings for talloc/tevent/tdb if conf.IN_LAUNCH_DIR(): conf.env.standalone_ctdb = True @@ -125,8 +140,10 @@ def configure(conf): if conf.env.standalone_ctdb: conf.SAMBA_CHECK_PERL(mandatory=True) - conf.SAMBA_CHECK_PYTHON(mandatory=False, version=(2,5,0)) - conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False) + # 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() if conf.CHECK_FOR_THIRD_PARTY(): conf.RECURSE('third_party/popt') @@ -135,7 +152,7 @@ def configure(conf): conf.env.SOCKET_WRAPPER_SO_PATH = conf.CONFIG_GET('LIBSOCKET_WRAPPER_SO_PATH') 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.') + raise Errors.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) conf.env.SOCKET_WRAPPER_SO_PATH = '' @@ -143,7 +160,7 @@ def configure(conf): if conf.env.standalone_ctdb or conf.CONFIG_GET('ENABLE_SELFTEST'): if not conf.CHECK_SOCKET_WRAPPER(): - raise Utils.WafError('socket_wrapper package has not been found.\nIf third_party is installed, check that it is in the proper place.') + raise Errors.WafError('socket_wrapper package has not been found.\nIf third_party is installed, check that it is in the proper place.') else: conf.define('USING_SYSTEM_SOCKET_WRAPPER', 1) conf.env.SOCKET_WRAPPER_SO_PATH = conf.CONFIG_GET('LIBSOCKET_WRAPPER_SO_PATH') @@ -237,8 +254,16 @@ def configure(conf): conf.env.etcd_reclock = have_etcd_reclock if Options.options.ctdb_ceph_reclock: + # Use custom libcephfs library path if provided. XXX The top level build + # explicitly sets LIBPATH_CEPH-COMMON when libcephfs_dir isn't provided. + if Options.options.libcephfs_dir: + conf.env['CPPPATH_RADOS'] = Options.options.libcephfs_dir + '/include' + conf.env['LIBPATH_RADOS'] = Options.options.libcephfs_dir + '/lib' + conf.env['LIBPATH_CEPH-COMMON'] = conf.env['LIBPATH_RADOS'] + '/ceph' + if (conf.CHECK_HEADERS('rados/librados.h', False, False, 'rados') and conf.CHECK_LIB('rados', shlib=True)): + conf.CHECK_LIB('ceph-common', shlib=True) Logs.info('Building with Ceph librados recovery lock support') conf.define('HAVE_LIBRADOS', 1) else: @@ -246,6 +271,7 @@ def configure(conf): sys.exit(1) conf.env.CTDB_BINDIR = os.path.join(conf.env.EXEC_PREFIX, 'bin') + conf.env.CTDB_DATADIR = os.path.join(conf.env.EXEC_PREFIX, 'share/ctdb') 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') @@ -265,17 +291,18 @@ def configure(conf): conf.ADD_CFLAGS('''-DCTDB_HELPER_BINDIR=\"%s\" -DLOGDIR=\"%s\" + -DCTDB_DATADIR=\"%s\" -DCTDB_ETCDIR=\"%s\" -DCTDB_VARDIR=\"%s\" -DCTDB_RUNDIR=\"%s\"''' % ( conf.env.CTDB_HELPER_BINDIR, conf.env.CTDB_LOGDIR, + conf.env.CTDB_DATADIR, conf.env.CTDB_ETCDIR, conf.env.CTDB_VARDIR, conf.env.CTDB_RUNDIR)) - conf.env.CTDB_TEST_DATADIR = os.path.join(conf.env.EXEC_PREFIX, - 'share/ctdb/tests') + conf.env.CTDB_TEST_DATADIR = os.path.join(conf.env.CTDB_DATADIR, 'tests') conf.env.CTDB_TEST_LIBEXECDIR = os.path.join(conf.env.LIBEXECDIR, 'ctdb/tests') # Allow unified compilation and separate compilation of utilities @@ -283,7 +310,7 @@ def configure(conf): if not conf.env.standalone_ctdb: conf.ADD_EXTRA_INCLUDES('#include/public #ctdb/include #ctdb') else: - if srcdir == '.': + if Context.g_module.top == '.': # Building from tarball conf.ADD_EXTRA_INCLUDES('#include') else: @@ -315,15 +342,6 @@ def configure(conf): else: Logs.info(" %s: no" % (m)) -def gen_ctdb_version(task): - fp = file(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') - fp.write('#define CTDB_VERSION_STRING "%s"\n' % VERSION) - fp.close() - - def build(bld): if bld.env.standalone_ctdb: # enable building of public headers in the build tree @@ -332,12 +350,6 @@ def build(bld): if bld.env.standalone_ctdb: bld.SAMBA_MKVERSION('version.h', '%s/VERSION' % vdir) - t = bld.SAMBA_GENERATOR('ctdb-version-header', - target='include/ctdb_version.h', - rule=gen_ctdb_version, - dep_vars=['VERSION']) - t.env.VERSION = VERSION - bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig' bld.RECURSE('lib/replace') @@ -400,9 +412,10 @@ def build(bld): pkt_read.c pkt_write.c comm.c logging.c rb_tree.c tunable.c pidfile.c run_proc.c - hash_count.c run_event.c - sock_client.c version.c - cmdline.c path.c conf.c + hash_count.c + run_event.c event_script.c + sock_client.c + cmdline.c path.c conf.c line.c '''), deps='''samba-util sys_rw tevent-util replace talloc tevent tdb popt''') @@ -426,14 +439,13 @@ def build(bld): protocol_tunnel.c protocol_client.c protocol_debug.c - protocol_event.c protocol_sock.c'''), includes='include', deps='ctdb-protocol-basic replace talloc tdb') bld.SAMBA_SUBSYSTEM('ctdb-protocol-util', source='protocol/protocol_util.c', - deps='replace talloc tdb') + deps='ctdb-util replace talloc tdb') bld.SAMBA_SUBSYSTEM('ctdb-client', source=bld.SUBDIR('client', @@ -442,7 +454,7 @@ def build(bld): client_message_sync.c client_control_sync.c client_db.c client_util.c - client_event.c client_tunnel.c + client_tunnel.c '''), includes='include', deps='replace talloc tevent tdb tdb-wrap') @@ -482,6 +494,10 @@ def build(bld): source='event/event_conf.c', deps='ctdb-util') + bld.SAMBA_SUBSYSTEM('ctdb-failover-conf', + source='failover/failover_conf.c', + deps='ctdb-util') + bld.SAMBA_SUBSYSTEM('ctdb-legacy-conf', source='server/legacy_conf.c', deps='ctdb-util') @@ -493,6 +509,7 @@ def build(bld): ctdb-event-conf ctdb-cluster-conf ctdb-database-conf + ctdb-failover-conf ctdb-legacy-conf ctdb-util samba-util talloc replace popt''', install_path='${CTDB_HELPER_BINDIR}') @@ -558,7 +575,9 @@ def build(bld): ctdb-cluster-conf ctdb-database-conf ctdb-event-conf + ctdb-failover-conf ctdb-legacy-conf + ctdb-event-protocol talloc tevent tdb-wrap tdb talloc_report''' + ib_deps, install_path='${SBINDIR}', @@ -577,12 +596,6 @@ def build(bld): samba-util replace''', install_path='${CTDB_HELPER_BINDIR}') - bld.SAMBA_BINARY('ctdb_event', - source='tools/ctdb_event.c', - deps='''ctdb-client ctdb-protocol ctdb-protocol-util - ctdb-util ctdb-system samba-util replace''', - install_path='${CTDB_HELPER_BINDIR}') - bld.SAMBA_BINARY('ltdbtool', source='tools/ltdbtool.c', includes='include', @@ -590,12 +603,6 @@ def build(bld): install_path='${BINDIR}', manpages='ltdbtool.1') - bld.SAMBA_BINARY('ctdb_eventd', - source='server/ctdb_eventd.c', - deps='''ctdb-server-util ctdb-protocol ctdb-protocol-util - ctdb-util samba-util replace popt''', - install_path='${CTDB_HELPER_BINDIR}') - bld.SAMBA_BINARY('ctdb_lock_helper', source='server/ctdb_lock_helper.c', deps='''samba-util sys_rw ctdb-system tevent-util @@ -674,7 +681,7 @@ def build(bld): if bld.env.HAVE_LIBRADOS: bld.SAMBA_BINARY('ctdb_mutex_ceph_rados_helper', source='utils/ceph/ctdb_mutex_ceph_rados_helper.c', - deps='talloc tevent rados', + deps='talloc tevent rados ceph-common', includes='include', install_path='${CTDB_HELPER_BINDIR}') @@ -685,9 +692,10 @@ def build(bld): sed_expr5 = 's|/usr/local/sbin|%s|g' % (bld.env.SBINDIR) sed_expr6 = 's|/usr/local/libexec/ctdb|%s|g' % (bld.env.CTDB_HELPER_BINDIR) 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"' % \ + sed_expr8 = 's|/usr/local/share/ctdb|%s|g' % (bld.env.CTDB_DATADIR) + sed_cmdline = '-e "%s" ' * 8 % \ (sed_expr1, sed_expr2, sed_expr3, sed_expr4, sed_expr5, - sed_expr6, sed_expr7) + sed_expr6, sed_expr7, sed_expr8) manpages_extra = manpages_misc if bld.env.etcd_reclock: @@ -716,14 +724,14 @@ def build(bld): target='onnode', rule='sed %s ${SRC} > ${TGT}' % (sed_cmdline)) bld.INSTALL_FILES('${BINDIR}', 'onnode', - destname='onnode', chmod=0755) + 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=0755) + destname='ctdb_diagnostics', chmod=MODE_755) if bld.env.etcd_reclock: bld.SAMBA_GENERATOR('ctdb-etcd-lock', @@ -731,46 +739,50 @@ def build(bld): 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=0744) + 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=0755) + 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=0755) + 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=0755) + 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 & 0777 + 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'] - etc_subdirs = [ + event_script_subdirs = [ 'events/legacy', + ] + + etc_subdirs = [ 'nfs-checks.d' ] @@ -779,12 +791,38 @@ def build(bld): else: configdir = 'ctdb/config' + 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]) + for t in etc_subdirs: files = SUBDIR_MODE('%s/%s' % (configdir, t), trim_path=configdir) for fmode in files: bld.INSTALL_FILES(bld.env.CTDB_ETCDIR, 'config/%s' % fmode[0], destname=fmode[0], chmod=fmode[1]) + # 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) + bld.SAMBA_GENERATOR('ctdb-functions', source='config/functions', target='functions', @@ -802,7 +840,7 @@ def build(bld): for t in etc_scripts: bld.INSTALL_FILES(bld.env.CTDB_ETCDIR, 'config/%s' % t, - destname=t, chmod=0755) + destname=t, chmod=MODE_755) bld.SAMBA_GENERATOR('ctdb-sudoers', source='config/ctdb.sudoers', @@ -815,12 +853,22 @@ def build(bld): 'config/notification.README', destname='README') - bld.install_dir(bld.env.CTDB_LOGDIR) - bld.install_dir(bld.env.CTDB_RUNDIR) - bld.install_dir(bld.env.CTDB_VARDIR) + bld.INSTALL_DIR(bld.env.CTDB_LOGDIR) + bld.INSTALL_DIR(bld.env.CTDB_RUNDIR) + bld.INSTALL_DIR(bld.env.CTDB_VARDIR) for d in ['volatile', 'persistent', 'state']: - bld.install_dir(os.path.join(bld.env.CTDB_VARDIR, d)) + bld.INSTALL_DIR(os.path.join(bld.env.CTDB_VARDIR, d)) + + bld.SAMBA_BINARY('errcode', + source='tests/src/errcode.c', + deps='replace', + install_path='${CTDB_TEST_LIBEXECDIR}') + + bld.SAMBA_BINARY('sigcode', + source='tests/src/sigcode.c', + deps='replace', + install_path='${CTDB_TEST_LIBEXECDIR}') # Unit tests ctdb_unit_tests = [ @@ -838,6 +886,8 @@ def build(bld): 'run_event_test', 'cmdline_test', 'conf_test', + 'line_test', + 'event_script_test', ] for target in ctdb_unit_tests: @@ -864,6 +914,11 @@ def build(bld): deps='talloc tevent tdb ctdb-protocol', install_path='${CTDB_TEST_LIBEXECDIR}') + bld.SAMBA_BINARY('system_socket_test', + source='tests/src/system_socket_test.c', + deps='talloc ctdb-protocol-util pcap', + install_path='${CTDB_TEST_LIBEXECDIR}') + bld.SAMBA_BINARY('porting_tests', source='tests/src/porting_tests.c', deps='samba-util ctdb-system popt', @@ -875,6 +930,12 @@ def build(bld): 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'), @@ -884,7 +945,6 @@ def build(bld): source=bld.SUBDIR('tests/src', '''protocol_common.c protocol_common_ctdb.c - protocol_common_event.c '''), includes='include', deps='ctdb-protocol-tests-basic replace talloc tdb') @@ -897,7 +957,6 @@ def build(bld): ctdb_protocol_tests = [ 'protocol_types_test', 'protocol_ctdb_test', - 'protocol_event_test', 'protocol_util_test', 'protocol_types_compat_test', 'protocol_ctdb_compat_test', @@ -909,7 +968,7 @@ def build(bld): bld.SAMBA_BINARY(target, source=src, deps='''ctdb-protocol-tests-common - samba-util talloc tdb''', + samba-util ctdb-util talloc tdb''', install_path='${CTDB_TEST_LIBEXECDIR}') bld.SAMBA_BINARY('event_protocol_test', @@ -987,6 +1046,8 @@ def build(bld): 'complex', 'ctdb_eventd', 'cunit', + 'etc-ctdb', + 'eventd', 'eventscripts', 'onnode', 'shellcheck', @@ -1026,7 +1087,7 @@ def build(bld): 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=0755) + destname='test_wrap', chmod=MODE_755) bld.SAMBA_GENERATOR('ctdb-test-script-install-paths', source='tests/scripts/script_install_paths.sh', @@ -1034,11 +1095,10 @@ def build(bld): 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=0644) + 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', @@ -1046,10 +1106,18 @@ def build(bld): 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) + 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' @@ -1060,9 +1128,8 @@ def testonly(ctx): def test(ctx): - import Scripting - Scripting.commands.append('build') - Scripting.commands.append('testonly') + Options.commands.append('build') + Options.commands.append('testonly') def autotest(ctx): @@ -1075,7 +1142,7 @@ def autotest(ctx): def show_version(ctx): - print VERSION + print(get_version_string()) def manpages(ctx): @@ -1101,14 +1168,8 @@ def manpages(ctx): def distonly(ctx): samba_dist.DIST_FILES('VERSION:VERSION', extend=True) - distfile = file('.distversion', 'w') - for field in version.vcs_fields: - distfile.write('%s=%s\n' % (field, str(version.vcs_fields[field]))) - distfile.close() - samba_dist.DIST_FILES('ctdb/.distversion:.distversion', extend=True) - t = 'ctdb.spec' - sed_expr1 = 's/@VERSION@/%s/g' % VERSION + sed_expr1 = 's/@VERSION@/%s/g' % get_version_string() sed_expr2 = 's/@RELEASE@/%s/g' % '1' cmd = 'sed -e "%s" -e "%s" packaging/RPM/ctdb.spec.in > %s' % ( sed_expr1, sed_expr2, t) @@ -1128,14 +1189,14 @@ def distonly(ctx): def dist(): - import Scripting - Scripting.commands.append('manpages') - Scripting.commands.append('distonly') + Options.commands.append('manpages') + Options.commands.append('distonly') def rpmonly(ctx): opts = os.getenv('RPM_OPTIONS') or '' - cmd = 'rpmbuild -ta --clean --rmsource %s ctdb-%s.tar.gz' % (opts, VERSION) + cmd = 'rpmbuild -ta --clean --rmsource %s ctdb-%s.tar.gz' % \ + (opts, get_version_string()) ret = samba_utils.RUN_COMMAND(cmd) if ret != 0: print('rpmbuild exited with exit status %d' % ret) @@ -1143,16 +1204,14 @@ def rpmonly(ctx): def rpm(ctx): - import Scripting - Scripting.commands.append('manpages') - Scripting.commands.append('distonly') - Scripting.commands.append('rpmonly') + Options.commands.append('manpages') + Options.commands.append('distonly') + Options.commands.append('rpmonly') def ctags(ctx): "build 'tags' file using ctags" - import Utils - source_root = os.path.dirname(Utils.g_module.root_path) + source_root = os.path.dirname(Context.g_module.root_path) cmd = 'ctags $(find %s -name "*.[ch]")' % source_root print("Running: %s" % cmd) ret = samba_utils.RUN_COMMAND(cmd)