]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3734] Switch tools/find-uninstalled-headers.py to Meson
authorAndrei Pavel <andrei@isc.org>
Wed, 7 May 2025 04:44:08 +0000 (07:44 +0300)
committerAndrei Pavel <andrei@isc.org>
Fri, 30 May 2025 07:57:39 +0000 (10:57 +0300)
doc/devel/config-backend.dox
src/share/api/README
src/share/yang/modules/utils/bump-up-revisions.sh
tools/find-uninstalled-headers.py

index 293470f381f361de8c4e4734bf1ff1f86d34d1cf..78fa3042f0d784696ddfac67b4a7e03bb94bf9f9 100644 (file)
@@ -35,7 +35,7 @@ Kea in embedded regime.
 Optionally you can also:
 
 -# Implement unit tests for your backend in the src/bin/dhcp4/tests directory.
--# Modify src/bin/dhcp4/tests/Makefile.am to include the file(s) containing the
+-# Modify src/bin/dhcp4/tests/meson.build to include the file(s) containing the
    unit tests.
 
 @section configBackendJSONDesign The JSON Configuration Backend
index fa659f6f2dff3f39671e443fc3bfefd0cd093eff..0cf062ba0b4853b88bfd075400b8e331884d2109 100644 (file)
@@ -13,15 +13,10 @@ There are several steps needed to document new API command:
    (resp-syntax) or any comment about response (resp-comment), simply
    remove those unused keys. The generator will attempt to generate
    boilerplates for it.
-3. Update api_files.mk. You can also run: ./generate-api-files > api_files.mk
-   or check the update by: ./generate-api-files | diff - api_files.mk
-4. Rebuild User's Guide as usual, run in doc/sphinx folder: make
+3. Rebuild User's Guide as usual, run "meson compile doc -C build".
 
 Files in this directory:
  - README: this file
  - _template.json: template used by generate-templates
- - api-files.mk: list of command files for inclusion in Makefiles
-   (can be build by ./generate-api-files)
  - generate-templates: script generating new command files from the
   the template (_template.json)
- - generate-api-files: script generating api-files.mk
index 5057059e28df502eed48c5318fa56e12a5313e51..f84c08c0e04acc12551ea8e1c75456d45e091228 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright (C) 2023-2024 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2023-2025 Internet Systems Consortium, Inc. ("ISC")
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
index e1f42e55988f31eac01fa2abef36644c04d044b1..0a4ad164ad51583dfdfce2036912c00bc94c5abf 100755 (executable)
@@ -2,7 +2,7 @@
 
 """
 This script checks that all source headers are installed by inspecting
-Makefile.am files.
+meson.build files.
 
 Usage: ./tools/find-uninstalled-headers.py
 """
@@ -18,49 +18,53 @@ EXCLUDE_LIST = [
 
 
 def main():
-    makefile_ams = sorted(pathlib.Path('./src/lib').glob('**/Makefile.am'))
+    meson_builds = sorted(pathlib.Path('./src/lib').glob('**/meson.build'))
     headers = sorted(pathlib.Path('./src/lib').glob('**/*.h'))
-
-    headers_pattern = re.compile(r'_HEADERS [+]?= (.*\.h|)(.*)')
-    backslash_pattern = re.compile(r'(.*\.h) \\$')
-
+    headers_pattern = re.compile(r'kea_.*_headers = \[([^]]*)(\]?)$')
     failure = False
-
-    for makefile_am in makefile_ams:
-        with open(makefile_am, 'r', encoding='utf-8') as f:
+    for meson_build in meson_builds:
+        with open(meson_build, 'r', encoding='utf-8') as f:
             lines = f.readlines()
             in_headers_block = False
             for line in lines:
-
-                if len(line) == 0:
+                line = line.strip()
+                if line == ']':
                     in_headers_block = False
+                    continue
 
-                header = None
-
-                backslash_matches = backslash_pattern.search(line)
                 headers_matches = headers_pattern.search(line)
                 if headers_matches is None:
-                    if not in_headers_block:
-                        continue
-
-                    if backslash_matches is None:
-                        header = line
+                    # Entries on multiple lines.
+                    if in_headers_block:
+                        header = line.strip().strip(',').strip("'").strip()
+                        if header == '':
+                            continue
+                        relative_path = meson_build.parent / header
+                        if relative_path not in headers:
+                            print(f'ERROR: Header {relative_path} not installed.')
+                            failure = True
+                            continue
+                        headers.remove(relative_path)
+                else:
+                    # Entries on a single line.
+                    header_line = headers_matches.group(1)
+                    for header in header_line.split(','):
+                        header = header.strip().strip("'")
+                        if header == '':
+                            # TODO: Why does this happen?
+                            continue
+                        relative_path = meson_build.parent / header.strip()
+                        if relative_path not in headers:
+                            print(f'ERROR: Header {relative_path} not installed.')
+                            failure = True
+                            continue
+                        headers.remove(relative_path)
+
+                    end_square_bracket = headers_matches.group(2)
+                    if end_square_bracket == ']':
                         in_headers_block = False
                     else:
-                        header = backslash_matches.group(1)
-                else:
-                    in_headers_block = True
-                    candidate = headers_matches.group(1)
-                    if backslash_matches is None and len(candidate):
-                        header = candidate
-
-                if header is not None:
-                    relative_path = makefile_am.parent / header.strip()
-                    if relative_path not in headers:
-                        print(f'ERROR: Header {relative_path} not in Makefile.am')
-                        failure = True
-                        continue
-                    headers.remove(relative_path)
+                        in_headers_block = True
 
     first = True
     for header in headers:
@@ -69,8 +73,8 @@ def main():
         if any(i in header.parts for i in ['tests', 'testutils', 'unittests']):
             continue
         if first:
-            print('The following headers are not in the _HEADERS section of '
-                  'their respective Makefile.am file:')
+            print('The following headers are not mentioned in an install_headers call of '
+                  'their respective meson.build file:')
             first = False
         print(f'- {header}')
         failure = True