mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
build: check for circular build dependencies
This commit is contained in:
parent
4f920748d4
commit
281f27d54b
@ -124,11 +124,10 @@ Build.BuildContext.set_rpath = set_rpath
|
|||||||
# return a named build cache dictionary, used to store
|
# return a named build cache dictionary, used to store
|
||||||
# state inside the following functions
|
# state inside the following functions
|
||||||
def BUILD_CACHE(bld, name):
|
def BUILD_CACHE(bld, name):
|
||||||
try:
|
if name in bld.env:
|
||||||
cache = bld.name
|
return bld.env[name]
|
||||||
except AttributeError:
|
bld.env[name] = {}
|
||||||
bld.name = cache = {}
|
return bld.env[name]
|
||||||
return cache
|
|
||||||
|
|
||||||
|
|
||||||
#############################################################
|
#############################################################
|
||||||
@ -220,6 +219,9 @@ def SAMBA_LIBRARY(bld, libname, source_list,
|
|||||||
)
|
)
|
||||||
cache = BUILD_CACHE(bld, 'INCLUDE_LIST')
|
cache = BUILD_CACHE(bld, 'INCLUDE_LIST')
|
||||||
cache[libname] = ilist
|
cache[libname] = ilist
|
||||||
|
|
||||||
|
cache = BUILD_CACHE(bld, 'LIB_DEPS')
|
||||||
|
cache[libname] = deps.split()
|
||||||
Build.BuildContext.SAMBA_LIBRARY = SAMBA_LIBRARY
|
Build.BuildContext.SAMBA_LIBRARY = SAMBA_LIBRARY
|
||||||
|
|
||||||
|
|
||||||
@ -240,6 +242,9 @@ def SAMBA_BINARY(bld, binname, source_list,
|
|||||||
ilist = bld.NORMPATH(ilist)
|
ilist = bld.NORMPATH(ilist)
|
||||||
ccflags = ''
|
ccflags = ''
|
||||||
|
|
||||||
|
cache = BUILD_CACHE(bld, 'LIB_DEPS')
|
||||||
|
cache[binname] = deps.split()
|
||||||
|
|
||||||
cache = BUILD_CACHE(bld, 'INIT_FUNCTIONS')
|
cache = BUILD_CACHE(bld, 'INIT_FUNCTIONS')
|
||||||
if modules is not None:
|
if modules is not None:
|
||||||
for m in modules.split():
|
for m in modules.split():
|
||||||
@ -270,6 +275,10 @@ def SAMBA_PYTHON(bld, name, source_list,
|
|||||||
deps='',
|
deps='',
|
||||||
public_deps='',
|
public_deps='',
|
||||||
realname=''):
|
realname=''):
|
||||||
|
|
||||||
|
cache = BUILD_CACHE(bld, 'LIB_DEPS')
|
||||||
|
cache[name] = deps.split()
|
||||||
|
|
||||||
Logs.debug('runner: PYTHON_SAMBA not implemented')
|
Logs.debug('runner: PYTHON_SAMBA not implemented')
|
||||||
return
|
return
|
||||||
Build.BuildContext.SAMBA_PYTHON = SAMBA_PYTHON
|
Build.BuildContext.SAMBA_PYTHON = SAMBA_PYTHON
|
||||||
@ -328,6 +337,34 @@ def BUILD_SUBDIR(bld, dir):
|
|||||||
bld.add_subdirs(dir)
|
bld.add_subdirs(dir)
|
||||||
Build.BuildContext.BUILD_SUBDIR = BUILD_SUBDIR
|
Build.BuildContext.BUILD_SUBDIR = BUILD_SUBDIR
|
||||||
|
|
||||||
|
def CIRCULAR_DEPENDENCY(deps, path, cache, target):
|
||||||
|
if target not in cache:
|
||||||
|
return False
|
||||||
|
for t in cache[target]:
|
||||||
|
if t in deps:
|
||||||
|
print "Circular dependency on target %s: %s" % (t, path)
|
||||||
|
return True
|
||||||
|
if CIRCULAR_DEPENDENCY(deps,
|
||||||
|
("%s->%s" % (path, t)),
|
||||||
|
cache, t):
|
||||||
|
return True
|
||||||
|
deps[t] = True
|
||||||
|
return False
|
||||||
|
|
||||||
|
############################################################
|
||||||
|
# check our build dependencies for circular dependencies
|
||||||
|
def CHECK_DEPENDENCIES(bld):
|
||||||
|
cache = BUILD_CACHE(bld, 'LIB_DEPS')
|
||||||
|
print "Checking for circular dependencies"
|
||||||
|
for target in cache:
|
||||||
|
deps = {}
|
||||||
|
path = target
|
||||||
|
bld.ASSERT(not CIRCULAR_DEPENDENCY(deps, path, cache, target),
|
||||||
|
"Circular dependency in target %s" % target)
|
||||||
|
print "No circular dependencies"
|
||||||
|
|
||||||
|
Build.BuildContext.CHECK_DEPENDENCIES = CHECK_DEPENDENCIES
|
||||||
|
|
||||||
|
|
||||||
############################################################
|
############################################################
|
||||||
# this overrides the 'waf -v' debug output to be in a nice
|
# this overrides the 'waf -v' debug output to be in a nice
|
||||||
|
@ -62,3 +62,6 @@ bld.BUILD_SUBDIR('../libcli/drsuapi')
|
|||||||
bld.BUILD_SUBDIR('../libcli/samsync')
|
bld.BUILD_SUBDIR('../libcli/samsync')
|
||||||
bld.BUILD_SUBDIR('../libgpo')
|
bld.BUILD_SUBDIR('../libgpo')
|
||||||
bld.BUILD_SUBDIR('../libcli/named_pipe_auth')
|
bld.BUILD_SUBDIR('../libcli/named_pipe_auth')
|
||||||
|
|
||||||
|
# check if we have any circular build dependencies
|
||||||
|
bld.CHECK_DEPENDENCIES()
|
||||||
|
Loading…
Reference in New Issue
Block a user