[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Mon Mar 14 22:08:02 MDT 2011


The branch, master has been updated
       via  b2b41a5 libcli: protect access_check.h against double inclusion
       via  1404a9f waf: ensure that MAKEFLAGS is set before parsing it
       via  500c854 build: added simple header handling for our libraries
       via  af28fac s3-waf: enable public_headers_allow_broken
       via  4907695 build: removed mkdir of public headers directory
       via  fd328f8 build: added public_headers_allow_broken option
       via  7a57f72 s3-waf: enable public header building in s3
       via  0232964 waf: auto-create include paths if needed
       via  20ec0b6 waf: make mkdir_p() a bit more robust
       via  72ca88d build: fixed cflags for test_header
       via  b4d618c waf: build headers in separate 'headers' build group
       via  f303db5 build: force _SAMBA_BUILD_==4 to be true in public headers
       via  827d020 ldb: only install headers if we are not building as a private lib
       via  c56e3cc lib: don't install public headers if a private library
       via  f8655f4 waf: always generate public headers in the build tree
       via  c3f04a9 build: mark some private includes as OK in public headers
       via  7dc049e rpc: make ndr/ndr_svcctl.h public
       via  803136a s4-rpc: make common/proto.h public
       via  793ffea s4-policy: don't make s4 policy.h public
       via  bc99b62 ldb: use include <> form for public headers
       via  6c6ab50 waf: build substituted public headers in build tree
       via  5ca9db0 lib: fixed header paths
       via  7293c37 talloc: use <talloc.h> not "talloc.h"
       via  7b948a3 tdb: use public_headers to install header files
       via  0a0ebd7 tdb: use system include style for system headers
       via  f2bcb70 waf: moved header file handling into its own module
       via  ba9ae79 build: added automated testing of our public headers
       via  dc42ad0 build: added include/public to the list of include paths
       via  a18a556 tevent: use public_headers for tevent.h
       via  e3e1ead talloc: use public_headers to install talloc.h and pytalloc.h
       via  03aebc2 wafsamba: keep a list of public headers
       via  1c0e539 wafsamba: don't follow symlinks outside the build tree
       via  59be726 wafsamba: added global_include option
       via  4f52bec build: install public headers in the build tree
       via  b7b2426 ldb: don't install ldb_wrap.h twice
       via  36b48ad build: added placeholder files for public header directories
       via  48ea48d s4-rpc: added public APIs for dce_call authentication
      from  a6d07a8 Re-enable base.tcondev test for S3, now we pass it correctly.

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


- Log -----------------------------------------------------------------
commit b2b41a5087d2d20180a3dd7176d9978f2d677ab5
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 15 14:05:42 2011 +1100

    libcli: protect access_check.h against double inclusion
    
    Autobuild-User: Andrew Tridgell <tridge at samba.org>
    Autobuild-Date: Tue Mar 15 05:07:01 CET 2011 on sn-devel-104

commit 1404a9fe72b2eeb116cfff778408f1671a8a4512
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 15 13:56:46 2011 +1100

    waf: ensure that MAKEFLAGS is set before parsing it

commit 500c854f792f4a72ef9ac1d100608d5cdc45e7fc
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 15 13:09:30 2011 +1100

    build: added simple header handling for our libraries
    
    we don't need header munging for tdb/talloc etc

commit af28facc03809fabd11cd729685588d850d6ef3b
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 8 16:44:17 2011 +1100

    s3-waf: enable public_headers_allow_broken

commit 4907695012cb50bc63abdc799ca929263fab74a2
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 8 16:43:49 2011 +1100

    build: removed mkdir of public headers directory
    
    not needed now that we have public_headers_allow_broken

commit fd328f8f81e48943462a6de8c9cd1b78624a1987
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 8 16:42:42 2011 +1100

    build: added public_headers_allow_broken option
    
    the s3 waf build will use this to say that we should allow public
    headers that contain references to non-public headers. In the s4 build
    that is not allowed, but the s3 build does not yet have clean public
    headers

commit 7a57f72ef46f37e90aaa05926636c57cdd91b4a4
Author: Andrew Tridgell <tridge at samba.org>
Date:   Tue Mar 8 13:01:21 2011 +1100

    s3-waf: enable public header building in s3

commit 023296423aab11dd2300f09f158e5234503b46c0
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Mar 4 17:11:33 2011 +1100

    waf: auto-create include paths if needed

commit 20ec0b6629a35e40f97265b0fe6fdee4df274951
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Mar 4 17:11:20 2011 +1100

    waf: make mkdir_p() a bit more robust

commit 72ca88d6047e3dcce53c720db866171fb9963914
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 18:06:00 2011 +1100

    build: fixed cflags for test_header
    
    when using system libraries, we need the right cflags

commit b4d618cc6ff72e2cb097da92f97018e85af286b6
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 17:41:45 2011 +1100

    waf: build headers in separate 'headers' build group

commit f303db5bfd627b8764f031671d95d69ad271674c
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 17:22:38 2011 +1100

    build: force _SAMBA_BUILD_==4 to be true in public headers
    
    for s4 public headers, this is always true

commit 827d020f7e51b179e7e629602ee4d02ba610bde5
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 17:21:45 2011 +1100

    ldb: only install headers if we are not building as a private lib

commit c56e3ccfc9eafbb69b03dc40346e3115bec42ef6
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 17:19:33 2011 +1100

    lib: don't install public headers if a private library
    
    for talloc/tevent/tdb, only install headers if we are doing a
    standalone build

commit f8655f4621a0dbacb712d384565c590f057adbbf
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 17:18:58 2011 +1100

    waf: always generate public headers in the build tree
    
    this allows us to properly test our public headers before install

commit c3f04a9f3520000b6347aaa6cd4c431e81976d40
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 16:34:57 2011 +1100

    build: mark some private includes as OK in public headers
    
    these are includes which are protected by #ifdefs which means they
    don't get exposed to public users

commit 7dc049e5a29c7fcad6046e164f2e4ce9f0292949
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 16:34:13 2011 +1100

    rpc: make ndr/ndr_svcctl.h public
    
    this is used by public header gen_ndr/ndr_svcctl.h

commit 803136a18419364b702e6234213c1445e024e1fe
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 16:33:12 2011 +1100

    s4-rpc: make common/proto.h public
    
    this is needed by public header common.h

commit 793ffea0341d49a86c8061a8a8bb56632301c6b9
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 16:32:39 2011 +1100

    s4-policy: don't make s4 policy.h public
    
    if we are going to make GPO headers public, it should be from libgpo/

commit bc99b62b3a20e59069fda354c39c58d327f2c0bf
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 16:31:00 2011 +1100

    ldb: use include <> form for public headers

commit 6c6ab50a40853c0d5d552967bccf11a16ecfc913
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 16:30:33 2011 +1100

    waf: build substituted public headers in build tree
    
    the bin/default/include/public directory will contain headers that are
    ready to install

commit 5ca9db07f5580ca5285fbdbc307fa225e923fda1
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 16:29:15 2011 +1100

    lib: fixed header paths
    
    this is a public header, and needs to use sane paths for the public
    header creation

commit 7293c370d3283c07112e5ce9d0555f91b514cec3
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 16:28:14 2011 +1100

    talloc: use <talloc.h> not "talloc.h"
    
    this ensures we use the right header

commit 7b948a39e1783ff4732f9734830b0544d6a814b1
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 16:27:44 2011 +1100

    tdb: use public_headers to install header files

commit 0a0ebd73fb98002f099544eca5deaf6763790277
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 16:27:26 2011 +1100

    tdb: use system include style for system headers

commit f2bcb7028e846aee7e83a1009297f710916d2a4e
Author: Andrew Tridgell <tridge at samba.org>
Date:   Thu Mar 3 13:23:13 2011 +1100

    waf: moved header file handling into its own module
    
    It is getting quite complex now, and shouldn't just be mixed in with
    everything else

commit ba9ae79e0b6a92ef78db9c5efec98311d03550d8
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 28 18:57:25 2011 +1100

    build: added automated testing of our public headers
    
    we generate test_headers.h, which includes all of our public headers,
    and check it compiles

commit dc42ad02f9b3039d311670d20d42c3e87d03b275
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 28 18:56:33 2011 +1100

    build: added include/public to the list of include paths
    
    this allows us to use the public name of any header in the source tree

commit a18a5562377acaf26d42a431adbe3a673c013e93
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 28 18:56:05 2011 +1100

    tevent: use public_headers for tevent.h

commit e3e1eada45d28fa2034919d1096c0437da80ecff
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 28 18:55:52 2011 +1100

    talloc: use public_headers to install talloc.h and pytalloc.h
    
    this allows them to be included in the test_headers.h generated header

commit 03aebc2df870803ad6f80eb7595b55254d5ccfc5
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 28 18:55:12 2011 +1100

    wafsamba: keep a list of public headers
    
    this will be used to construct test_headers.h, for testing our public
    headers

commit 1c0e539cbbcb78b25a5dbbbf86ac5dc272e532bb
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 28 18:53:36 2011 +1100

    wafsamba: don't follow symlinks outside the build tree
    
    when computing stale files, don't follow symlinks that are not within
    the build tree

commit 59be7265ad8e0d923ab3856fed41ab43ffdf1269
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 28 18:52:36 2011 +1100

    wafsamba: added global_include option
    
    this allows you to disable the global include additions. We will use
    this for testing our public headers without including any of the
    source tree directories

commit 4f52becec1769e9378cf8de1ec13ee83d9b96f55
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 28 15:48:25 2011 +1100

    build: install public headers in the build tree
    
    this symlinks our public headers into the build tree, which will allow
    us to refer to the public headers by their public name inside the
    source tree.

commit b7b2426fe3ac091f0f8705d82ac212a099d075cc
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 28 15:46:41 2011 +1100

    ldb: don't install ldb_wrap.h twice

commit 36b48ad9a299bf937e1815da7ff93827a3723e5f
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Feb 28 13:28:54 2011 +1100

    build: added placeholder files for public header directories
    
    this will allow us to 'install' public headers into include/public in
    the build. That means we can use the same include paths for our public
    headers inside Samba as external applications. This should make it
    less likely that we will break our public includes

commit 48ea48d5031f7118cf39b0233799d02e8bae6946
Author: Andrew Tridgell <tridge at samba.org>
Date:   Fri Feb 25 13:13:01 2011 +1100

    s4-rpc: added public APIs for dce_call authentication
    
    Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 buildtools/wafsamba/samba_deps.py       |    5 +-
 buildtools/wafsamba/samba_headers.py    |  180 +++++++++++++++++++++++++++++++
 buildtools/wafsamba/samba_utils.py      |    9 ++-
 buildtools/wafsamba/stale_files.py      |    4 +-
 buildtools/wafsamba/wafsamba.py         |  180 ++++---------------------------
 include/public/README.txt               |    6 +
 include/public/core/README.txt          |    6 +
 include/public/dcerpc_server/README.txt |    6 +
 include/public/gen_ndr/README.txt       |    6 +
 include/public/ndr/README.txt           |    6 +
 include/public/samba/README.txt         |    6 +
 include/public/security/README.txt      |    6 +
 include/public/util/README.txt          |    6 +
 lib/talloc/wscript                      |    5 +-
 lib/tdb/include/tdb.h                   |    2 +-
 lib/tdb/wscript                         |    3 +-
 lib/tevent/wscript                      |    3 +-
 lib/util/talloc_stack.h                 |    2 +-
 lib/util/util.h                         |   16 ++--
 libcli/security/access_check.h          |    3 +
 libcli/security/wscript_build           |    2 +
 librpc/wscript_build                    |    4 +-
 source3/wscript_build                   |   10 ++
 source4/lib/ldb-samba/wscript_build     |    1 -
 source4/lib/ldb/include/ldb.h           |    4 +-
 source4/lib/ldb/include/ldb_module.h    |    2 +-
 source4/lib/ldb/wscript                 |    5 +-
 source4/lib/policy/wscript_build        |    1 -
 source4/rpc_server/dcerpc_server.c      |   19 ++++
 source4/rpc_server/dcerpc_server.h      |   10 ++
 source4/rpc_server/wscript_build        |    2 +-
 testsuite/headers/test_headers.c        |   43 ++++++++
 testsuite/headers/wscript_build         |   41 +++++++
 wscript                                 |    2 +-
 wscript_build                           |   12 ++
 35 files changed, 432 insertions(+), 186 deletions(-)
 create mode 100644 buildtools/wafsamba/samba_headers.py
 create mode 100644 include/public/README.txt
 create mode 100644 include/public/core/README.txt
 create mode 100644 include/public/dcerpc_server/README.txt
 create mode 100644 include/public/gen_ndr/README.txt
 create mode 100644 include/public/ndr/README.txt
 create mode 100644 include/public/samba/README.txt
 create mode 100644 include/public/security/README.txt
 create mode 100644 include/public/util/README.txt
 create mode 100644 testsuite/headers/test_headers.c
 create mode 100644 testsuite/headers/wscript_build


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py
index a3968ad..adeb364 100644
--- a/buildtools/wafsamba/samba_deps.py
+++ b/buildtools/wafsamba/samba_deps.py
@@ -137,7 +137,7 @@ def build_includes(self):
 
     includes.extend(self.samba_includes_extended)
 
-    if 'EXTRA_INCLUDES' in bld.env:
+    if 'EXTRA_INCLUDES' in bld.env and getattr(self, 'global_include', True):
         includes.extend(bld.env['EXTRA_INCLUDES'])
 
     includes.append('#')
@@ -958,7 +958,8 @@ def show_object_duplicates(bld, tgt_list):
 # this provides a way to save our dependency calculations between runs
 savedeps_version = 3
 savedeps_inputs  = ['samba_deps', 'samba_includes', 'local_include', 'local_include_first', 'samba_cflags',
-                    'source', 'grouping_library', 'samba_ldflags', 'allow_undefined_symbols' ]
+                    'source', 'grouping_library', 'samba_ldflags', 'allow_undefined_symbols',
+                    'use_global_deps', 'global_include' ]
 savedeps_outputs = ['uselib', 'uselib_local', 'add_objects', 'includes', 'ccflags', 'ldflags', 'samba_deps_extended']
 savedeps_outenv  = ['INC_PATHS']
 savedeps_envvars = ['NONSHARED_BINARIES', 'GLOBAL_DEPENDENCIES', 'EXTRA_CFLAGS', 'EXTRA_LDFLAGS', 'EXTRA_INCLUDES' ]
