mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-22 01:49:48 +00:00
[#3731] Unify all grabber.sh scripts in a single one
Two are too many, let alone four. Add env.sh and fix extended version.
This commit is contained in:
parent
395c3c3ede
commit
5d32aeb38b
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd "$1" || exit 1
|
||||
|
||||
find "$2" -type f -name "[a-z]*.$3" | sort -V
|
||||
|
@ -26,22 +26,16 @@ rst_arm_sources = [
|
||||
'kea-messages.rst',
|
||||
]
|
||||
|
||||
list = run_command('grabber.sh', current_source_dir, 'arm', 'rst', check: true)
|
||||
list = run_command(GRABBER, current_source_dir / 'arm', '*.rst', check: true)
|
||||
rst_arm_sources += list.stdout().strip().split('\n')
|
||||
|
||||
list = run_command(
|
||||
'grabber.sh',
|
||||
current_source_dir,
|
||||
'grammar',
|
||||
'rst',
|
||||
check: true,
|
||||
)
|
||||
list = run_command(GRABBER, current_source_dir / 'grammar', '*.rst', check: true)
|
||||
rst_arm_sources = list.stdout().strip().split('\n')
|
||||
|
||||
main_sources = rst_arm_sources + ['conf.py'] + static_sources
|
||||
|
||||
# mans
|
||||
list = run_command('grabber.sh', current_source_dir, 'man', 'rst', check: true)
|
||||
list = run_command(GRABBER, current_source_dir / 'man', '*.rst', check: true)
|
||||
rst_man_sources = list.stdout().strip().split('\n')
|
||||
|
||||
man8s = []
|
||||
@ -53,22 +47,22 @@ endforeach
|
||||
man_sources = rst_man_sources + ['conf.py']
|
||||
|
||||
api_dir = f'@TOP_SOURCE_DIR@/src/share/api'
|
||||
list = run_command('grabber.sh', '/', api_dir, 'json', check: true)
|
||||
list = run_command(GRABBER, api_dir, '*.json', check: true)
|
||||
api_files = list.stdout().strip().split('\n')
|
||||
|
||||
list = run_command('grabber.sh', '/', TOP_SOURCE_DIR, 'mes', check: true)
|
||||
list = run_command(GRABBER, TOP_SOURCE_DIR, '*.mes', check: true)
|
||||
mes_files = list.stdout().strip().split('\n')
|
||||
|
||||
list = run_command('grabber.sh', current_source_dir, 'uml', 'uml', check: true)
|
||||
list = run_command(GRABBER, current_source_dir / 'uml', '*.uml', check: true)
|
||||
umls = list.stdout().strip().split('\n')
|
||||
|
||||
list = run_command('grabber.sh', current_source_dir, 'uml', 'png', check: true)
|
||||
list = run_command(GRABBER, current_source_dir / 'uml', '*.png', check: true)
|
||||
pngs = list.stdout().strip().split('\n')
|
||||
|
||||
list = run_command('grabber.sh', current_source_dir, 'uml', 'svg', check: true)
|
||||
list = run_command(GRABBER, current_source_dir / 'uml', '*.svg', check: true)
|
||||
svgs = list.stdout().strip().split('\n')
|
||||
|
||||
list = run_command('grabber.sh', current_source_dir, 'uml', 'atxt', check: true)
|
||||
list = run_command(GRABBER, current_source_dir / 'uml', '*.atxt', check: true)
|
||||
txts = list.stdout().strip().split('\n')
|
||||
|
||||
doc_conf = configuration_data()
|
||||
|
144
meson.build
144
meson.build
@ -62,68 +62,42 @@ postgresql_opt = get_option('postgresql')
|
||||
FUZZ_OPT = get_option('fuzz')
|
||||
TESTS_OPT = get_option('tests')
|
||||
|
||||
SRCID_OPT = get_option('srcid')
|
||||
#### Programs
|
||||
|
||||
#### KEA_SRCID value
|
||||
# External programs used only in this file.
|
||||
cppcheck = find_program('cppcheck', required: false)
|
||||
cppcheck_htmlreport = find_program('cppcheck-htmlreport', required: false)
|
||||
git = find_program('git', required: false)
|
||||
valgrind = find_program('valgrind', required: false)
|
||||
|
||||
CD_AND_RUN = find_program(f'@TOP_SOURCE_DIR@/cd-and-run.sh')
|
||||
AWK = find_program('gawk', 'awk', required: false)
|
||||
BISON = find_program('bison', version: '>=3.3.0', required: false)
|
||||
DOXYGEN = find_program('doxygen', required: false)
|
||||
FLEX = find_program('flex', version: '>=2.6.4', required: false)
|
||||
INSTALL = find_program('install', required: true)
|
||||
PDFLATEX = find_program('pdflatex', required: false)
|
||||
PIP_COMPILE = find_program('pip-compile', required: false)
|
||||
PLANTUML = find_program('plantuml', required: false)
|
||||
PYTHON = find_program('python3', 'python', required: true)
|
||||
SPHINX = find_program('sphinx-build', 'sphinx-build-3', required: false)
|
||||
XMLLINT = find_program('xmllint', required: false)
|
||||
|
||||
# When set 'srcid' option should be the KEA_PKG_VERSION_IN_CONFIGURE and
|
||||
# KEA_PKG_TYPE_IN_CONFIGURE name pair with
|
||||
# for KEA_PKG_VERSION_IN_CONFIGURE date and timestamp of the package
|
||||
# e.g. "isc20230921141113"
|
||||
# KEA_PKG_TYPE_IN_CONFIGURE type of the package "rpm", "deb" or "apk"
|
||||
if SRCID_OPT != ''
|
||||
KEA_SRCID = SRCID_OPT
|
||||
else
|
||||
KEA_SRCID = 'tarball'
|
||||
git = disabler()
|
||||
if fs.is_dir('.git')
|
||||
git = find_program('git', required: false)
|
||||
endif
|
||||
if git.found()
|
||||
result = run_command(
|
||||
CD_AND_RUN,
|
||||
TOP_SOURCE_DIR,
|
||||
git.full_path(),
|
||||
'rev-parse',
|
||||
'HEAD',
|
||||
check: false,
|
||||
)
|
||||
if result.returncode() == 0
|
||||
KEA_SRCID = 'git ' + result.stdout().strip()
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
message(f'Set KEA_SRCID to "@KEA_SRCID@"')
|
||||
CD_AND_RUN = find_program(f'@TOP_SOURCE_DIR@/scripts/cd-and-run.sh')
|
||||
ENV = find_program(f'@TOP_SOURCE_DIR@/scripts/env.sh')
|
||||
GRABBER = find_program(f'@TOP_SOURCE_DIR@/scripts/grabber.sh')
|
||||
KEA_MSG_COMPILER = disabler()
|
||||
|
||||
#### Configuration Data
|
||||
|
||||
# 'HAVE_BOTAN_ASIO_STREAM_H': false,
|
||||
# 'HAVE_PGSQL_SSL': false,
|
||||
# 'USE_STATIC_LINK': false,
|
||||
conf_data = configuration_data(
|
||||
{
|
||||
'EXTENDED_VERSION': f'"@KEA_SRCID@"',
|
||||
# 'HAVE_AFL': false,
|
||||
# 'HAVE_BOTAN_ASIO_STREAM_H': false,
|
||||
# 'HAVE_CREATE_UNIFIED_DIFF': false,
|
||||
# 'HAVE_GSS_STR_TO_OID': false,
|
||||
# 'HAVE_MYSQL_GET_OPTION': false,
|
||||
# 'HAVE_OPTRESET': false,
|
||||
# 'HAVE_PGSQL_SSL': false,
|
||||
# 'HAVE_PGSQL_TCP_USER_TIMEOUT': false,
|
||||
# 'HAVE_SYS_FILIO_H': false,
|
||||
# 'HAVE_VALGRIND_HEADERS': false,
|
||||
# 'LIBC_MUSL': false,
|
||||
# 'PACKAGE': 'kea',
|
||||
# 'PACKAGE_BUGREPORT': 'kea-dev@lists.isc.org',
|
||||
'PACKAGE': 'kea',
|
||||
'PACKAGE_NAME': 'kea',
|
||||
# 'PACKAGE_STRING': f'kea "@PROJECT_VERSION@"',
|
||||
'PACKAGE_VERSION': PROJECT_VERSION,
|
||||
'PACKAGE_VERSION_TYPE': '"development"',
|
||||
# 'PREMIUM_EXTENDED_VERSION': '"no"',
|
||||
# 'USE_STATIC_LINK': false,
|
||||
'VERSION': f'"@PROJECT_VERSION@"',
|
||||
# 'WITH_HEIMDAL': false,
|
||||
},
|
||||
)
|
||||
|
||||
@ -157,27 +131,6 @@ else
|
||||
endif
|
||||
message(f'Detected system "@SYSTEM@".')
|
||||
|
||||
#### Programs
|
||||
|
||||
# External programs used only in this file.
|
||||
cppcheck = find_program('cppcheck', required: false)
|
||||
cppcheck_htmlreport = find_program('cppcheck-htmlreport', required: false)
|
||||
valgrind = find_program('valgrind', required: false)
|
||||
|
||||
AWK = find_program('gawk', 'awk', required: false)
|
||||
BISON = find_program('bison', version: '>=3.3.0', required: false)
|
||||
DOXYGEN = find_program('doxygen', required: false)
|
||||
FLEX = find_program('flex', version: '>=2.6.4', required: false)
|
||||
INSTALL = find_program('install', required: true)
|
||||
PDFLATEX = find_program('pdflatex', required: false)
|
||||
PIP_COMPILE = find_program('pip-compile', required: false)
|
||||
PLANTUML = find_program('plantuml', required: false)
|
||||
PYTHON = find_program('python3', 'python', required: true)
|
||||
SPHINX = find_program('sphinx-build', 'sphinx-build-3', required: false)
|
||||
XMLLINT = find_program('xmllint', required: false)
|
||||
|
||||
KEA_MSG_COMPILER = disabler()
|
||||
|
||||
#### Dependencies
|
||||
|
||||
boost_dep = dependency('boost', version: '>=1.66', modules: ['system'])
|
||||
@ -444,6 +397,7 @@ endif
|
||||
#### Other checks.
|
||||
|
||||
if POSTGRESQL_DEP.found()
|
||||
# TODO: change to proper check, not version check.
|
||||
version = POSTGRESQL_DEP.version()
|
||||
conf_data.set(
|
||||
'HAVE_PGSQL_TCP_USER_TIMEOUT',
|
||||
@ -471,6 +425,46 @@ if KRB5_DEP.found() and KRB5_DEP.get_variable('vendor') == 'Heimdal'
|
||||
conf_data.set('WITH_HEIMDAL', true)
|
||||
endif
|
||||
|
||||
# KEA_PKG_VERSION_IN_CONFIGURE: date and timestamp of the package e.g. "isc20230921141113"
|
||||
# KEA_PKG_TYPE_IN_CONFIGURE: type of the package "rpm", "deb" or "apk"
|
||||
kea_pkg_type_in_configure = run_command(
|
||||
ENV,
|
||||
'KEA_PKG_TYPE_IN_CONFIGURE',
|
||||
check: true,
|
||||
).stdout().strip()
|
||||
kea_pkg_version_in_configure = run_command(
|
||||
ENV,
|
||||
'KEA_PKG_VERSION_IN_CONFIGURE',
|
||||
check: true,
|
||||
).stdout().strip()
|
||||
if kea_pkg_type_in_configure != '' and kea_pkg_version_in_configure != ''
|
||||
extended_version = f'@kea_pkg_version_in_configure@ @kea_pkg_type_in_configure@'
|
||||
else
|
||||
if fs.is_dir('.git') and git.found()
|
||||
result = run_command(
|
||||
CD_AND_RUN,
|
||||
TOP_SOURCE_DIR,
|
||||
git,
|
||||
'rev-parse',
|
||||
'HEAD',
|
||||
check: false,
|
||||
)
|
||||
if result.returncode() == 0
|
||||
extended_version = 'git ' + result.stdout().strip()
|
||||
endif
|
||||
else
|
||||
extended_version = 'tarball'
|
||||
endif
|
||||
endif
|
||||
conf_data.set('EXTENDED_VERSION', f'"@PROJECT_VERSION@ (@extended_version@)"')
|
||||
|
||||
if PROJECT_VERSION.split('.')[1].to_int() % 2 == 0
|
||||
package_version_type = 'stable'
|
||||
else
|
||||
package_version_type = 'stable'
|
||||
endif
|
||||
conf_data.set('PACKAGE_VERSION_TYPE', f'"@package_version_type@"')
|
||||
|
||||
#### System-specific Compiler Flags
|
||||
|
||||
compile_args = []
|
||||
@ -493,7 +487,7 @@ endif
|
||||
premium = fs.is_dir('premium')
|
||||
if premium
|
||||
conf_data.set('PREMIUM', 'yes')
|
||||
conf_data.set('PREMIUM_EXTENDED_VERSION', f'"yes (@KEA_SRCID@)"')
|
||||
conf_data.set('PREMIUM_EXTENDED_VERSION', f'"yes (@extended_version@)"')
|
||||
else
|
||||
conf_data.set('PREMIUM', 'no')
|
||||
conf_data.set('PREMIUM_EXTENDED_VERSION', '"no"')
|
||||
@ -515,8 +509,8 @@ report_conf_data.merge_from(conf_data)
|
||||
report_conf_data.set('TOP_BUILD_DIR', TOP_BUILD_DIR)
|
||||
report_conf_data.set('PACKAGE_NAME', 'kea')
|
||||
report_conf_data.set('PACKAGE_VERSION', PROJECT_VERSION)
|
||||
report_conf_data.set('EXTENDED_VERSION', f'@PROJECT_VERSION@ (@KEA_SRCID@)')
|
||||
report_conf_data.set('PACKAGE_VERSION_TYPE', 'development')
|
||||
report_conf_data.set('PACKAGE_VERSION_TYPE', package_version_type)
|
||||
report_conf_data.set('EXTENDED_VERSION', f'@PROJECT_VERSION@ (@extended_version@)')
|
||||
report_conf_data.set('OS_TYPE', OS_TYPE)
|
||||
report_conf_data.set('PREFIX', PREFIX)
|
||||
report_conf_data.set('HOOKS_DIR', DEFAULT_HOOKS_PATH)
|
||||
|
@ -32,6 +32,3 @@ option(
|
||||
value: 'disabled',
|
||||
description: 'Support for tests.',
|
||||
)
|
||||
|
||||
# Set the Kea srcid (default is 'git <HEAD>' or 'tarball').
|
||||
option('srcid', type: 'string', value: '', description: 'Set the Kea srcid.')
|
||||
|
3
scripts/env.sh
Normal file
3
scripts/env.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
env | grep -E "^${1}=" | cut -d '=' -f 2
|
8
scripts/grabber.sh
Executable file
8
scripts/grabber.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
dir="${1}"
|
||||
pattern="${2}"
|
||||
|
||||
cd "${dir}" || exit 1
|
||||
|
||||
find . -mindepth 1 -maxdepth 1 -type f -name "${pattern}" -printf '%P\n' | sort -V
|
@ -2,5 +2,4 @@ SUBDIRS = share lib hooks bin
|
||||
|
||||
EXTRA_DIST = \
|
||||
cppcheck-suppress.lst \
|
||||
valgrind-suppressions \
|
||||
valgrind-suppressions.revisit
|
||||
valgrind.supp
|
||||
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
for i in [a-z]*.json
|
||||
do
|
||||
echo "$i"
|
||||
done
|
@ -1,4 +1,8 @@
|
||||
list = run_command('grabber.sh', check: true)
|
||||
list = run_command(
|
||||
GRABBER,
|
||||
TOP_SOURCE_DIR / 'src/share/api',
|
||||
'*.json',
|
||||
check: true,
|
||||
)
|
||||
api_files = list.stdout().strip().split('\n')
|
||||
install_dir = f'@DATADIR@/kea/api'
|
||||
install_data(api_files, install_dir: install_dir)
|
||||
install_data(api_files, install_dir: DATADIR / 'kea/api')
|
||||
|
@ -1,4 +1,4 @@
|
||||
install_dir = f'@DATADIR@/kea/scripts/mysql'
|
||||
install_dir = DATADIR / 'kea/scripts/mysql'
|
||||
configure_file(
|
||||
input: 'dhcpdb_create.mysql',
|
||||
output: 'dhcpdb_create.mysql',
|
||||
@ -67,7 +67,12 @@ upgrade_scripts = [
|
||||
'upgrade_027_to_028.sh',
|
||||
'upgrade_028_to_029.sh',
|
||||
]
|
||||
list = run_command('../utils/grabber.sh', check: true)
|
||||
list = run_command(
|
||||
GRABBER,
|
||||
TOP_SOURCE_DIR / 'src/share/database/scripts/mysql',
|
||||
'upgrade_*_to_*.sh.in',
|
||||
check: true,
|
||||
)
|
||||
grabbed_upgrade_scripts = list.stdout().strip().split('\n')
|
||||
assert(
|
||||
upgrade_scripts.length() == grabbed_upgrade_scripts.length(),
|
||||
|
@ -1,4 +1,4 @@
|
||||
install_dir = f'@DATADIR@/kea/scripts/pgsql'
|
||||
install_dir = DATADIR / 'kea/scripts/pgsql'
|
||||
configure_file(
|
||||
input: 'dhcpdb_create.pgsql',
|
||||
output: 'dhcpdb_create.pgsql',
|
||||
@ -62,7 +62,12 @@ upgrade_scripts = [
|
||||
'upgrade_027_to_028.sh',
|
||||
'upgrade_028_to_029.sh',
|
||||
]
|
||||
list = run_command('../utils/grabber.sh', check: true)
|
||||
list = run_command(
|
||||
GRABBER,
|
||||
TOP_SOURCE_DIR / 'src/share/database/scripts/pgsql',
|
||||
'upgrade_*_to_*.sh.in',
|
||||
check: true,
|
||||
)
|
||||
grabbed_upgrade_scripts = list.stdout().strip().split('\n')
|
||||
assert(
|
||||
upgrade_scripts.length() == grabbed_upgrade_scripts.length(),
|
||||
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
for i in upgrade_*_to_*.sh.in
|
||||
do
|
||||
echo "$i"
|
||||
done
|
@ -22,7 +22,12 @@ yangmodules_list = [
|
||||
'kea-types@2019-08-12.yang',
|
||||
'keatest-module@2022-11-30.yang',
|
||||
]
|
||||
list = run_command('utils/grabber.sh', check: true)
|
||||
list = run_command(
|
||||
GRABBER,
|
||||
TOP_SOURCE_DIR / 'src/share/yang/modules',
|
||||
'*.yang',
|
||||
check: true,
|
||||
)
|
||||
grabbed_modules = list.stdout().strip().split('\n')
|
||||
foreach file : grabbed_modules
|
||||
assert(
|
||||
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
for i in [a-z]*.yang
|
||||
do
|
||||
echo "$i"
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user