Skip to content

Commit

Permalink
waf: upgrade to 2.0.18
Browse files Browse the repository at this point in the history
This is required to get the new test_args parameter to conf.check, which
facilitates passing arguments to configuration test programs.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13846

Signed-off-by: Uri Simchoni <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
  • Loading branch information
urisimchoni committed Oct 20, 2019
1 parent 0afd655 commit 09e282e
Show file tree
Hide file tree
Showing 19 changed files with 329 additions and 50 deletions.
2 changes: 1 addition & 1 deletion buildtools/bin/waf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.

import os, sys, inspect

VERSION="2.0.17"
VERSION="2.0.18"
REVISION="x"
GIT="x"
INSTALL="x"
Expand Down
2 changes: 1 addition & 1 deletion buildtools/wafsamba/wafsamba.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

os.environ['PYTHONUNBUFFERED'] = '1'

if Context.HEXVERSION not in (0x2001100,):
if Context.HEXVERSION not in (0x2001200,):
Logs.error('''
Please use the version of waf that comes with Samba, not
a system installed version. See http://wiki.samba.org/index.php/Waf
Expand Down
20 changes: 15 additions & 5 deletions third_party/waf/waflib/Configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ def run_build(self, *k, **kw):
Though this function returns *0* by default, the build may set an attribute named *retval* on the
build context object to return a particular value. See :py:func:`waflib.Tools.c_config.test_exec_fun` for example.
This function also provides a limited cache. To use it, provide the following option::
This function also features a cache which can be enabled by the following option::
def options(opt):
opt.add_option('--confcache', dest='confcache', default=0,
Expand All @@ -535,10 +535,21 @@ def options(opt):
$ waf configure --confcache
"""
lst = [str(v) for (p, v) in kw.items() if p != 'env']
h = Utils.h_list(lst)
buf = []
for key in sorted(kw.keys()):
v = kw[key]
if hasattr(v, '__call__'):
buf.append(Utils.h_fun(v))
else:
buf.append(str(v))
h = Utils.h_list(buf)
dir = self.bldnode.abspath() + os.sep + (not Utils.is_win32 and '.' or '') + 'conf_check_' + Utils.to_hex(h)

cachemode = kw.get('confcache', getattr(Options.options, 'confcache', None))

if not cachemode and os.path.exists(dir):
shutil.rmtree(dir)

try:
os.makedirs(dir)
except OSError:
Expand All @@ -549,7 +560,6 @@ def options(opt):
except OSError:
self.fatal('cannot use the configuration test folder %r' % dir)

cachemode = getattr(Options.options, 'confcache', None)
if cachemode == 1:
try:
proj = ConfigSet.ConfigSet(os.path.join(dir, 'cache_run_build'))
Expand Down Expand Up @@ -589,7 +599,7 @@ def options(opt):
else:
ret = getattr(bld, 'retval', 0)
finally:
if cachemode == 1:
if cachemode:
# cache the results each time
proj = ConfigSet.ConfigSet()
proj['cache_run_build'] = ret
Expand Down
6 changes: 3 additions & 3 deletions third_party/waf/waflib/Context.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
import waflib.Node

# the following 3 constants are updated on each new release (do not touch)
HEXVERSION=0x2001100
HEXVERSION=0x2001200
"""Constant updated on new releases"""

WAFVERSION="2.0.17"
WAFVERSION="2.0.18"
"""Constant updated on new releases"""

WAFREVISION="6bc6cb599c702e985780e9f705b291b812123693"
WAFREVISION="314689b8994259a84f0de0aaef74d7ce91f541ad"
"""Git revision when the waf version is updated"""

ABI = 20
Expand Down
7 changes: 6 additions & 1 deletion third_party/waf/waflib/Scripting.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,12 @@ def remove_and_log(k, fun):
else:
remove_and_log(env.out_dir, shutil.rmtree)

for k in (env.out_dir, env.top_dir, env.run_dir):
env_dirs = [env.out_dir]
if not ctx.options.no_lock_in_top:
env_dirs.append(env.top_dir)
if not ctx.options.no_lock_in_run:
env_dirs.append(env.run_dir)
for k in env_dirs:
p = os.path.join(k, Options.lockfile)
remove_and_log(p, os.remove)

Expand Down
2 changes: 1 addition & 1 deletion third_party/waf/waflib/TaskGen.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ def build(bld):
# paranoid safety measure for the general case foo.in->foo.h with ambiguous dependencies
for xt in HEADER_EXTS:
if b.name.endswith(xt):
tsk.ext_in = tsk.ext_in + ['.h']
tsk.ext_out = tsk.ext_out + ['.h']
break

inst_to = getattr(self, 'install_path', None)
Expand Down
37 changes: 36 additions & 1 deletion third_party/waf/waflib/Tools/asm.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,22 @@ def build(bld):
target = 'asmtest')
"""

from waflib import Task
import re
from waflib import Errors, Logs, Task
from waflib.Tools.ccroot import link_task, stlink_task
from waflib.TaskGen import extension
from waflib.Tools import c_preproc

re_lines = re.compile(
'^[ \t]*(?:%)[ \t]*(ifdef|ifndef|if|else|elif|endif|include|import|define|undef)[ \t]*(.*)\r*$',
re.IGNORECASE | re.MULTILINE)

class asm_parser(c_preproc.c_parser):
def filter_comments(self, node):
code = node.read()
code = c_preproc.re_nl.sub('', code)
code = c_preproc.re_cpp.sub(c_preproc.repl, code)
return re_lines.findall(code)

class asm(Task.Task):
"""
Expand All @@ -45,6 +58,28 @@ class asm(Task.Task):
color = 'BLUE'
run_str = '${AS} ${ASFLAGS} ${ASMPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${AS_SRC_F}${SRC} ${AS_TGT_F}${TGT}'

def scan(self):
if self.env.ASM_NAME == 'gas':
return c_preproc.scan(self)
Logs.warn('There is no dependency scanner for Nasm!')
return [[], []]
elif self.env.ASM_NAME == 'nasm':
Logs.warn('The Nasm dependency scanner is incomplete!')

try:
incn = self.generator.includes_nodes
except AttributeError:
raise Errors.WafError('%r is missing the "asm" feature' % self.generator)

if c_preproc.go_absolute:
nodepaths = incn
else:
nodepaths = [x for x in incn if x.is_child_of(x.ctx.srcnode) or x.is_child_of(x.ctx.bldnode)]

tmp = asm_parser(nodepaths)
tmp.start(self.inputs[0], self.env)
return (tmp.nodes, tmp.names)

@extension('.s', '.S', '.asm', '.ASM', '.spp', '.SPP')
def asm_hook(self, node):
"""
Expand Down
6 changes: 4 additions & 2 deletions third_party/waf/waflib/Tools/c_aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ def sniff_features(**kw):
if x in exts:
feats.append('cxx')
break

if 'c' in exts or 'vala' in exts or 'gs' in exts:
feats.append('c')

if 's' in exts or 'S' in exts:
feats.append('asm')

for x in 'f f90 F F90 for FOR'.split():
if x in exts:
feats.append('fc')
Expand All @@ -66,7 +68,7 @@ def sniff_features(**kw):
if typ in ('program', 'shlib', 'stlib'):
will_link = False
for x in feats:
if x in ('cxx', 'd', 'fc', 'c'):
if x in ('cxx', 'd', 'fc', 'c', 'asm'):
feats.append(x + typ)
will_link = True
if not will_link and not kw.get('features', []):
Expand Down
9 changes: 5 additions & 4 deletions third_party/waf/waflib/Tools/c_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,20 +659,21 @@ class test_exec(Task.Task):
"""
color = 'PINK'
def run(self):
cmd = [self.inputs[0].abspath()] + getattr(self.generator, 'test_args', [])
if getattr(self.generator, 'rpath', None):
if getattr(self.generator, 'define_ret', False):
self.generator.bld.retval = self.generator.bld.cmd_and_log([self.inputs[0].abspath()])
self.generator.bld.retval = self.generator.bld.cmd_and_log(cmd)
else:
self.generator.bld.retval = self.generator.bld.exec_command([self.inputs[0].abspath()])
self.generator.bld.retval = self.generator.bld.exec_command(cmd)
else:
env = self.env.env or {}
env.update(dict(os.environ))
for var in ('LD_LIBRARY_PATH', 'DYLD_LIBRARY_PATH', 'PATH'):
env[var] = self.inputs[0].parent.abspath() + os.path.pathsep + env.get(var, '')
if getattr(self.generator, 'define_ret', False):
self.generator.bld.retval = self.generator.bld.cmd_and_log([self.inputs[0].abspath()], env=env)
self.generator.bld.retval = self.generator.bld.cmd_and_log(cmd, env=env)
else:
self.generator.bld.retval = self.generator.bld.exec_command([self.inputs[0].abspath()], env=env)
self.generator.bld.retval = self.generator.bld.exec_command(cmd, env=env)

@feature('test_exec')
@after_method('apply_link')
Expand Down
3 changes: 2 additions & 1 deletion third_party/waf/waflib/Tools/c_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def check_endianness(self):
def check_msg(self):
return tmp[0]
self.check(fragment=ENDIAN_FRAGMENT, features='c grep_for_endianness',
msg='Checking for endianness', define='ENDIANNESS', tmp=tmp, okmsg=check_msg)
msg='Checking for endianness', define='ENDIANNESS', tmp=tmp,
okmsg=check_msg, confcache=None)
return tmp[0]

1 change: 1 addition & 0 deletions third_party/waf/waflib/Tools/gas.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ def configure(conf):
conf.env.ASLNK_TGT_F = ['-o']
conf.find_ar()
conf.load('asm')
conf.env.ASM_NAME = 'gas'
2 changes: 1 addition & 1 deletion third_party/waf/waflib/Tools/javaw.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def use_javac_files(self):
self.javac_task.dep_nodes.extend(tg.jar_task.outputs)
else:
if hasattr(tg, 'outdir'):
base_node = tg.outdir.abspath()
base_node = tg.outdir
else:
base_node = tg.path.get_bld()

Expand Down
5 changes: 5 additions & 0 deletions third_party/waf/waflib/Tools/nasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ def configure(conf):
conf.env.ASLNK_TGT_F = ['-o']
conf.load('asm')
conf.env.ASMPATH_ST = '-I%s' + os.sep
txt = conf.cmd_and_log(conf.env.AS + ['--version'])
if 'yasm' in txt.lower():
conf.env.ASM_NAME = 'yasm'
else:
conf.env.ASM_NAME = 'nasm'
27 changes: 17 additions & 10 deletions third_party/waf/waflib/Tools/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,19 @@ def process_py(self, node):
"""
Add signature of .py file, so it will be byte-compiled when necessary
"""
assert(hasattr(self, 'install_path')), 'add features="py"'
assert(hasattr(self, 'install_path')), 'add features="py" for target "%s" in "%s/wscript".' % (self.target, self.path.nice_path())
self.install_from = getattr(self, 'install_from', None)
relative_trick = getattr(self, 'relative_trick', True)
if self.install_from:
assert isinstance(self.install_from, Node.Node), \
'add features="py" for target "%s" in "%s/wscript" (%s).' % (self.target, self.path.nice_path(), type(self.install_from))

# where to install the python file
if self.install_path:
if self.install_from:
self.add_install_files(install_to=self.install_path, install_from=node, cwd=self.install_from, relative_trick=True)
self.add_install_files(install_to=self.install_path, install_from=node, cwd=self.install_from, relative_trick=relative_trick)
else:
self.add_install_files(install_to=self.install_path, install_from=node, relative_trick=True)
self.add_install_files(install_to=self.install_path, install_from=node, relative_trick=relative_trick)

lst = []
if self.env.PYC:
Expand All @@ -96,9 +101,11 @@ def process_py(self, node):

if self.install_path:
if self.install_from:
pyd = Utils.subst_vars("%s/%s" % (self.install_path, node.path_from(self.install_from)), self.env)
target_dir = node.path_from(self.install_from) if relative_trick else node.name
pyd = Utils.subst_vars("%s/%s" % (self.install_path, target_dir), self.env)
else:
pyd = Utils.subst_vars("%s/%s" % (self.install_path, node.path_from(self.path)), self.env)
target_dir = node.path_from(self.path) if relative_trick else node.name
pyd = Utils.subst_vars("%s/%s" % (self.install_path, target_dir), self.env)
else:
pyd = node.abspath()

Expand All @@ -115,7 +122,7 @@ def process_py(self, node):
tsk.pyd = pyd

if self.install_path:
self.add_install_files(install_to=os.path.dirname(pyd), install_from=pyobj, cwd=node.parent.get_bld(), relative_trick=True)
self.add_install_files(install_to=os.path.dirname(pyd), install_from=pyobj, cwd=node.parent.get_bld(), relative_trick=relative_trick)

class pyc(Task.Task):
"""
Expand Down Expand Up @@ -433,11 +440,11 @@ def check_python_headers(conf, features='pyembed pyext'):

# Code using the Python API needs to be compiled with -fno-strict-aliasing
if env.CC_NAME == 'gcc':
env.append_value('CFLAGS_PYEMBED', ['-fno-strict-aliasing'])
env.append_value('CFLAGS_PYEXT', ['-fno-strict-aliasing'])
env.append_unique('CFLAGS_PYEMBED', ['-fno-strict-aliasing'])
env.append_unique('CFLAGS_PYEXT', ['-fno-strict-aliasing'])
if env.CXX_NAME == 'gcc':
env.append_value('CXXFLAGS_PYEMBED', ['-fno-strict-aliasing'])
env.append_value('CXXFLAGS_PYEXT', ['-fno-strict-aliasing'])
env.append_unique('CXXFLAGS_PYEMBED', ['-fno-strict-aliasing'])
env.append_unique('CXXFLAGS_PYEXT', ['-fno-strict-aliasing'])

if env.CC_NAME == "msvc":
from distutils.msvccompiler import MSVCCompiler
Expand Down
11 changes: 6 additions & 5 deletions third_party/waf/waflib/extras/doxygen.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ def runnable_status(self):
if not getattr(self, 'pars', None):
txt = self.inputs[0].read()
self.pars = parse_doxy(txt)

# Override with any parameters passed to the task generator
if getattr(self.generator, 'pars', None):
for k, v in self.generator.pars.items():
self.pars[k] = v

if self.pars.get('OUTPUT_DIRECTORY'):
# Use the path parsed from the Doxyfile as an absolute path
output_node = self.inputs[0].parent.get_bld().make_node(self.pars['OUTPUT_DIRECTORY'])
Expand All @@ -94,11 +100,6 @@ def runnable_status(self):
output_node.mkdir()
self.pars['OUTPUT_DIRECTORY'] = output_node.abspath()

# Override with any parameters passed to the task generator
if getattr(self.generator, 'pars', None):
for k, v in self.generator.pars.items():
self.pars[k] = v

self.doxy_inputs = getattr(self, 'doxy_inputs', [])
if not self.pars.get('INPUT'):
self.doxy_inputs.append(self.inputs[0].parent)
Expand Down
28 changes: 20 additions & 8 deletions third_party/waf/waflib/extras/fast_partial.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def options(opt):
opt.load('fast_partial')
Assumptions:
* Start with a clean build (run "waf distclean" after enabling)
* Mostly for C/C++/Fortran targets with link tasks (object-only targets are not handled)
try it in the folder generated by utils/genbench.py
* For full project builds: no --targets and no pruning from subfolders
Expand Down Expand Up @@ -131,12 +132,18 @@ def store(self):
data[x] = getattr(self, x)
db = os.path.join(self.variant_dir, Context.DBFILE + self.store_key)

try:
waflib.Node.pickle_lock.acquire()
with waflib.Node.pickle_lock:
waflib.Node.Nod3 = self.node_class
x = Build.cPickle.dumps(data, Build.PROTOCOL)
finally:
waflib.Node.pickle_lock.release()
try:
x = Build.cPickle.dumps(data, Build.PROTOCOL)
except Build.cPickle.PicklingError:
root = data['root']
for node_deps in data['node_deps'].values():
for idx, node in enumerate(node_deps):
# there may be more cross-context Node objects to fix,
# but this should be the main source
node_deps[idx] = root.find_node(node.abspath())
x = Build.cPickle.dumps(data, Build.PROTOCOL)

Logs.debug('rev_use: storing %s', db)
Utils.writef(db + '.tmp', x, m='wb')
Expand Down Expand Up @@ -393,12 +400,17 @@ def is_stale(self):
Logs.debug('rev_use: must post %r because this is a clean build')
return True

# 3. check if the configuration changed
if os.stat(self.bld.bldnode.find_node('c4che/build.config.py').abspath()).st_mtime > dbstat:
# 3.a check if the configuration exists
cache_node = self.bld.bldnode.find_node('c4che/build.config.py')
if not cache_node:
return True

# 3.b check if the configuration changed
if os.stat(cache_node.abspath()).st_mtime > dbstat:
Logs.debug('rev_use: must post %r because the configuration has changed', self.name)
return True

# 3.a any tstamp data?
# 3.c any tstamp data?
try:
f_deps = self.bld.f_deps
except AttributeError:
Expand Down
Loading

0 comments on commit 09e282e

Please sign in to comment.