summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2015-08-27 10:47:05 +0200
committerStefan Metzmacher <metze@samba.org>2015-11-04 18:38:18 +0100
commitb06544da6f466affaa0ef6681e78673ef05b2c1e (patch)
tree8a858e26c6d1ff167cd5554642484fda557d6259
parentc474173a83f3200ce64379f96c1e2367061aa2ca (diff)
downloadsamba-b06544da6f466affaa0ef6681e78673ef05b2c1e.tar.gz
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
-rw-r--r--buildtools/wafsamba/samba_bundled.py50
1 files changed, 25 insertions, 25 deletions
diff --git a/buildtools/wafsamba/samba_bundled.py b/buildtools/wafsamba/samba_bundled.py
index a4f841bb998..bfc7ecc8bc7 100644
--- a/buildtools/wafsamba/samba_bundled.py
+++ b/buildtools/wafsamba/samba_bundled.py
@@ -108,16 +108,6 @@ def LIB_MUST_BE_PRIVATE(conf, libname):
return ('ALL' in conf.env.PRIVATE_LIBS or
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
@conf
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
tries by testing for a specified function in the specified lib
'''
- if conf.LIB_MUST_BE_BUNDLED(libname):
- return False
+ # We always do a logic validation of 'onlyif' first
+ 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
if found in conf.env:
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():
'''helper function for CHECK_BUNDLED_SYSTEM'''
@@ -167,19 +180,6 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
return False
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)
msg = 'Checking for system %s' % libname