mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-22 01:49:48 +00:00
[#3734] Switch tools/find-uninstalled-headers.py to Meson
This commit is contained in:
parent
cd2e58b898
commit
cb5c467e72
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
# 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)
|
||||
|
||||
if backslash_matches is None:
|
||||
header = line
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user