diff --git a/buildtools/wafsamba/samba_headers.py b/buildtools/wafsamba/samba_headers.py
new file mode 100644
index 0000000..cca6420
--- /dev/null
+++ b/buildtools/wafsamba/samba_headers.py
@@ -0,0 +1,180 @@
+# specialist handling of header files for Samba
+
+import Build, re, Task, TaskGen, shutil, sys, Logs
+from samba_utils import *
+
+
+def header_install_path(header, header_path):
+    '''find the installation path for a header, given a header_path option'''
+    if not header_path:
+        return ''
+    if not isinstance(header_path, list):
+        return header_path
+    for (p1, dir) in header_path:
+        for p2 in TO_LIST(p1):
+            if fnmatch.fnmatch(header, p2):
+                return dir
+    # default to current path
+    return ''
+
+
+re_header = re.compile('^\s*#\s*include[ \t]*"([^"]+)"', re.I | re.M)
+
+# a dictionary mapping source header paths to public header paths
+header_map = {}
+
+def find_suggested_header(hpath):
+    '''find a suggested header path to use'''
+    base = os.path.basename(hpath)
+    ret = []
+    for h in header_map:
+        if os.path.basename(h) == base:
+            ret.append('<%s>' % header_map[h])
+            ret.append('"%s"' % h)
+    return ret
+
+def create_public_header(task):
+    '''create a public header from a private one, output within the build tree'''
+    src = task.inputs[0].abspath(task.env)
+    tgt = task.outputs[0].bldpath(task.env)
+
+    if os.path.exists(tgt):
+        os.unlink(tgt)
+
+    relsrc = os_path_relpath(src, task.env.TOPDIR)
+
+    infile  = open(src, mode='r')
+    outfile = open(tgt, mode='w')
+    linenumber = 0
+
+    search_paths = [ '', task.env.RELPATH ]
+    for i in task.env.EXTRA_INCLUDES:
+        if i.startswith('#'):
+            search_paths.append(i[1:])
+
+    for line in infile:
+        linenumber += 1
+
+        # allow some straight substitutions
+        if task.env.public_headers_replace and line.strip() in task.env.public_headers_replace:
+            outfile.write(task.env.public_headers_replace[line.strip()] + '\n')
+            continue
+
+        # see if its an include line
+        m = re_header.match(line)
+        if m is None:
+            outfile.write(line)
+            continue
+
+        # its an include, get the header path
+        hpath = m.group(1)
+        if hpath.startswith("bin/default/"):
+            hpath = hpath[12:]
+
+        # some are always allowed
+        if task.env.public_headers_skip and hpath in task.env.public_headers_skip:
+            outfile.write(line)
+            continue
+
+        # work out the header this refers to
+        found = False
+        for s in search_paths:
+            p = os.path.normpath(os.path.join(s, hpath))
+            if p in header_map:
+                outfile.write("#include <%s>\n" % header_map[p])
+                found = True
+                break
+        if found:
+            continue
+
+        if task.env.public_headers_allow_broken:
+            Logs.warn("Broken public header include '%s' in '%s'" % (hpath, relsrc))
+            outfile.write(line)
+            continue
+
+        # try to be nice to the developer by suggesting an alternative
+        suggested = find_suggested_header(hpath)
+        outfile.close()
+        os.unlink(tgt)
+        sys.stderr.write("%s:%u:Error: unable to resolve public header %s (maybe try one of %s)\n" % (
+            os.path.relpath(src, os.getcwd()), linenumber, hpath, suggested))
+        raise Utils.WafError("Unable to resolve header path '%s' in public header '%s' in directory %s" % (
+            hpath, relsrc, task.env.RELPATH))
+    infile.close()
+    outfile.close()
+
+
+def public_headers_simple(bld, public_headers, header_path=None, public_headers_install=True):
+    '''install some headers - simple version, no munging needed
+    '''
+    if not public_headers_install:
+        return
+    for h in TO_LIST(public_headers):
+        inst_path = header_install_path(h, header_path)
+        if h.find(':') != -1:
+            s = h.split(":")
+            h_name =  s[0]
+            inst_name = s[1]
+        else:
+            h_name =  h
+            inst_name = os.path.basename(h)
+        bld.INSTALL_FILES('${INCLUDEDIR}', h_name, destname=inst_name)
+        
+
+
+def PUBLIC_HEADERS(bld, public_headers, header_path=None, public_headers_install=True):
+    '''install some headers
+
+    header_path may either be a string that is added to the INCLUDEDIR,
+    or it can be a dictionary of wildcard patterns which map to destination
+    directories relative to INCLUDEDIR
+    '''
+    bld.SET_BUILD_GROUP('final')
+
+    if not bld.env.build_public_headers:
+        # in this case no header munging neeeded. Used for tdb, talloc etc
+        public_headers_simple(bld, public_headers, header_path=header_path,
+                              public_headers_install=public_headers_install)
+        return
+
+    # create the public header in the given path
+    # in the build tree
+    for h in TO_LIST(public_headers):
+        inst_path = header_install_path(h, header_path)
+        if h.find(':') != -1:
+            s = h.split(":")
+            h_name =  s[0]
+            inst_name = s[1]
+        else:
+            h_name =  h
+            inst_name = os.path.basename(h)
+        relpath1 = os_path_relpath(bld.srcnode.abspath(), bld.curdir)
+        relpath2 = os_path_relpath(bld.curdir, bld.srcnode.abspath())
+        targetdir = os.path.normpath(os.path.join(relpath1, bld.env.build_public_headers, inst_path))
+        if not os.path.exists(os.path.join(bld.curdir, targetdir)):
+            raise Utils.WafError("missing source directory %s for public header %s" % (targetdir, inst_name))
+        target = os.path.join(targetdir, inst_name)
+
+        # the source path of the header, relative to the top of the source tree
+        src_path = os.path.normpath(os.path.join(relpath2, h_name))
+
+        # the install path of the header, relative to the public include directory
+        target_path = os.path.normpath(os.path.join(inst_path, inst_name))
+
+        header_map[src_path] = target_path
+
+        t = bld.SAMBA_GENERATOR('HEADER_%s/%s/%s' % (relpath2, inst_path, inst_name),
+                                group='headers',
+                                rule=create_public_header,
+                                source=h_name,
+                                target=target)
+        t.env.RELPATH = relpath2
+        t.env.TOPDIR  = bld.srcnode.abspath()
+        if not bld.env.public_headers_list:
+            bld.env.public_headers_list = []
+        bld.env.public_headers_list.append(os.path.join(inst_path, inst_name))
+        if public_headers_install:
+            bld.INSTALL_FILES('${INCLUDEDIR}',
+                              target,
+                              destname=os.path.join(inst_path, inst_name), flat=True)
+Build.BuildContext.PUBLIC_HEADERS = PUBLIC_HEADERS
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index 54ceba9..3adf533 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -308,7 +308,12 @@ def recursive_dirlist(dir, relbase, pattern=None):
 
 def mkdir_p(dir):
     '''like mkdir -p'''
