NetworkManager/tools/check-config-options.sh
Thomas Haller ac1a9e03e4
all: move "src/" directory to "src/core/"
Currently "src/" mostly contains the source code of the daemon.
I say mostly, because that is not true, there are also the device,
settings, wwan, ppp plugins, the initrd generator, the pppd and dhcp
helper, and probably more.

Also we have source code under libnm-core/, libnm/, clients/, and
shared/ directories. That is all confusing.

We should have one "src" directory, that contains subdirectories. Those
subdirectories should contain individual parts (libraries or
applications), that possibly have dependencies on other subdirectories.
There should be a flat hierarchy of directories under src/, which
contains individual modules.

As the name "src/" is already taken, that prevents any sensible
restructuring of the code.

As a first step, move "src/" to "src/core/". This gives space to
reorganize the code better by moving individual components into "src/".

For inspiration, look at systemd's "src/" directory.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/743
2021-02-04 09:45:55 +01:00

73 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
srcdir=${1:-.}
ret=0
get_supported_options()
{
awk '/START OPTION LIST/{flag=1;next}/END OPTION LIST/{flag=0}flag' "$srcdir/src/core/nm-config.c" |
grep -o 'NM_CONFIG_KEYFILE_KEY_\w*'
}
get_missing_options()
{
grep -v '/\* check-config-options skip \*/' "$srcdir/src/core/nm-config.h" |
grep -o 'NM_CONFIG_KEYFILE_KEY_\w*' |
grep -v -Fx -f <(get_supported_options)
}
get_src_con_defaults()
{
sed -n 's/\<NM_CON_DEFAULT/\n\0/gp' $(find "$srcdir/src/core/" -name \*.c ! -name test\*.c) |
sed -n 's/.*\<NM_CON_DEFAULT\(_NOP\)\?\s*("\([^"]*\)").*/\2/p'
}
get_man_con_defaults()
{
awk '/start connection defaults/{flag=1;next}/end connection defaults/{flag=0}flag' "$srcdir/man/NetworkManager.conf.xml" |
sed -ne 's#.*<varname>\([^<]*\)</varname>.*#\1#p'
}
get_missing_con_defaults()
{
get_src_con_defaults | grep -v -Fx -f <(get_man_con_defaults)
}
get_missing_con_defaults2()
{
get_man_con_defaults | grep -v -Fx -f <(get_src_con_defaults)
}
missing=$(get_missing_options)
if [ -n "$missing" ]; then
echo "***"
echo "*** Error: the following configuration options are defined but not present in the list of supported options"
echo "***"
echo "$missing"
echo
ret=1
fi
missing_con_defaults=$(get_missing_con_defaults)
if [ -n "$missing_con_defaults" ]; then
echo "***"
echo "*** Error: the following connection defaults are present in source files but not in the NetworkManager.conf man page:"
echo "***"
echo "$missing_con_defaults"
echo
ret=1
fi
missing_con_defaults2=$(get_missing_con_defaults2)
if [ -n "$missing_con_defaults2" ]; then
echo "***"
echo "*** Error: the following connection defaults are present in the NetworkManager.conf man page but not in source files:"
echo "***"
echo "$missing_con_defaults2"
echo
ret=1
fi
exit $ret