Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/lib/tdb/wscript

    r986 r988  
    22
    33APPNAME = 'tdb'
    4 VERSION = '1.2.9'
     4VERSION = '1.3.8'
    55
    66blddir = 'bin'
     
    1111srcdir = '.'
    1212while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5:
    13     srcdir = '../' + srcdir
     13    srcdir = srcdir + '/..'
    1414sys.path.insert(0, srcdir + '/buildtools/wafsamba')
    1515
    1616import wafsamba, samba_dist, Options, Logs
    1717
    18 samba_dist.DIST_DIRS('lib/tdb:. lib/replace:lib/replace buildtools:buildtools')
     18samba_dist.DIST_DIRS('lib/tdb:. lib/replace:lib/replace buildtools:buildtools third_party/waf:third_party/waf')
     19
     20tdb1_unit_tests = [
     21    'run-3G-file',
     22    'run-bad-tdb-header',
     23    'run',
     24    'run-check',
     25    'run-corrupt',
     26    'run-die-during-transaction',
     27    'run-endian',
     28    'run-incompatible',
     29    'run-nested-transactions',
     30    'run-nested-traverse',
     31    'run-no-lock-during-traverse',
     32    'run-oldhash',
     33    'run-open-during-transaction',
     34    'run-readonly-check',
     35    'run-rescue',
     36    'run-rescue-find_entry',
     37    'run-rwlock-check',
     38    'run-summary',
     39    'run-transaction-expand',
     40    'run-traverse-in-transaction',
     41    'run-wronghash-fail',
     42    'run-zero-append',
     43    'run-marklock-deadlock',
     44    'run-allrecord-traverse-deadlock',
     45    'run-mutex-openflags2',
     46    'run-mutex-trylock',
     47    'run-mutex-allrecord-bench',
     48    'run-mutex-allrecord-trylock',
     49    'run-mutex-allrecord-block',
     50    'run-mutex-transaction1',
     51    'run-mutex-die',
     52    'run-mutex1',
     53]
    1954
    2055def set_options(opt):
     
    2257    opt.PRIVATE_EXTENSION_DEFAULT('tdb', noextension='tdb')
    2358    opt.RECURSE('lib/replace')
     59    opt.add_option('--disable-tdb-mutex-locking',
     60                   help=("Disable the use of pthread robust mutexes"),
     61                   action="store_true", dest='disable_tdb_mutex_locking',
     62                   default=False)
    2463    if opt.IN_LAUNCH_DIR():
    2564        opt.add_option('--disable-python',
     
    2968
    3069def configure(conf):
     70    conf.env.disable_tdb_mutex_locking = getattr(Options.options,
     71                                                 'disable_tdb_mutex_locking',
     72                                                 False)
     73    if not conf.env.disable_tdb_mutex_locking:
     74        conf.env.replace_add_global_pthread = True
    3175    conf.RECURSE('lib/replace')
    3276
    3377    conf.env.standalone_tdb = conf.IN_LAUNCH_DIR()
     78    conf.env.building_tdb = True
    3479
    3580    if not conf.env.standalone_tdb:
    36         if conf.CHECK_BUNDLED_SYSTEM('tdb', minversion=VERSION,
     81        if conf.CHECK_BUNDLED_SYSTEM_PKG('tdb', minversion=VERSION,
    3782                                     implied_deps='replace'):
    3883            conf.define('USING_SYSTEM_TDB', 1)
     84            conf.env.building_tdb = False
    3985            if conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytdb', 'tdb', minversion=VERSION):
    4086                conf.define('USING_SYSTEM_PYTDB', 1)
     
    4288    conf.env.disable_python = getattr(Options.options, 'disable_python', False)
    4389
     90    if (conf.CONFIG_SET('HAVE_ROBUST_MUTEXES') and
     91        conf.env.building_tdb and
     92        not conf.env.disable_tdb_mutex_locking):
     93        conf.define('USE_TDB_MUTEX_LOCKING', 1)
     94
    4495    conf.CHECK_XSLTPROC_MANPAGES()
    4596
    4697    if not conf.env.disable_python:
    4798        # also disable if we don't have the python libs installed
    48         conf.check_tool('python')
     99        conf.SAMBA_CHECK_PYTHON(mandatory=False)
    49100        conf.check_python_version((2,4,2))
    50101        conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
     
    55106    conf.SAMBA_CONFIG_H()
    56107
     108    conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
     109
    57110def build(bld):
    58111    bld.RECURSE('lib/replace')
    59112
    60     COMMON_SRC = bld.SUBDIR('common',
    61                             '''check.c error.c tdb.c traverse.c
    62                             freelistcheck.c lock.c dump.c freelist.c
    63                             io.c open.c transaction.c hash.c summary.c''')
     113    COMMON_FILES='''check.c error.c tdb.c traverse.c
     114                    freelistcheck.c lock.c dump.c freelist.c
     115                    io.c open.c transaction.c hash.c summary.c rescue.c
     116                    mutex.c'''
     117
     118    COMMON_SRC = bld.SUBDIR('common', COMMON_FILES)
    64119
    65120    if bld.env.standalone_tdb:
    66121        bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
    67         bld.PKG_CONFIG_FILES('tdb.pc', vnum=VERSION)
    68122        private_library = False
    69123    else:
     
    71125
    72126    if not bld.CONFIG_SET('USING_SYSTEM_TDB'):
     127
     128        tdb_deps = 'replace'
     129
     130        if bld.CONFIG_SET('USE_TDB_MUTEX_LOCKING'):
     131            tdb_deps += ' pthread'
     132
    73133        bld.SAMBA_LIBRARY('tdb',
    74134                          COMMON_SRC,
    75                           deps='replace',
     135                          deps=tdb_deps,
    76136                          includes='include',
    77137                          abi_directory='ABI',
     
    79139                          hide_symbols=True,
    80140                          vnum=VERSION,
    81                           public_headers='include/tdb.h',
     141                          public_headers=('' if private_library else 'include/tdb.h'),
    82142                          public_headers_install=not private_library,
     143                          pc_files='tdb.pc',
    83144                          private_library=private_library)
    84145
     
    90151        bld.SAMBA_BINARY('tdbrestore',
    91152                         'tools/tdbrestore.c',
    92                          'tdb', manpages='manpages/tdbrestore.8')
     153                         'tdb', manpages='man/tdbrestore.8')
    93154
    94155        bld.SAMBA_BINARY('tdbdump',
    95156                         'tools/tdbdump.c',
    96                          'tdb', manpages='manpages/tdbdump.8')
     157                         'tdb', manpages='man/tdbdump.8')
    97158
    98159        bld.SAMBA_BINARY('tdbbackup',
    99160                         'tools/tdbbackup.c',
    100161                         'tdb',
    101                          manpages='manpages/tdbbackup.8')
     162                         manpages='man/tdbbackup.8')
    102163
    103164        bld.SAMBA_BINARY('tdbtool',
    104165                         'tools/tdbtool.c',
    105                          'tdb', manpages='manpages/tdbtool.8')
     166                         'tdb', manpages='man/tdbtool.8')
     167
     168        if bld.env.standalone_tdb:
     169            # FIXME: This hardcoded list is stupid, stupid, stupid.
     170            bld.SAMBA_SUBSYSTEM('tdb-test-helpers',
     171                                'test/external-agent.c test/lock-tracking.c test/logging.c',
     172                                tdb_deps,
     173                                includes='include')
     174
     175            for t in tdb1_unit_tests:
     176                b = "tdb1-" + t
     177                s = "test/" + t + ".c"
     178                bld.SAMBA_BINARY(b, s, 'replace tdb-test-helpers',
     179                                 includes='include', install=False)
    106180
    107181    if not bld.CONFIG_SET('USING_SYSTEM_PYTDB'):
    108         bld.SAMBA_PYTHON('pytdb',
    109                          'pytdb.c',
    110                          deps='tdb',
    111                          enabled=not bld.env.disable_python,
    112                          realname='tdb.so',
    113                          cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
    114 
    115 
    116 
    117 def test(ctx):
     182        for env in bld.gen_python_environments(['PKGCONFIGDIR']):
     183            bld.SAMBA_PYTHON('pytdb',
     184                             'pytdb.c',
     185                             deps='tdb',
     186                             enabled=not bld.env.disable_python,
     187                             realname='tdb.so',
     188                             cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
     189
     190        if not bld.env.disable_python:
     191            for env in bld.gen_python_environments(['PKGCONFIGDIR']):
     192                bld.SAMBA_SCRIPT('_tdb_text.py',
     193                                 pattern='_tdb_text.py',
     194                                 installdir='python')
     195
     196                bld.INSTALL_FILES('${PYTHONARCHDIR}', '_tdb_text.py')
     197
     198def testonly(ctx):
    118199    '''run tdb testsuite'''
    119200    import Utils, samba_utils, shutil
     201    ecode = 0
     202
    120203    test_prefix = "%s/st" % (Utils.g_module.blddir)
    121204    shutil.rmtree(test_prefix, ignore_errors=True)
    122205    os.makedirs(test_prefix)
    123206    os.environ['TEST_DATA_PREFIX'] = test_prefix
    124     cmd = os.path.join(Utils.g_module.blddir, 'tdbtorture')
    125     ret = samba_utils.RUN_COMMAND(cmd)
    126     print("testsuite returned %d" % ret)
    127     sys.exit(ret)
     207
     208    env = samba_utils.LOAD_ENVIRONMENT()
     209    # FIXME: This is horrible :(
     210    if env.building_tdb:
     211        # Create scratch directory for tests.
     212        testdir = os.path.join(test_prefix, 'tdb-tests')
     213        samba_utils.mkdir_p(testdir)
     214        # Symlink back to source dir so it can find tests in test/
     215        link = os.path.join(testdir, 'test')
     216        if not os.path.exists(link):
     217            os.symlink(os.path.abspath(os.path.join(env.cwd, 'test')), link)
     218
     219        for t in tdb1_unit_tests:
     220            f = "tdb1-" + t
     221            cmd = "cd " + testdir + " && " + os.path.abspath(os.path.join(Utils.g_module.blddir, f)) + " > test-output 2>&1"
     222            print("..." + f)
     223            ret = samba_utils.RUN_COMMAND(cmd)
     224            if ret != 0:
     225                print("%s failed:" % f)
     226                samba_utils.RUN_COMMAND("cat " + os.path.join(testdir, 'test-output'))
     227                ecode = ret
     228                break
     229
     230    if ecode == 0:
     231        cmd = os.path.join(Utils.g_module.blddir, 'tdbtorture')
     232        ret = samba_utils.RUN_COMMAND(cmd)
     233        print("testsuite returned %d" % ret)
     234        if ret != 0:
     235            ecode = ret
     236
     237    pyret = samba_utils.RUN_PYTHON_TESTS(['python/tests/simple.py'])
     238    print("python testsuite returned %d" % pyret)
     239    sys.exit(ecode or pyret)
     240
     241# WAF doesn't build the unit tests for this, maybe because they don't link with tdb?
     242# This forces it
     243def test(ctx):
     244    import Scripting
     245    Scripting.commands.append('build')
     246    Scripting.commands.append('testonly')
    128247
    129248def dist():
Note: See TracChangeset for help on using the changeset viewer.