-    if not dir or os.path.isdir(dir):
+    if not dir:
+        return
+    if dir.endswith("/"):
+        mkdir_p(dir[:-1])
+        return
+    if os.path.isdir(dir):
         return
     mkdir_p(os.path.dirname(dir))
     os.mkdir(dir)
@@ -468,6 +473,8 @@ def CHECK_MAKEFLAGS(bld):
     if not 'WAF_MAKE' in os.environ:
         return
     makeflags = os.environ.get('MAKEFLAGS')
+    if makeflags is None:
+        return
     jobs_set = False
     # we need to use shlex.split to cope with the escaping of spaces
     # in makeflags
diff --git a/buildtools/wafsamba/stale_files.py b/buildtools/wafsamba/stale_files.py
index dd4270d..2b94f08 100644
--- a/buildtools/wafsamba/stale_files.py
+++ b/buildtools/wafsamba/stale_files.py
@@ -73,7 +73,9 @@ def replace_refill_task_list(self):
         for f in files:
             p = root + '/' + f
             if os.path.islink(p):
-                p = os.readlink(p)
+                link = os.readlink(p)
+                if link[0:bin_base_len] == bin_base:
+                    p = link
             if f in ['config.h']:
                 continue
             if f[-2:] not in [ '.c', '.h' ]:
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index ebe8fba..2a1c82a 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -21,6 +21,7 @@ from samba_bundled import *
 import samba_install
 import samba_conftests
 import samba_abi
