[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Mon Feb 21 19:36:02 MST 2011


The branch, master has been updated
       via  c43eb39 build: added WHYNEEDED=TARGET:DEPENDENCY
       via  0e0ea4e build: enhanced the symbolcheck code
       via  949427c python: use os.environ[] instead of os.putenv()
       via  01047e0 s4-waf: fixed make test for toplevel
       via  1bf4ff2 s4-waf: added --enable-s3build configure option
       via  f0a4d3a s3-waf: build bin/smbclient3 for top level build
       via  a94f776 build: we don't need the special case for s3build any more
       via  a3aa71e s3-waf: no need to add suffix3 to smbpasswd
       via  a12239b s4-waf: rename smbpasswd library to smbpasswdparser
       via  84b235f s3-waf: convert some subsystems into private libraries
       via  7634fb6 s4-waf: rename 'param' to 'pyparam'
       via  15c0440 s3-waf: work around broken cups-config --libs output
       via  f180e1a s3build: use source3/wscript for s3 configure rules
       via  de71662 s3-waf: added support for in-tree heimdal in source3 waf build
       via  0234ac4 s3-waf: use Logs.warn() not print for configure warnings
       via  76e3af9 s3-waf: make pieces of the source3 waf wscript depends on toplevel_build
       via  ff8762e s3build: recurse into source3/
       via  e3e1cd8 s3-waf: cope with both toplevel and source3 build
       via  cf3225d s3-waf: find swat files for both toplevel and source3 build
       via  666d019 s3-waf: rename CHARSET to CHARSET3
       via  21f8170 s3-waf: use bld.env.suffix3 for differentiating toplevel build
       via  5fc565f s3-waf: LIBADS depends on krb5
       via  c6c49d8 s3-waf: make version and build directory conditional
       via  effc76d s3-waf: cope with location of include.h for toplevel build
       via  fecbe61 s3-waf: added some more krb5 dependencies
       via  ba52f83 s3-waf: renamed samba-util to samba-util3
       via  9aa85b6 s3-waf: use common libcli/nbt build rules
       via  b59aa08 s3-waf: rename 'errors' to 'errors3'
       via  3e8a4bf s3-waf: renamed tdb-wrap to tdb-wrap3
       via  81992c9 s3-waf: rename POPT_SAMBA to POPT_SAMBA3
       via  6a788b9 s3-waf: added a krb5 dependency
       via  efc9321 libcli/nbt: allow use of the waf build for nbt in source3
       via  acdfe48 s4-ndr: added NDR_WBINT to ndr_tables
      from  8fce373 s3-rpc_server: Let enpoint mapper listen on port 135.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c43eb39098d1bc507f550971fab4bce61f0e5d1a
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Feb 22 10:59:44 2011 +1100

    build: added WHYNEEDED=TARGET:DEPENDENCY
    
    you can now do:
    
      make WHYNEEDED=smbd/smbd:gensec
    
    and it will print:
    
     Checking why smbd/smbd needs to link to gensec
     target 'smbd/smbd' uses symbols set(['open_schannel_session_store']) from 'gensec'
    
    Autobuild-User: Andrew Tridgell <tridge at samba.org>
    Autobuild-Date: Tue Feb 22 03:35:58 CET 2011 on sn-devel-104

commit 0e0ea4efe3c7e7b503ec8529bacacdb8377b44f8
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Feb 22 10:47:27 2011 +1100

    build: enhanced the symbolcheck code
    
    we can now work out why a binary needs a library, and we can find all
    the duplicate symbols (we currently have 1087 symbols defined in more
    than one place in Samba).

commit 949427c208159f4ac580f547dd5465a70b4751b7
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 16:46:58 2011 +1100

    python: use os.environ[] instead of os.putenv()
    
    using os.putenv() causes too much confusion, as it doesn't update
    os.getenv()
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 01047e0ba8256ff12345222517a905fd9d66a8b5
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 16:45:53 2011 +1100

    s4-waf: fixed make test for toplevel
    
    amazingly, os.putenv() is broken. If you do os.putenv('FOO', '1') and
    then do os.getenv('FOO') you don't get '1'
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 1bf4ff2ab2e5bca2c6d7e5840fe20bd3dbd20d74
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 15:50:51 2011 +1100

    s4-waf: added --enable-s3build configure option
    
    this enables the build of the s3 binaries in the toplevel build
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit f0a4d3a9d5c77b87104a9a53adf026ee51113e80
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 15:23:08 2011 +1100

    s3-waf: build bin/smbclient3 for top level build
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit a94f7768d9f81d0d997f6ed2df8565e8a1838f2c
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 15:10:36 2011 +1100

    build: we don't need the special case for s3build any more
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit a3aa71ea3ac23c9ae20d3678fa3f6e1da24ab1b0
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 15:05:54 2011 +1100

    s3-waf: no need to add suffix3 to smbpasswd
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit a12239b131135e6ff0224d98be6feb4d3158410f
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 15:05:28 2011 +1100

    s4-waf: rename smbpasswd library to smbpasswdparser
    
    this removes a conflict with the s3 smbpasswd binary

commit 84b235fbb2889c8031851de5678c17bc538e1e55
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 14:45:37 2011 +1100

    s3-waf: convert some subsystems into private libraries
    
    put some commonly used subsystems into private libraries to reduce the
    install size
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 7634fb6393d7ed2f115e2b442214b6e747a48328
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 14:42:34 2011 +1100

    s4-waf: rename 'param' to 'pyparam'
    
    we will use 'param' for the s3 libparam.so
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 15c04403496bb940c5981dca0b960ec45e47c7d8
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 13:58:13 2011 +1100

    s3-waf: work around broken cups-config --libs output
    
    "cups-config --libs" returns -lgssapi_krb5, which ties it to the
    system krb5 library. It should get this via the indirect dependency of
    libcups.so instead.
    
    Work around this by using 'cups' as the library and avoid using --libs
    in the cups-config command
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit f180e1ab7c3957b9d387ea0b3219b1805b2bde77
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 12:17:49 2011 +1100

    s3build: use source3/wscript for s3 configure rules
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit de71662908bfc358588dfa02c8674e8662c32588
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 12:16:46 2011 +1100

    s3-waf: added support for in-tree heimdal in source3 waf build
    
    this sets up the right defines for a in-tree heimdal build
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 0234ac4e3cd44ce1990e034782fa14347a884cba
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 12:16:03 2011 +1100

    s3-waf: use Logs.warn() not print for configure warnings
    
    this highlights the warning for the user
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 76e3af95c3efe1fe93e4aaf4555eae9e518dd70a
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 12:14:38 2011 +1100

    s3-waf: make pieces of the source3 waf wscript depends on toplevel_build
    
    this will allow the toplevel build to use source3/wscript for
    configure options
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit ff8762e7fe006c7c79e0976b4cd331ef187f6481
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 11:18:21 2011 +1100

    s3build: recurse into source3/
    
    we can now use common build rules
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit e3e1cd86e9cb027057edc9eb164b8b84051243af
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 11:16:43 2011 +1100

    s3-waf: cope with both toplevel and source3 build
    
    this fixes the remaining subsystem differences for the two builds
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit cf3225d6c3898bfd425aedc894a1ddd7a484fd2a
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 11:14:49 2011 +1100

    s3-waf: find swat files for both toplevel and source3 build
    
    this finds the right swat files in both cases
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 666d01911042680039276209c1872b5d778e4015
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 11:14:13 2011 +1100

    s3-waf: rename CHARSET to CHARSET3
    
    and add an alias CHARSET when not using a toplevel build
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 21f81703ca45c105442957b88852c5edb438b8da
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 11:12:22 2011 +1100

    s3-waf: use bld.env.suffix3 for differentiating toplevel build
    
    this uses bld.env.suffix3 to mean "3" for a toplevel build, and blank
    otherwise. This allows us to change the overlapping binaries to have a
    '3' suffix
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 5fc565feacf21b5b4d221258be1bbccbd6e162e9
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 11:11:44 2011 +1100

    s3-waf: LIBADS depends on krb5
    
    needed for krb5.h when using an in-tree heimdal
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit c6c49d8ec4ba5dce968f300ff434c3f0e21e4127
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 11:10:35 2011 +1100

    s3-waf: make version and build directory conditional
    
    we don't need these when doing a toplevel build
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit effc76db100e37fb2f6824ba12a9e256aecedd48
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 11:09:56 2011 +1100

    s3-waf: cope with location of include.h for toplevel build
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit fecbe610282e023d998207e92854f7ffdad2f310
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 10:40:35 2011 +1100

    s3-waf: added some more krb5 dependencies
    
    this is needed when not using a system krb5, for finding krb5.h
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit ba52f83a3f83e029cf01a36a8849b663cb1cb166
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 10:36:11 2011 +1100

    s3-waf: renamed samba-util to samba-util3
    
    also added alias samba-util when not using a toplevel build
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 9aa85b6e30a226cf7f1d811d2c7742d2eb308417
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 10:14:54 2011 +1100

    s3-waf: use common libcli/nbt build rules
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit b59aa0826151b2f45947f49f0998155100bcef9d
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 10:14:13 2011 +1100

    s3-waf: rename 'errors' to 'errors3'
    
    and add an alias 'errors' if not doing a toplevel build
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 3e8a4bfc084ceebd9d1c78e870120c7e16af523b
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 10:12:48 2011 +1100

    s3-waf: renamed tdb-wrap to tdb-wrap3
    
    allow for a common name 'tdb-wrap'
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 81992c9ce46ddb1c5b5b846c73a0dd6fe79e2d31
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 10:09:21 2011 +1100

    s3-waf: rename POPT_SAMBA to POPT_SAMBA3
    
    This renames the POPT_SAMBA subsystem to POPT_SAMBA3. It also adds an
    alias 'POPT_SAMBA' if we are not doing a toplevel build.
    
    This allows us to use the common dependency 'POPT_SAMBA' in other waf
    rules.
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit 6a788b9d1ea38c4ad2c1b87197ebb1edacf3ed46
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 10:02:05 2011 +1100

    s3-waf: added a krb5 dependency
    
    LIBMSRPC depends on krb5.h
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit efc932112c4cdfc9f40c74e811eae685163b79c5
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 21 10:00:49 2011 +1100

    libcli/nbt: allow use of the waf build for nbt in source3
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

commit acdfe48ebe6fb7199d24eb0f93ef82b676951aac
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Feb 15 16:28:37 2011 +1100

    s4-ndr: added NDR_WBINT to ndr_tables
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 buildtools/wafsamba/samba3.py                |    6 -
 buildtools/wafsamba/symbols.py               |  129 ++++++++++--
 buildtools/wafsamba/wafsamba.py              |    2 +-
 buildtools/wafsamba/wscript                  |    4 +
 lib/tdb/wscript                              |    2 +-
 libcli/nbt/wscript_build                     |   37 ++--
 script/autobuild.py                          |    2 +-
 script/land.py                               |    2 +-
 source3/pam_smbpass/wscript_build            |    2 +-
 source3/wscript                              |  197 +++++++++++++-----
 source3/wscript_build                        |  287 +++++++++++++++-----------
 source4/dsdb/samdb/ldb_modules/wscript_build |    2 +-
 source4/lib/ldb/wscript                      |    2 +-
 source4/lib/samba3/wscript_build             |    2 +-
 source4/libnet/wscript_build                 |    2 +-
 source4/librpc/wscript_build                 |    7 +-
 source4/param/wscript_build                  |    2 +-
 source4/scripting/bin/samba_dnsupdate        |    8 +-
 source4/scripting/bin/samba_spnupdate        |    4 +-
 source4/torture/wscript_build                |    2 +-
 wintest/wintest.py                           |    4 +-
 wscript                                      |   12 +
 wscript_build                                |    7 +
 23 files changed, 482 insertions(+), 242 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/samba3.py b/buildtools/wafsamba/samba3.py
index 9344e55..cb459ad 100644
--- a/buildtools/wafsamba/samba3.py
+++ b/buildtools/wafsamba/samba3.py
@@ -50,12 +50,6 @@ def s3_fix_kwargs(bld, kwargs):
     s3dir = os.path.join(bld.env.srcdir, 'source3')
     s3reldir = os_path_relpath(s3dir, bld.curdir)
 
-    # cope with the fact that the s3 waf rules were originally written
-    # assuming relative paths to source3/. This only triggers when using the
-    # wscript rules in s3build/
-    if bld.curdir.endswith("/s3build") and not 'subdir' in kwargs:
-        kwargs['subdir'] = s3reldir
-
     # the extra_includes list is relative to the source3 directory
     extra_includes = [ '.', 'include', 'lib' ]
     if bld.env.use_intree_heimdal:
diff --git a/buildtools/wafsamba/symbols.py b/buildtools/wafsamba/symbols.py
index 5681440..4f4b303 100644
--- a/buildtools/wafsamba/symbols.py
+++ b/buildtools/wafsamba/symbols.py
@@ -5,6 +5,21 @@ import Utils, Build, subprocess, Logs
 from samba_wildcard import fake_build_environment
 from samba_utils import *
 
+# these are the data structures used in symbols.py:
+#
+# bld.env.symbol_map : dictionary mapping public symbol names to list of
+#                      subsystem names where that symbol exists
+#
+# t.in_library       : list of libraries that t is in
+#
+# bld.env.public_symbols: set of public symbols for each subsystem
+# bld.env.used_symbols  : set of used symbols for each subsystem
+#
+# bld.env.syslib_symbols: dictionary mapping system library name to set of symbols
+#                         for that library
+#
+# LOCAL_CACHE(bld, 'TARGET_TYPE') : dictionary mapping subsystem name to target type
+
 def symbols_extract(objfiles, dynamic=False):
     '''extract symbols from objfile, returning a dictionary containing
        the set of undefined and public symbols for each file'''
@@ -82,13 +97,16 @@ def find_syslib_path(bld, libname, deps):
 def build_symbol_sets(bld, tgt_list):
     '''build the public_symbols and undefined_symbols attributes for each target'''
 
-    objlist = []  # list of object file
-    objmap = {}   # map from object filename to target
+    if bld.env.public_symbols:
+        return
 
+    objlist = []  # list of object file
+    objmap = {}   # map from object filename to target (subsystem) name
 
     for t in tgt_list:
         t.public_symbols = set()
         t.undefined_symbols = set()
+        t.used_symbols = set()
         for tsk in getattr(t, 'compiled_tasks', []):
             for output in tsk.outputs:
                 objpath = output.abspath(bld.env)
@@ -100,6 +118,7 @@ def build_symbol_sets(bld, tgt_list):
         t = objmap[obj]
         t.public_symbols = t.public_symbols.union(symbols[obj]["PUBLIC"])
         t.undefined_symbols = t.undefined_symbols.union(symbols[obj]["UNDEFINED"])
+        t.used_symbols = t.used_symbols.union(symbols[obj]["UNDEFINED"])
 
     t.undefined_symbols = t.undefined_symbols.difference(t.public_symbols)
 
@@ -108,7 +127,9 @@ def build_symbol_sets(bld, tgt_list):
 
     for t in tgt_list:
         for s in t.public_symbols:
-            bld.env.symbol_map[s] = real_name(t.sname)
+            if not s in bld.env.symbol_map:
+                bld.env.symbol_map[s] = []
+            bld.env.symbol_map[s].append(real_name(t.sname))
 
     targets = LOCAL_CACHE(bld, 'TARGET_TYPE')
 
@@ -125,10 +146,26 @@ def build_symbol_sets(bld, tgt_list):
                 bld.ASSERT(t2 is not None, "Library '%s' has unknown dependency '%s'" % (name, dep))
                 bld.env.public_symbols[name] = bld.env.public_symbols[name].union(t2.public_symbols)
 
+    bld.env.used_symbols = {}
+    for t in tgt_list:
+        name = real_name(t.sname)
+        if name in bld.env.used_symbols:
+            bld.env.used_symbols[name] = bld.env.used_symbols[name].union(t.used_symbols)
+        else:
+            bld.env.used_symbols[name] = t.used_symbols
+        if t.samba_type == 'LIBRARY':
+            for dep in t.add_objects:
+                t2 = bld.name_to_obj(dep, bld.env)
+                bld.ASSERT(t2 is not None, "Library '%s' has unknown dependency '%s'" % (name, dep))
+                bld.env.used_symbols[name] = bld.env.used_symbols[name].union(t2.used_symbols)
+
 
 def build_syslib_sets(bld, tgt_list):
     '''build the public_symbols for all syslibs'''
 
+    if bld.env.syslib_symbols:
+        return
+
     # work out what syslibs we depend on, and what targets those are used in
     syslibs = {}
     objmap = {}
@@ -165,7 +202,9 @@ def build_syslib_sets(bld, tgt_list):
     # add to the map of symbols to dependencies
     for lib in symbols:
         for sym in symbols[lib]["PUBLIC"]:
-            bld.env.symbol_map[sym] = objmap[lib]
+            if not sym in bld.env.symbol_map:
+                bld.env.symbol_map[sym] = []
+            bld.env.symbol_map[sym].append(objmap[lib])
 
     # keep the libc symbols as well, as these are useful for some of the
     # sanity checks
@@ -175,6 +214,7 @@ def build_syslib_sets(bld, tgt_list):
     for lib in bld.env.syslib_symbols:
         bld.env.public_symbols[objmap[lib]] = bld.env.syslib_symbols[lib]
 
+
 def build_autodeps(bld, t):
     '''build the set of dependencies for a target'''
     deps = set()
@@ -187,21 +227,21 @@ def build_autodeps(bld, t):
             continue
         if sym in bld.env.symbol_map:
             depname = bld.env.symbol_map[sym]
-            if depname == name:
+            if depname == [ name ]:
                 # self dependencies aren't interesting
                 continue
-            if t.in_library == [depname]:
+            if t.in_library == depname:
                 # no need to depend on the library we are part of
                 continue
-            if depname in ['c', 'python']:
+            if depname[0] in ['c', 'python']:
                 # these don't go into autodeps
                 continue
-            if targets[depname] in [ 'SYSLIB' ]:
-                deps.add(depname)
+            if targets[depname[0]] in [ 'SYSLIB' ]:
+                deps.add(depname[0])
                 continue
-            t2 = bld.name_to_obj(depname, bld.env)
+            t2 = bld.name_to_obj(depname[0], bld.env)
             if len(t2.in_library) != 1:
-                deps.add(depname)
+                deps.add(depname[0])
                 continue
             if t2.in_library == t.in_library:
                 # if we're part of the same library, we don't need to autodep
@@ -212,6 +252,10 @@ def build_autodeps(bld, t):
 
 def build_library_names(bld, tgt_list):
     '''add a in_library attribute to all targets that are part of a library'''
+
+    if bld.env.done_build_library_names:
+        return
+
     for t in tgt_list:
         t.in_library = []
 
@@ -222,6 +266,7 @@ def build_library_names(bld, tgt_list):
                 if t2 and t2.samba_type in [ 'SUBSYSTEM', 'ASN1' ]:
                     if not t.sname in t2.in_library:
                         t2.in_library.append(t.sname)
+    bld.env.done_build_library_names = True
 
 
 def check_library_deps(bld, t):
@@ -293,9 +338,9 @@ def check_dependencies(bld, t):
     for sym in remaining:
         if sym in bld.env.symbol_map:
             dep = bld.env.symbol_map[sym]
-            if not dep in needed:
-                needed[dep] = set()
-            needed[dep].add(sym)
+            if not dep[0] in needed:
+                needed[dep[0]] = set()
+            needed[dep[0]].add(sym)
         else:
             t.unsatisfied_symbols.add(sym)
 
@@ -321,7 +366,7 @@ def check_syslib_dependencies(bld, t):
     needed = {}
     for sym in t.unsatisfied_symbols:
         if sym in bld.env.symbol_map:
-            dep = bld.env.symbol_map[sym]
+            dep = bld.env.symbol_map[sym][0]
             if dep == 'c':
                 continue
             if not dep in needed:
@@ -369,6 +414,49 @@ def symbols_syslibcheck(task):
         check_syslib_dependencies(bld, t)
 
 
+def symbols_whyneeded(task):
+    """check why 'target' needs to link to 'subsystem'"""
+    bld = task.env.bld
+    tgt_list = get_tgt_list(bld)
+
+    why = Options.options.WHYNEEDED.split(":")
+    if len(why) != 2:
+        raise Utils.WafError("usage: WHYNEEDED=TARGET:DEPENDENCY")
+    target = why[0]
+    subsystem = why[1]
+
+    build_symbol_sets(bld, tgt_list)
+    build_library_names(bld, tgt_list)
+    build_syslib_sets(bld, tgt_list)
+
+    Logs.info("Checking why %s needs to link to %s" % (target, subsystem))
+    if not target in bld.env.used_symbols:
+        Logs.warn("unable to find target '%s' in used_symbols dict" % target)
+        return
+    if not subsystem in bld.env.public_symbols:
+        Logs.warn("unable to find subsystem '%s' in public_symbols dict" % subsystem)
+        return
+    overlap = bld.env.used_symbols[target].intersection(bld.env.public_symbols[subsystem])
+    if not overlap:
+        Logs.info("target '%s' doesn't use any public symbols from '%s'" % (target, subsystem))
+    else:
+        Logs.info("target '%s' uses symbols %s from '%s'" % (target, overlap, subsystem))
+
+
+
+def symbols_dupcheck(task):
+    '''check for symbols defined in two different subsystems'''
+    bld = task.env.bld
+    tgt_list = get_tgt_list(bld)
+
+    Logs.info("Checking for duplicate symbols")
+    for sym in bld.env.symbol_map:
+        subsystems = bld.env.symbol_map[sym]
+        if len(subsystems) == 1:
+            continue
+        Logs.info("symbol %s appears in %s" % (sym, subsystems))
+
+
 def SYMBOL_CHECK(bld):
     '''check our dependency lists'''
     if Options.options.SYMBOLCHECK:
@@ -379,4 +467,15 @@ def SYMBOL_CHECK(bld):
         bld.SET_BUILD_GROUP('syslibcheck')
         task = bld(rule=symbols_syslibcheck, always=True, name='syslib checking')
         task.env.bld = bld
+
+        bld.SET_BUILD_GROUP('syslibcheck')
+        task = bld(rule=symbols_dupcheck, always=True, name='symbol duplicate checking')
+        task.env.bld = bld
+
+    if Options.options.WHYNEEDED:
+        bld.SET_BUILD_GROUP('syslibcheck')
+        task = bld(rule=symbols_whyneeded, always=True, name='check why a dependency is needed')
+        task.env.bld = bld
+
+
 Build.BuildContext.SYMBOL_CHECK = SYMBOL_CHECK
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 8c42966..ebe8fba 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -37,7 +37,7 @@ if os.environ.get('WAF_NOTHREADS') == '1':
 
 LIB_PATH="shared"
 
-os.putenv('PYTHONUNBUFFERED', '1')
+os.environ['PYTHONUNBUFFERED'] = '1'
 
 
 if Constants.HEXVERSION < 0x105019:
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 4f93bb1..ecc2ae5 100755
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -121,6 +121,10 @@ def set_options(opt):
                   help=("check symbols in object files against project rules"),
                   action='store_true', dest='SYMBOLCHECK', default=False)
 
