build: throw a fatal error for duplicate target declarations
authorAndrew Tridgell <tridge@samba.org>
Thu, 15 Apr 2010 04:43:43 +0000 (14:43 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 15 Apr 2010 04:43:50 +0000 (14:43 +1000)
We don't want someone to declare two subsystems of the same name but
with different source files

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

buildtools/wafsamba/samba_autoproto.py
buildtools/wafsamba/samba_utils.py
buildtools/wafsamba/wafsamba.py

index 2a903d9f1f867efbac7d43edfe9aab0bd239800f..edabc7e44cad963a0f6e7fbfc04f9fbaea1bfb5f 100644 (file)
@@ -29,8 +29,11 @@ Build.BuildContext.HEIMDAL_AUTOPROTO_PRIVATE = HEIMDAL_AUTOPROTO_PRIVATE
 def SAMBA_AUTOPROTO(bld, header, source):
     '''rule for samba prototype generation'''
     bld.SET_BUILD_GROUP('prototypes')
-    SET_TARGET_TYPE(bld, header, 'PROTOTYPE')
+    relpath = os_path_relpath(bld.curdir, bld.srcnode.abspath())
+    name = os.path.join(relpath, header)
+    SET_TARGET_TYPE(bld, name, 'PROTOTYPE')
     t = bld(
+        name = name,
         source = source,
         target = header,
         on_results=True,
index bf051afa3b62a4dd38a2573ef054d514e4dcb465..94975c6519eba5b7ed4c0e37f2b36642765b9332 100644 (file)
@@ -16,10 +16,10 @@ def SET_TARGET_TYPE(ctx, target, value):
     '''set the target type of a target'''
     cache = LOCAL_CACHE(ctx, 'TARGET_TYPE')
     if target in cache and cache[target] != 'EMPTY':
-        ASSERT(ctx, cache[target] == value,
-               "Target '%s' re-defined as %s - was %s" % (target, value, cache[target]))
-        debug("task_gen: Skipping duplicate target %s (curdir=%s)" % (target, ctx.curdir))
-        return False
+        Logs.error("ERROR: Target '%s' in directory %s re-defined as %s - was %s" % (target,
+                                                                                     ctx.curdir,
+                                                                                     value, cache[target]))
+        sys.exit(1)
     LOCAL_CACHE_SET(ctx, 'TARGET_TYPE', target, value)
     debug("task_gen: Target '%s' created of type '%s' in %s" % (target, value, ctx.curdir))
     return True
index dd9cbd604cca9f8e5b7b55e368fc671f3a67c0e0..633484bd6820b5d64c8223716418f4dcd0fc31f0 100644 (file)
@@ -187,12 +187,6 @@ def SAMBA_LIBRARY(bld, libname, source,
     if link_name:
         t.link_name = link_name
 
-    if autoproto is not None:
-        bld.SAMBA_AUTOPROTO(autoproto, source)
-
-    if public_headers is not None:
-        bld.PUBLIC_HEADERS(public_headers, header_path=header_path)
-
     if pc_files is not None:
         bld.PKG_CONFIG_FILES(pc_files, vnum=vnum)
 
@@ -278,10 +272,6 @@ def SAMBA_BINARY(bld, binname, source,
     if subsystem_name is not None:
         bld.TARGET_ALIAS(subsystem_name, binname)
 
-    if autoproto is not None:
-        bld.SAMBA_AUTOPROTO(autoproto, source)
-    if public_headers is not None:
-        bld.PUBLIC_HEADERS(public_headers, header_path=header_path)
 Build.BuildContext.SAMBA_BINARY = SAMBA_BINARY