+import samba_headers
 import tru64cc
 import irixcc
 import hpuxcc
@@ -97,6 +98,7 @@ def SAMBA_LIBRARY(bld, libname, source,
                   public_deps='',
                   includes='',
                   public_headers=None,
+                  public_headers_install=True,
                   header_path=None,
                   pc_files=None,
                   vnum=None,
@@ -109,6 +111,7 @@ def SAMBA_LIBRARY(bld, libname, source,
                   group='libraries',
                   depends_on='',
                   local_include=True,
+                  global_include=True,
                   vars=None,
                   subdir=None,
                   install_path=None,
@@ -160,6 +163,7 @@ def SAMBA_LIBRARY(bld, libname, source,
                         public_deps    = public_deps,
                         includes       = includes,
                         public_headers = public_headers,
+                        public_headers_install = public_headers_install,
                         header_path    = header_path,
                         cflags         = cflags,
                         group          = subsystem_group,
@@ -167,7 +171,8 @@ def SAMBA_LIBRARY(bld, libname, source,
                         depends_on     = depends_on,
                         hide_symbols   = hide_symbols,
                         pyext          = pyext or (target_type == "PYTHON"),
-                        local_include  = local_include)
+                        local_include  = local_include,
+                        global_include = global_include)
 
     if BUILTIN_LIBRARY(bld, libname):
         return
@@ -242,6 +247,7 @@ def SAMBA_LIBRARY(bld, libname, source,
         samba_includes  = includes,
         version_script  = vscript,
         local_include   = local_include,
+        global_include  = global_include,
         vnum            = vnum,
         soname          = soname,
         install_path    = None,
@@ -288,6 +294,7 @@ def SAMBA_BINARY(bld, binname, source,
                  group='binaries',
                  manpages=None,
                  local_include=True,
+                 global_include=True,
                  subsystem_name=None,
                  pyembed=False,
                  vars=None,
@@ -332,6 +339,7 @@ def SAMBA_BINARY(bld, binname, source,
                         autoproto      = autoproto,
                         subsystem_name = subsystem_name,
                         local_include  = local_include,
+                        global_include = global_include,
                         use_hostcc     = use_hostcc,
                         pyext          = pyembed,
                         use_global_deps= use_global_deps)
@@ -349,6 +357,7 @@ def SAMBA_BINARY(bld, binname, source,
         samba_deps     = deps,
         samba_includes = includes,
         local_include  = local_include,
+        global_include = global_include,
         samba_modules  = modules,
         top            = True,
         samba_subsystem= subsystem_name,
@@ -376,6 +385,7 @@ def SAMBA_MODULE(bld, modname, source,
                  cflags='',
                  internal_module=True,
                  local_include=True,
+                 global_include=True,
                  vars=None,
                  subdir=None,
                  enabled=True,
@@ -396,6 +406,7 @@ def SAMBA_MODULE(bld, modname, source,
                     autoproto_extra_source=autoproto_extra_source,
                     cflags=cflags,
                     local_include=local_include,
+                    global_include=global_include,
                     enabled=enabled)
 
         bld.ADD_INIT_FUNCTION(subsystem, modname, init_function)
@@ -432,6 +443,7 @@ def SAMBA_MODULE(bld, modname, source,
                       realname = realname,
                       autoproto = autoproto,
                       local_include=local_include,
+                      global_include=global_include,
                       vars=vars,
                       link_name=build_link_name,
                       install_path="${MODULESDIR}/%s" % subsystem,
@@ -449,6 +461,7 @@ def SAMBA_SUBSYSTEM(bld, modname, source,
                     public_deps='',
                     includes='',
                     public_headers=None,
+                    public_headers_install=True,
                     header_path=None,
                     cflags='',
                     cflags_end=None,
@@ -459,6 +472,7 @@ def SAMBA_SUBSYSTEM(bld, modname, source,
                     depends_on='',
                     local_include=True,
                     local_include_first=True,
+                    global_include=True,
                     subsystem_name=None,
                     enabled=True,
                     use_hostcc=False,
@@ -504,6 +518,7 @@ def SAMBA_SUBSYSTEM(bld, modname, source,
         samba_includes = includes,
         local_include  = local_include,
         local_include_first  = local_include_first,
+        global_include = global_include,
         samba_subsystem= subsystem_name,
         samba_use_hostcc = use_hostcc,
         samba_use_global_deps = use_global_deps
@@ -515,7 +530,8 @@ def SAMBA_SUBSYSTEM(bld, modname, source,
     if autoproto is not None:
         bld.SAMBA_AUTOPROTO(autoproto, source + TO_LIST(autoproto_extra_source))
     if public_headers is not None:
-        bld.PUBLIC_HEADERS(public_headers, header_path=header_path)
+        bld.PUBLIC_HEADERS(public_headers, header_path=header_path,
+                           public_headers_install=public_headers_install)
     return t
 
 
@@ -525,6 +541,7 @@ Build.BuildContext.SAMBA_SUBSYSTEM = SAMBA_SUBSYSTEM
 def SAMBA_GENERATOR(bld, name, rule, source='', target='',
                     group='generators', enabled=True,
                     public_headers=None,
+                    public_headers_install=True,
                     header_path=None,
                     vars=None,
                     always=False):
@@ -553,7 +570,8 @@ def SAMBA_GENERATOR(bld, name, rule, source='', target='',
         t.always = True
 
     if public_headers is not None:
-        bld.PUBLIC_HEADERS(public_headers, header_path=header_path)
+        bld.PUBLIC_HEADERS(public_headers, header_path=header_path,
+                           public_headers_install=public_headers_install)
     return t
 Build.BuildContext.SAMBA_GENERATOR = SAMBA_GENERATOR
 
@@ -575,6 +593,7 @@ def SETUP_BUILD_GROUPS(bld):
     bld.add_group('build_compilers')
     bld.add_group('build_source')
     bld.add_group('prototypes')
+    bld.add_group('headers')
     bld.add_group('main')
     bld.add_group('symbolcheck')
     bld.add_group('libraries')
@@ -726,161 +745,6 @@ def INSTALL_DIRS(bld, destdir, dirs):
 Build.BuildContext.INSTALL_DIRS = INSTALL_DIRS
 
 
-re_header = re.compile('#include[ \t]*"([^"]+)"', re.I | re.M)
-class header_task(Task.Task):
-    """
-    The public headers (the one installed on the system) have both
-    different paths and contents, so the rename is not enough.
-
-    Intermediate .inst.h files are created because path manipulation
-    may be slow. The substitution is thus performed only once.
-    """
-
-    name = 'header'
-    color = 'PINK'
-    vars = ['INCLUDEDIR', 'HEADER_DEPS']
-
-    def run(self):
-        txt = self.inputs[0].read(self.env)
-
-        # hard-coded string, but only present in samba4 (I promise, you won't feel a thing)
-        txt = txt.replace('#if _SAMBA_BUILD_ == 4', '#if 1\n')
-
-        # use a regexp to substitute the #include lines in the files
-        map = self.generator.bld.hnodemap
-        dirnodes = self.generator.bld.hnodedirs
-        def repl(m):
-            if m.group(1):
-                s = m.group(1)
-
-                # pokemon headers: gotta catch'em all!
-                fin = s
-                if s.startswith('bin/default'):
-                    node = self.generator.bld.srcnode.find_resource(s.replace('bin/default/', ''))
-                    if not node:
-                        Logs.warn('could not find the public header for %r' % s)
-                    elif node.id in map:
-                        fin = map[node.id]
-                    else:
-                        Logs.warn('could not find the public header replacement for build header %r' % s)
-                else:
-                    # this part is more difficult since the path may be relative to anything
-                    for dirnode in dirnodes:
-                        node = dirnode.find_resource(s)
-                        if node:
-                             if node.id in map:
-                                 fin = map[node.id]
-                                 break
-                             else:
-                                 Logs.warn('could not find the public header replacement for source header %r %r' % (s, node))
-                    else:
-                        Logs.warn('-> could not find the public header for %r' % s)
-
-                return "#include <%s>" % fin
-            return ''
-
-        txt = re_header.sub(repl, txt)
-
-        # and write the output file
-        f = None
-        try:
-            f = open(self.outputs[0].abspath(self.env), 'w')
-            f.write(txt)
-        finally:
-            if f:
-                f.close()
-
- at TaskGen.feature('pubh')
-def make_public_headers(self):
-    """
-    collect the public headers to process and to install, then
-    create the substitutions (name and contents)
-    """
-
-    if not self.bld.is_install:
-        # install time only (lazy)
-        return
-
-    # keep two variables
-    #    hnodedirs: list of folders for searching the headers
-    #    hnodemap: node ids and replacement string (node objects are unique)
-    try:
-        self.bld.hnodedirs.append(self.path)
-    except AttributeError:
-        self.bld.hnodemap = {}
-        self.bld.hnodedirs = [self.bld.srcnode, self.path]


-- 
Samba Shared Repository


More information about the samba-cvs mailing list