From 550eb499fddbf4846277cf51ea9c28f167c64ad0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 27 Aug 2015 11:14:51 +0200 Subject: [PATCH 1/5] ldb:wscript: make it possible to build samba with a system ldb again This fixes a regression in commit fcf4a891945b22dc6eccdc71fd441f1a879f556a. If we check for 'ldb' later the 'pyldb-util' can't depend on the 'ldb' check. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11458 Signed-off-by: Stefan Metzmacher --- lib/ldb/wscript | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ldb/wscript b/lib/ldb/wscript index 0e81932..0996f51 100755 --- a/lib/ldb/wscript +++ b/lib/ldb/wscript @@ -56,11 +56,11 @@ def configure(conf): if not conf.env.standalone_ldb: if conf.CHECK_BUNDLED_SYSTEM_PKG('pyldb-util', minversion=VERSION, - onlyif='talloc tdb tevent ldb', + onlyif='talloc tdb tevent', implied_deps='replace talloc tdb tevent ldb'): conf.define('USING_SYSTEM_PYLDB_UTIL', 1) if conf.CHECK_BUNDLED_SYSTEM_PKG('ldb', minversion=VERSION, - onlyif='talloc tdb tevent', + onlyif='talloc tdb tevent pyldb-util', implied_deps='replace talloc tdb tevent'): conf.define('USING_SYSTEM_LDB', 1) -- 1.9.1 From fe0251e021a71e5212ca9467bb005896a3d09fac Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 27 Aug 2015 10:47:05 +0200 Subject: [PATCH 2/5] 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 --- buildtools/wafsamba/samba_bundled.py | 45 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/buildtools/wafsamba/samba_bundled.py b/buildtools/wafsamba/samba_bundled.py index c8bfcd2..399ca55 100644 --- a/buildtools/wafsamba/samba_bundled.py +++ b/buildtools/wafsamba/samba_bundled.py @@ -107,16 +107,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', @@ -141,12 +131,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 ''' + # 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) if conf.LIB_MUST_BE_BUNDLED(libname): return False found = 'FOUND_SYSTEMLIB_%s' % libname if found in conf.env: return conf.env[found] + # 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''' if require_headers and headers and not conf.CHECK_HEADERS(headers, lib=libname): @@ -166,19 +178,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 -- 1.9.1 From f330ae0a229dc540857ace08afafd0b55f729ed8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 27 Aug 2015 11:05:08 +0200 Subject: [PATCH 3/5] script/autobuild.py: exclude !lib,!pylib,!pylib-util from bundling in samba-libs We need to make sure we're really not bundling any of these. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11458 Signed-off-by: Stefan Metzmacher --- script/autobuild.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/script/autobuild.py b/script/autobuild.py index c91ff2c..45eede9 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -46,7 +46,11 @@ samba_libs_envvars += " PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${PREFIX_DIR}/lib/pkgco samba_libs_envvars += " ADDITIONAL_CFLAGS='-Wmissing-prototypes'" samba_libs_configure_base = samba_libs_envvars + " ./configure --abi-check --enable-debug --picky-developer -C ${PREFIX}" samba_libs_configure_libs = samba_libs_configure_base + " --bundled-libraries=NONE" -samba_libs_configure_samba = samba_libs_configure_base + " --bundled-libraries=!talloc,!tdb,!pytdb,!ldb,!pyldb,!tevent,!pytevent" +# We use the pattern !lib,!pylib,!pylib-util for everything +# some might not exist yet, but maybe added in future. +samba_libs_systemlibs = ["talloc", "tdb", "tevent", "ldb"] +samba_libs_configure_samba = samba_libs_configure_base + " --bundled-libraries=" +samba_libs_configure_samba += ",".join("!%s,!py%s,!py%s-util" % (l,l,l) for l in samba_libs_systemlibs) tasks = { "ctdb" : [ ("random-sleep", "../script/random-sleep.sh 60 600", "text/plain"), -- 1.9.1 From 7586e279b31ae1e9cd4777442f174999f8e40a97 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 27 Aug 2015 11:40:09 +0200 Subject: [PATCH 4/5] s4:heimdal_build: handle CHECK_BUNDLED_SYSTEM returning False in check_system_heimdal_lib() Signed-off-by: Stefan Metzmacher --- source4/heimdal_build/wscript_configure | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source4/heimdal_build/wscript_configure b/source4/heimdal_build/wscript_configure index 710a53d..9e720e4 100755 --- a/source4/heimdal_build/wscript_configure +++ b/source4/heimdal_build/wscript_configure @@ -196,8 +196,9 @@ def check_system_heimdal_lib(name, functions='', headers='', onlyif=None): return False setattr(conf.env, "CPPPATH_%s" % name.upper(), heimdal_includedirs) setattr(conf.env, "LIBPATH_%s" % name.upper(), heimdal_libdirs) - conf.CHECK_BUNDLED_SYSTEM(name, checkfunctions=functions, headers=headers, - onlyif=onlyif) + if not conf.CHECK_BUNDLED_SYSTEM(name, checkfunctions=functions, headers=headers, + onlyif=onlyif): + return False conf.define('USING_SYSTEM_%s' % name.upper(), 1) return True -- 1.9.1 From 25f3fd1d244234621ef4d491bf41d93ca0392d34 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 27 Aug 2015 11:44:23 +0200 Subject: [PATCH 5/5] s4:heimdal_build: also use check_system_heimdal_lib() for "com_err" Signed-off-by: Stefan Metzmacher --- source4/heimdal_build/wscript_configure | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source4/heimdal_build/wscript_configure b/source4/heimdal_build/wscript_configure index 9e720e4..37fa459 100755 --- a/source4/heimdal_build/wscript_configure +++ b/source4/heimdal_build/wscript_configure @@ -186,9 +186,6 @@ if krb5_config: finally: f.close() -if conf.CHECK_BUNDLED_SYSTEM('com_err', checkfunctions='com_right_r com_err', headers='com_err.h'): - conf.define('USING_SYSTEM_COM_ERR', 1) - def check_system_heimdal_lib(name, functions='', headers='', onlyif=None): # Only use system library if the user requested the bundled one not be # used. @@ -210,6 +207,8 @@ def check_system_heimdal_binary(name): conf.define('USING_SYSTEM_%s' % name.upper(), 1) return True +check_system_heimdal_lib("com_err", "com_right_r com_err", "com_err.h") + if check_system_heimdal_lib("roken", "rk_socket_set_reuseaddr", "roken.h"): conf.env.CPPPATH_ROKEN_HOSTCC = conf.env.CPPPATH_ROKEN conf.env.LIBPATH_ROKEN_HOSTCC = conf.env.LIBPATH_ROKEN -- 1.9.1