mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
meson: add feature flag for nspawn build (#36876)
Other tools have it, nspawn doesn't, add one
This commit is contained in:
2
.github/workflows/unit_tests.sh
vendored
2
.github/workflows/unit_tests.sh
vendored
@@ -107,7 +107,7 @@ for phase in "${PHASES[@]}"; do
|
||||
MESON_ARGS+=(-Db_lundef=false -Dfuzz-tests=true)
|
||||
|
||||
if [[ "$phase" == "RUN_CLANG_ASAN_UBSAN_NO_DEPS" ]]; then
|
||||
MESON_ARGS+=(--auto-features=disabled)
|
||||
MESON_ARGS+=(--auto-features=disabled -Dnspawn=enabled)
|
||||
fi
|
||||
fi
|
||||
MESON_ARGS+=(--fatal-meson-warnings)
|
||||
|
||||
@@ -1027,7 +1027,7 @@ manpages = [
|
||||
'ENABLE_NETWORKD'],
|
||||
['systemd-networkd.service', '8', ['systemd-networkd'], 'ENABLE_NETWORKD'],
|
||||
['systemd-notify', '1', [], ''],
|
||||
['systemd-nspawn', '1', [], ''],
|
||||
['systemd-nspawn', '1', [], 'ENABLE_NSPAWN'],
|
||||
['systemd-nsresourced.service',
|
||||
'8',
|
||||
['systemd-nsresourced'],
|
||||
@@ -1192,7 +1192,7 @@ manpages = [
|
||||
['systemd.net-naming-scheme', '7', [], ''],
|
||||
['systemd.netdev', '5', [], 'ENABLE_NETWORKD'],
|
||||
['systemd.network', '5', [], 'ENABLE_NETWORKD'],
|
||||
['systemd.nspawn', '5', [], ''],
|
||||
['systemd.nspawn', '5', [], 'ENABLE_NSPAWN'],
|
||||
['systemd.offline-updates', '7', [], ''],
|
||||
['systemd.path', '5', [], ''],
|
||||
['systemd.pcrlock', '5', ['systemd.pcrlock.d'], ''],
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
]>
|
||||
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
|
||||
|
||||
<refentry id="systemd-nspawn"
|
||||
<refentry id="systemd-nspawn" conditional="ENABLE_NSPAWN"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<refentryinfo>
|
||||
|
||||
@@ -1610,6 +1610,9 @@ conf.set10('ENABLE_REMOTE', have)
|
||||
feature = get_option('vmspawn').disable_auto_if(conf.get('BUILD_MODE_DEVELOPER') == 0)
|
||||
conf.set10('ENABLE_VMSPAWN', feature.allowed())
|
||||
|
||||
feature = get_option('nspawn')
|
||||
conf.set10('ENABLE_NSPAWN', feature.allowed())
|
||||
|
||||
conf.set10('DEFAULT_MOUNTFSD_TRUSTED_DIRECTORIES', get_option('default-mountfsd-trusted-directories'))
|
||||
|
||||
foreach term : ['analyze',
|
||||
@@ -3046,6 +3049,7 @@ foreach tuple : [
|
||||
['machined'],
|
||||
['mountfsd'],
|
||||
['networkd'],
|
||||
['nspawn'],
|
||||
['nsresourced'],
|
||||
['nss-myhostname'],
|
||||
['nss-mymachines'],
|
||||
|
||||
@@ -178,6 +178,8 @@ option('rfkill', type : 'boolean',
|
||||
description : 'support for the rfkill tools')
|
||||
option('xdg-autostart', type : 'boolean',
|
||||
description : 'install the xdg-autostart-generator and unit')
|
||||
option('nspawn', type : 'feature',
|
||||
description : 'build and install systemd-nspawn')
|
||||
option('man', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
|
||||
value : 'disabled',
|
||||
description : 'build and install man pages')
|
||||
|
||||
@@ -28,7 +28,7 @@ items = [['busctl', ''],
|
||||
['systemd-delta', ''],
|
||||
['systemd-detect-virt', ''],
|
||||
['systemd-id128', ''],
|
||||
['systemd-nspawn', ''],
|
||||
['systemd-nspawn', 'ENABLE_NSPAWN'],
|
||||
['systemd-path', ''],
|
||||
['systemd-run', ''],
|
||||
['systemd-vpick', ''],
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
if conf.get('ENABLE_NSPAWN') != 1
|
||||
subdir_done()
|
||||
endif
|
||||
|
||||
libnspawn_core_sources = files(
|
||||
'nspawn-bind-user.c',
|
||||
'nspawn-cgroup.c',
|
||||
@@ -58,14 +62,18 @@ executables += [
|
||||
},
|
||||
nspawn_test_template + {
|
||||
'sources' : files('test-nspawn-tables.c'),
|
||||
'conditions' : ['ENABLE_NSPAWN'],
|
||||
},
|
||||
nspawn_test_template + {
|
||||
'sources' : files('test-nspawn-util.c'),
|
||||
'conditions' : ['ENABLE_NSPAWN'],
|
||||
},
|
||||
nspawn_fuzz_template + {
|
||||
'sources' : files('fuzz-nspawn-settings.c'),
|
||||
'conditions' : ['ENABLE_NSPAWN'],
|
||||
},
|
||||
nspawn_fuzz_template + {
|
||||
'sources' : files('fuzz-nspawn-oci.c'),
|
||||
'conditions' : ['ENABLE_NSPAWN'],
|
||||
},
|
||||
]
|
||||
|
||||
@@ -60,7 +60,7 @@ sanitize_address_undefined = custom_target(
|
||||
'fuzzers',
|
||||
' '.join(fuzz_c_args + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
|
||||
' '.join(fuzz_cpp_args + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
|
||||
'-Dfuzz-tests=true -Db_lundef=false -Db_sanitize=address,undefined --optimization=@0@ @1@ --auto-features=@2@'.format(
|
||||
'-Dfuzz-tests=true -Db_lundef=false -Db_sanitize=address,undefined -Dnspawn=enabled --optimization=@0@ @1@ --auto-features=@2@'.format(
|
||||
get_option('optimization'),
|
||||
get_option('werror') ? '--werror' : '',
|
||||
sanitize_auto_features
|
||||
|
||||
@@ -359,11 +359,9 @@ if install_tests
|
||||
exclude_files : '.gitattributes',
|
||||
install_dir : testdata_dir)
|
||||
endif
|
||||
if conf.get('ENABLE_RESOLVE') == 1
|
||||
install_subdir('test-resolve',
|
||||
exclude_files : '.gitattributes',
|
||||
install_dir : testdata_dir)
|
||||
endif
|
||||
install_subdir('test-resolve',
|
||||
exclude_files : '.gitattributes',
|
||||
install_dir : testdata_dir)
|
||||
|
||||
# The unit tests implemented as shell scripts expect to find testdata/
|
||||
# in the directory where they are stored.
|
||||
|
||||
@@ -10,6 +10,11 @@ if [[ "$FSTYPE" == "fuseblk" ]]; then
|
||||
exit 77
|
||||
fi
|
||||
|
||||
if ! command -v systemd-nspawn >/dev/null; then
|
||||
echo "no systemd-nspawn" >/skipped
|
||||
exit 77
|
||||
fi
|
||||
|
||||
# shellcheck source=test/units/test-control.sh
|
||||
. "$(dirname "$0")"/test-control.sh
|
||||
|
||||
|
||||
@@ -514,7 +514,10 @@ units = [
|
||||
'file' : 'systemd-networkd.socket',
|
||||
'conditions' : ['ENABLE_NETWORKD'],
|
||||
},
|
||||
{ 'file' : 'systemd-nspawn@.service.in' },
|
||||
{
|
||||
'file' : 'systemd-nspawn@.service.in',
|
||||
'conditions' : ['ENABLE_NSPAWN'],
|
||||
},
|
||||
{
|
||||
'file' : 'systemd-vmspawn@.service.in',
|
||||
'conditions' : ['ENABLE_VMSPAWN'],
|
||||
|
||||
Reference in New Issue
Block a user