build/meson: fix autodetecting ifcfg_rh/ifupdown plugins
"-Difcfg_rh=false" did not work, we would always fallback to autodetection. That is wrong, an explicit "false" should be honored. It's also not what autotools does. Fix this. While at it, drop "distro" variable. It's not a clear concept that can be reused and it's unused otherwise. Also, no longer let the autodetection be based on cross compilation. When cross-compiling, it seems not entirely unreasonable that you cross compile to a comparable distro, so let the autodetection be based on what we detect on the host. In any case, a user can and is encouraged to explicitly enable/disable the plugins via "-Difcfg_rh=" or "-Difupdown=". https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1310
This commit is contained in:
23
meson.build
23
meson.build
@@ -287,22 +287,19 @@ glib_dep = declare_dependency(
|
||||
]
|
||||
)
|
||||
|
||||
if meson.is_cross_build()
|
||||
distro = 'unknown'
|
||||
elif run_command('test', '-e', '/etc/sysconfig/network-scripts').returncode() == 0
|
||||
distro = 'redhat'
|
||||
elif run_command('test', '-e', '/etc/SuSE-release').returncode() == 0
|
||||
distro = 'suse'
|
||||
elif run_command('test', '-e', '/etc/debian_version').returncode() == 0
|
||||
distro = 'debian'
|
||||
elif run_command('test', '-e', '/etc/gentoo-release').returncode() == 0
|
||||
distro = 'gentoo'
|
||||
enable_ifcfg_rh = get_option('ifcfg_rh')
|
||||
if enable_ifcfg_rh == 'auto'
|
||||
enable_ifcfg_rh = (run_command('test', '-e', '/etc/sysconfig/network-scripts').returncode() == 0)
|
||||
else
|
||||
distro = 'unknown'
|
||||
enable_ifcfg_rh = (enable_ifcfg_rh != 'false')
|
||||
endif
|
||||
|
||||
enable_ifcfg_rh = get_option('ifcfg_rh') or (distro == 'redhat')
|
||||
enable_ifupdown = get_option('ifupdown') or (distro == 'debian')
|
||||
enable_ifupdown = get_option('ifupdown')
|
||||
if enable_ifupdown == 'auto'
|
||||
enable_ifupdown = (run_command('test', '-e', '/etc/debian_version').returncode() == 0)
|
||||
else
|
||||
enable_ifupdown = (enable_ifupdown != 'false')
|
||||
endif
|
||||
|
||||
config_plugins_default = get_option('config_plugins_default')
|
||||
config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_PLUGINS', config_plugins_default)
|
||||
|
@@ -44,8 +44,8 @@ option('ebpf', type: 'combo', choices : ['auto', 'true', 'false'], description:
|
||||
|
||||
# configuration plugins
|
||||
option('config_plugins_default', type: 'string', value: '', description: 'Default configuration option for main.plugins setting, used as fallback if the configuration option is unset')
|
||||
option('ifcfg_rh', type: 'boolean', value: false, description: 'enable ifcfg-rh configuration plugin (Fedora/RHEL)')
|
||||
option('ifupdown', type: 'boolean', value: false, description: 'enable ifupdown configuration plugin (Debian/Ubuntu)')
|
||||
option('ifcfg_rh', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'enable ifcfg-rh configuration plugin (Fedora/RHEL)')
|
||||
option('ifupdown', type: 'combo', choices:['auto', 'true', 'false'], value: 'auto', description: 'enable ifupdown configuration plugin (Debian/Ubuntu)')
|
||||
|
||||
# handlers for resolv.conf
|
||||
option('resolvconf', type: 'string', value: '', description: 'Enable resolvconf support')
|
||||
|
Reference in New Issue
Block a user