WAF 2.x broken a lot of configure checks

Alexander Bokovoy ab at samba.org
Wed Sep 5 13:41:46 UTC 2018


On ke, 05 syys 2018, Alexander Bokovoy via samba-technical wrote:
> On ke, 05 syys 2018, Stefan Metzmacher via samba-technical wrote:
> > Hi,
> > 
> > I just found that the values in
> > bin/c4che/default.cache.py differ between
> > the old and new versions of waf.
> > 
> > The old one had = () for undefined values
> > the new one has = 0 for undefined values
> > 
> > This is related to change to define/undefine/define_cond in
> > third_party/waf/wafadmin/Tools/config_c.py
> > vs.
> > third_party/waf/waflib/Tools/c_config.py
> > 
> > And we now have buildtools/wafsamba/samba_waf18.py,
> > which also provides define() and undefine().
> > 
> > I found that by building on FreeBSD 11 with gcc.
> > 
> > The check for HAVE_WORKING_STRPTIME was broken
> > as CONFIG_SET() returned True if HAVE_WORKING_STRPTIME is 0,
> > while it returned False when it was ().
> > 
> > Adding this to CONFIG_SET fixed it:
> > if v == 0:
> >     return False
> > 
> > But I'm wondering about what else might be affected.
> > 
> > Should we better try to get '= ()' again in
> > bin/c4che/default.cache.py?
> > 
> > On my Linux box I had this before:
> > 
> > less bin/c4che/default.cache.py | grep '= 0'
> > HAVE_DECL_KRB5_AUTH_CON_SET_REQ_CKSUMTYPE = 0
> > HAVE_DECL_KRB5_GET_CREDENTIALS_FOR_USER = 0
> > 
> > and now I have this:
> > 
> > less bin/c4che/default_cache.py | grep '= 0'
> > HAVE_BSD_STRTOLL = 0
> > HAVE_DECL_KRB5_AUTH_CON_SET_REQ_CKSUMTYPE = 0
> > HAVE_DECL_KRB5_GET_CREDENTIALS_FOR_USER = 0
> > HAVE_INCOHERENT_MMAP = 0
> > 
> > Any idea?
> I think it comes from work which started with 
> 850e9ad5fcdd3d0216298c4d2a990df27b196ef0 in waf git repo:
> $ git tag --contains 850e9ad5fcdd3d0216298c4d2a990df27b196ef0 | head -2
> rm
> waf-1.9.0
> 
> This could explain why it wasn't before as we were on 1.8.
In buildtools/wafsamba/samba_waf18.py, we use following:

@conf
def define(self, key, val, quote=True, comment=None):
   ...
   if val is True:
           val = 1
   elif val in (False, None):
           val = 0

   # waf 1.5
   self.env[key] = val


So if val is None, we get val to 0. May be changing it here to () would
be enough? Patch attached (untested)

The undefine() part actually does the same for undefined keys.

-- 
/ Alexander Bokovoy
-------------- next part --------------
>From 2e49b2673088f21f5c51866749c048727864b9a4 Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <ab at samba.org>
Date: Wed, 5 Sep 2018 16:40:21 +0300
Subject: [PATCH] When defining None values for waf, use () instead 0

Signed-off-by: Alexander Bokovoy <ab at samba.org>
---
 buildtools/wafsamba/samba_waf18.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/buildtools/wafsamba/samba_waf18.py b/buildtools/wafsamba/samba_waf18.py
index ff20bc20885..282755c1fa6 100644
--- a/buildtools/wafsamba/samba_waf18.py
+++ b/buildtools/wafsamba/samba_waf18.py
@@ -69,10 +69,10 @@ def apply_incpaths(self):
 def define(self, key, val, quote=True, comment=None):
    assert key and isinstance(key, str)
 
-   if val is True:
-           val = 1
-   elif val in (False, None):
-           val = 0
+   if val is None:
+       val = ()
+   elif isinstance(val, bool):
+       val = int(val)
 
    # waf 1.5
    self.env[key] = val
-- 
2.17.1



More information about the samba-technical mailing list