]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
wafsamba: Adjust 'match' logic to override paths in config.check()
authorNoel Power <noel.power@suse.com>
Thu, 8 May 2025 18:16:07 +0000 (19:16 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 16 May 2025 10:31:31 +0000 (10:31 +0000)
messages that match various parts of the configure check progress e.g.
 'Checking for library iconv'
 'Checking for iconv_open'
 'Checking for header iconv.h'

are intercepted and the some path(s) modified with the associated option
value

    o buildtools/wafsamba/samba_conftests.py: Add arg_list variable
       arg_list contains the argument object returned from
       'argparser.ArgumentParser.add_argument' which is called
       with the content of the 'match' keyword passed to 'add_option'
       stripped out. The content of the 'match' keyword is saved as
       an attribute to the arg object appended to arg_list.
    o buildtools/wafsamba/samba_waf18.py:
       search arg_list (see above) that match and 'msg' argument passed
       to arg_list (allowing the dest variable associated with the argument
       to be accessed and added to some 'path' used during the 'check' phase

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri May 16 10:31:31 UTC 2025 on atb-devel-224

buildtools/wafsamba/samba_conftests.py
buildtools/wafsamba/samba_waf18.py

index 38ce20d968f0b35857cce1a80ea25d57dcc90253..0bae1df536bb1700dac3ae64c137f8978d077f87 100644 (file)
@@ -6,6 +6,7 @@ from waflib import Build, Configure, Utils, Options, Logs, Errors
 from waflib.Configure import conf
 from samba_utils import TO_LIST, ADD_LD_LIBRARY_PATH, get_string
 
+Options.OptionsContext.arg_list = []
 
 def add_option(self, *k, **kw):
     '''syntax help: provide the "match" attribute to opt.add_option() so that folders can be added to specific config tests'''
@@ -13,8 +14,9 @@ def add_option(self, *k, **kw):
     match = kw.get('match', [])
     if match:
         del kw['match']
-    opt = self.parser.add_option(*k, **kw)
+    opt = self.parser.add_argument(*k, **kw)
     opt.match = match
+    Options.OptionsContext.arg_list.append(opt)
     return opt
 Options.OptionsContext.add_option = add_option
 
index 54444b3ab68f00921a6640d3944c2df2c9faa90e..af31248d360140b14a7129822a7c3b4fd41f030b 100644 (file)
@@ -155,7 +155,7 @@ def check(self, *k, **kw):
     additional_dirs = []
     if 'msg' in kw:
         msg = kw['msg']
-        for x in Options.OptionsContext.parser.parser.option_list:
+        for x in Options.OptionsContext.arg_list:
              if getattr(x, 'match', None) and msg in x.match:
                  d = getattr(Options.options, x.dest, '')
                  if d: