1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-03 13:47:25 +03:00

wafsamba: detect programmer errors in CHECK_BUNDLED_SYSTEM()

All prerequisite libraries of CHECK_BUNDLED_SYSTEM[_PKG](onlyif='lib1 lib2')
need to be checked before.

That means conf.env['FOUND_SYSTEMLIB_lib1'] and conf.env['FOUND_SYSTEMLIB_lib2']
need to exist independed of its value (True or False). Otherwise this is a logic error.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11458

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Nov  4 18:38:18 CET 2015 on sn-devel-104
This commit is contained in:
Stefan Metzmacher 2015-08-27 10:47:05 +02:00
parent c474173a83
commit b06544da6f

View File

@ -108,16 +108,6 @@ def LIB_MUST_BE_PRIVATE(conf, libname):
return ('ALL' in conf.env.PRIVATE_LIBS or return ('ALL' in conf.env.PRIVATE_LIBS or
libname in conf.env.PRIVATE_LIBS) libname in conf.env.PRIVATE_LIBS)
@conf
def CHECK_PREREQUISITES(conf, prereqs):
missing = []
for syslib in TO_LIST(prereqs):
f = 'FOUND_SYSTEMLIB_%s' % syslib
if not f in conf.env:
missing.append(syslib)
return missing
@runonce @runonce
@conf @conf
def CHECK_BUNDLED_SYSTEM_PKG(conf, libname, minversion='0.0.0', def CHECK_BUNDLED_SYSTEM_PKG(conf, libname, minversion='0.0.0',
@ -142,11 +132,34 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
this first tries via pkg-config, then if that fails this first tries via pkg-config, then if that fails
tries by testing for a specified function in the specified lib tries by testing for a specified function in the specified lib
''' '''
if conf.LIB_MUST_BE_BUNDLED(libname): # We always do a logic validation of 'onlyif' first
return False missing = []
if onlyif:
for l in TO_LIST(onlyif):
f = 'FOUND_SYSTEMLIB_%s' % l
if not f in conf.env:
Logs.error('ERROR: CHECK_BUNDLED_SYSTEM(%s) - ' % (libname) +
'missing prerequisite check for ' +
'system library %s, onlyif=%r' % (l, onlyif))
sys.exit(1)
if not conf.env[f]:
missing.append(l)
found = 'FOUND_SYSTEMLIB_%s' % libname found = 'FOUND_SYSTEMLIB_%s' % libname
if found in conf.env: if found in conf.env:
return conf.env[found] return conf.env[found]
if conf.LIB_MUST_BE_BUNDLED(libname):
conf.env[found] = False
return False
# see if the library should only use a system version if another dependent
# system version is found. That prevents possible use of mixed library
# versions
if missing:
if not conf.LIB_MAY_BE_BUNDLED(libname):
Logs.error('ERROR: Use of system library %s depends on missing system library/libraries %r' % (libname, missing))
sys.exit(1)
conf.env[found] = False
return False
def check_functions_headers_code(): def check_functions_headers_code():
'''helper function for CHECK_BUNDLED_SYSTEM''' '''helper function for CHECK_BUNDLED_SYSTEM'''
@ -167,19 +180,6 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
return False return False
return True return True
# see if the library should only use a system version if another dependent
# system version is found. That prevents possible use of mixed library
# versions
if onlyif:
missing = conf.CHECK_PREREQUISITES(onlyif)
if missing:
if not conf.LIB_MAY_BE_BUNDLED(libname):
Logs.error('ERROR: Use of system library %s depends on missing system library/libraries %r' % (libname, missing))
sys.exit(1)
conf.env[found] = False
return False
minversion = minimum_library_version(conf, libname, minversion) minversion = minimum_library_version(conf, libname, minversion)
msg = 'Checking for system %s' % libname msg = 'Checking for system %s' % libname