+    gr.add_option('--why-needed',
+                  help=("TARGET:DEPENDENCY check why TARGET needs DEPENDENCY"),
+                  action='store', type='str', dest='WHYNEEDED', default=None)
+
     gr.add_option('--show-duplicates',
                   help=("Show objects which are included in multiple binaries or libraries"),
                   action='store_true', dest='SHOW_DUPLICATES', default=False)
diff --git a/lib/tdb/wscript b/lib/tdb/wscript
index d20c938..f704bc7 100644
--- a/lib/tdb/wscript
+++ b/lib/tdb/wscript
@@ -119,7 +119,7 @@ def test(ctx):
     test_prefix = "%s/st" % (Utils.g_module.blddir)
     shutil.rmtree(test_prefix, ignore_errors=True)
     os.makedirs(test_prefix)
-    os.putenv('TEST_DATA_PREFIX', test_prefix)
+    os.environ['TEST_DATA_PREFIX'] = test_prefix
     cmd = os.path.join(Utils.g_module.blddir, 'tdbtorture')
     ret = samba_utils.RUN_COMMAND(cmd)
     print("testsuite returned %d" % ret)
diff --git a/libcli/nbt/wscript_build b/libcli/nbt/wscript_build
index 7229d12..7e30470 100644
--- a/libcli/nbt/wscript_build
+++ b/libcli/nbt/wscript_build
@@ -7,23 +7,22 @@ bld.SAMBA_SUBSYSTEM('NDR_NBT_BUF',
 	)
 
 
-bld.SAMBA_LIBRARY('cli-nbt',
-	source='lmhosts.c nbtsocket.c namequery.c nameregister.c namerefresh.c namerelease.c dns_hosts_file.c',
-	public_deps='ndr NDR_NBT tevent UTIL_TEVENT NDR_SECURITY samba_socket samba-util',
-	private_library=True
-	)
-
-
-bld.SAMBA_BINARY('nmblookup',
-	source='tools/nmblookup.c',
-	manpages='man/nmblookup.1',
-	deps='samba-hostconfig samba-util cli-nbt popt POPT_SAMBA netif LIBCLI_RESOLVE'
-	)
-
-
-bld.SAMBA_PYTHON('python_netbios',
-	source='pynbt.c',
-	public_deps='cli-nbt DYNCONFIG samba-hostconfig',
-	realname='samba/netbios.so'
-	)
+if bld.env._SAMBA_BUILD_ == 4:
+    bld.SAMBA_LIBRARY('cli-nbt',
+                      source='lmhosts.c nbtsocket.c namequery.c nameregister.c namerefresh.c namerelease.c dns_hosts_file.c',
+                      public_deps='ndr NDR_NBT tevent UTIL_TEVENT NDR_SECURITY samba_socket samba-util',
+                      private_library=True
+                      )
+
+    bld.SAMBA_BINARY('nmblookup',
+                     source='tools/nmblookup.c',
+                     manpages='man/nmblookup.1',
+                     deps='samba-hostconfig samba-util cli-nbt popt POPT_SAMBA netif LIBCLI_RESOLVE'
+                     )
+
+    bld.SAMBA_PYTHON('python_netbios',
+                     source='pynbt.c',
+                     public_deps='cli-nbt DYNCONFIG samba-hostconfig',
+                     realname='samba/netbios.so'
+                     )
 
diff --git a/script/autobuild.py b/script/autobuild.py
index b029285..c6e965e 100755
--- a/script/autobuild.py
+++ b/script/autobuild.py
@@ -14,7 +14,7 @@ samba_master_ssh = os.getenv('SAMBA_MASTER_SSH', 'git+ssh://git.samba.org/data/g
 
 cleanup_list = []
 
-os.putenv('CC', "ccache gcc")
+os.environ['CC'] = "ccache gcc"
 
 builddirs = {
     "samba3"  : "source3",
diff --git a/script/land.py b/script/land.py
index 4b7d1ca..f8ae7b4 100755
--- a/script/land.py
+++ b/script/land.py
@@ -26,7 +26,7 @@ samba_master_ssh = os.getenv('SAMBA_MASTER_SSH', 'git+ssh://git.samba.org/data/g
 
 cleanup_list = []
 
-os.putenv('CC', "ccache gcc")
+os.environ['CC'] = "ccache gcc"
 
 tasks = {
     "source3" : [ ("autogen", "./autogen.sh", "text/plain"),
diff --git a/source3/pam_smbpass/wscript_build b/source3/pam_smbpass/wscript_build
index d027979..0e07927 100644
--- a/source3/pam_smbpass/wscript_build
+++ b/source3/pam_smbpass/wscript_build
@@ -6,7 +6,7 @@ if bld.CONFIG_SET('WITH_PAM_MODULES'):
                   pam_smb_passwd.c
                   pam_smb_acct.c
                   support.c''',
-        deps='''tdb talloc pam PAM_ERRORS wbclient cap ASN1_UTIL PARAM LIB_NONSMBD PASSDB GROUPDB SMBLDAP
+        deps='''tdb talloc pam PAM_ERRORS wbclient cap ASN1_UTIL param LIB_NONSMBD passdb GROUPDB SMBLDAP
                 LIBSAMBA LIBTSOCKET''',
         cflags='-DLOCALEDIR=\"%s/locale\"' % bld.env.DATADIR,
         realname='pam_smbpass.so',
diff --git a/source3/wscript b/source3/wscript
index 9e5a8de..d3c41b6 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -9,21 +9,23 @@ VERSION=None
 import sys, os
 from optparse import SUPPRESS_HELP
 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
-import wafsamba, Options
+sys.path.insert(0, "source3")
+import wafsamba, Options, Logs, Utils
 import build.charset
 import samba_utils, samba_version
 import samba3
 
 def set_options(opt):
-    opt.BUILTIN_DEFAULT('NONE')
-    opt.PRIVATE_EXTENSION_DEFAULT('s3')
-    opt.RECURSE('../lib/replace')
-    opt.RECURSE('build')
-    opt.RECURSE('selftest')
-    opt.RECURSE('../lib/nss_wrapper')
-    opt.RECURSE('../lib/socket_wrapper')
-    opt.RECURSE('../lib/tevent')
-    opt.RECURSE('../lib/tdb')
+    if not os.getenv('TOPLEVEL_BUILD'):
+        opt.BUILTIN_DEFAULT('NONE')
+        opt.PRIVATE_EXTENSION_DEFAULT('s3')
+        opt.RECURSE('../lib/replace')
+        opt.RECURSE('build')
+        opt.RECURSE('selftest')
+        opt.RECURSE('../lib/nss_wrapper')
+        opt.RECURSE('../lib/socket_wrapper')
+        opt.RECURSE('../lib/tevent')
+        opt.RECURSE('../lib/tdb')
 
     opt.add_option('--with-static-modules',
                    help=("Comma-separated list of names of modules to statically link in"),
@@ -61,40 +63,41 @@ def set_options(opt):
 def configure(conf):
     from samba_utils import TO_LIST
 
-    version = samba_version.load_version(env=conf.env)
-
-    conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
-    conf.DEFINE('_SAMBA_BUILD_', version.MAJOR, add_to_cflags=True)
-    conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
+    if not conf.env.toplevel_build:
+        version = samba_version.load_version(env=conf.env)
+        conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
+        conf.DEFINE('_SAMBA_BUILD_', version.MAJOR, add_to_cflags=True)
+        conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
 
     if Options.options.developer:
         conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
-        conf.env['developer'] = True
+        conf.env.developer = True
 
     if Options.options.with_swat:
         conf.env['build_swat'] = True
 
-    conf.RECURSE('../lib/replace')
-    conf.RECURSE('build')
-    conf.RECURSE('../lib/tdb')
-    conf.RECURSE('../lib/talloc')
-    conf.RECURSE('../lib/tevent')
-    conf.RECURSE('../lib/popt')
-    conf.RECURSE('../lib/nss_wrapper')
-    conf.RECURSE('../lib/socket_wrapper')
-    conf.RECURSE('../lib/zlib')
-    conf.RECURSE('../libcli/smbreadline')
-    conf.RECURSE('../lib/util')
-
-    conf.ADD_EXTRA_INCLUDES('''#source3 #source3/include #lib/replace''')
-    if not conf.env.USING_SYSTEM_TDB:
-        conf.ADD_EXTRA_INCLUDES('#lib/tdb/include')
-    if not conf.env.USING_SYSTEM_TEVENT:
-        conf.ADD_EXTRA_INCLUDES('#lib/tevent')
-    if not conf.env.USING_SYSTEM_TALLOC:
-        conf.ADD_EXTRA_INCLUDES('#lib/talloc')
-    if not conf.env.USING_SYSTEM_POPT:
-        conf.ADD_EXTRA_INCLUDES('#lib/popt')
+    if not conf.env.toplevel_build:
+        conf.RECURSE('../lib/replace')
+        conf.RECURSE('build')
+        conf.RECURSE('../lib/tdb')
+        conf.RECURSE('../lib/talloc')
+        conf.RECURSE('../lib/tevent')
+        conf.RECURSE('../lib/popt')
+        conf.RECURSE('../lib/nss_wrapper')
+        conf.RECURSE('../lib/socket_wrapper')
+        conf.RECURSE('../lib/zlib')
+        conf.RECURSE('../libcli/smbreadline')
+        conf.RECURSE('../lib/util')
+
+        conf.ADD_EXTRA_INCLUDES('''#source3 #source3/include #lib/replace''')
+        if not conf.env.USING_SYSTEM_TDB:
+            conf.ADD_EXTRA_INCLUDES('#lib/tdb/include')
+        if not conf.env.USING_SYSTEM_TEVENT:
+            conf.ADD_EXTRA_INCLUDES('#lib/tevent')
+        if not conf.env.USING_SYSTEM_TALLOC:
+            conf.ADD_EXTRA_INCLUDES('#lib/talloc')
+        if not conf.env.USING_SYSTEM_POPT:
+            conf.ADD_EXTRA_INCLUDES('#lib/popt')
 
     conf.ADD_LDFLAGS("-Wl,--export-dynamic", testflags=True)
 
@@ -295,7 +298,7 @@ utimensat vsyslog _write __write __xstat
     # checks for OSes.
     import sys
     host_os = sys.platform


-- 
Samba Shared Repository


More information about the samba-cvs mailing list