meson: use integer type in options

This bumps the minimum required version of meson to 0.45 and
python to 3.5, as integer type option is supported since meson-0.45
and meson-0.45 requires python-3.5.
This commit is contained in:
Yu Watanabe 2018-05-10 16:04:16 +09:00
parent 08540a9591
commit ac09340e85
3 changed files with 35 additions and 43 deletions

2
README
View file

@ -162,7 +162,7 @@ REQUIREMENTS:
docbook-xsl (optional, required for documentation) docbook-xsl (optional, required for documentation)
xsltproc (optional, required for documentation) xsltproc (optional, required for documentation)
python-lxml (optional, required to build the indices) python-lxml (optional, required to build the indices)
python >= 3.4, meson >= 0.44, ninja python >= 3.5, meson >= 0.45, ninja
gcc, awk, sed, grep, m4, and similar tools gcc, awk, sed, grep, m4, and similar tools
During runtime, you need the following additional During runtime, you need the following additional

View file

@ -9,7 +9,7 @@ project('systemd', 'c',
'sysconfdir=/etc', 'sysconfdir=/etc',
'localstatedir=/var', 'localstatedir=/var',
], ],
meson_version : '>= 0.44', meson_version : '>= 0.45',
) )
libsystemd_version = '0.23.0' libsystemd_version = '0.23.0'
@ -635,50 +635,51 @@ else
endif endif
time_epoch = get_option('time-epoch') time_epoch = get_option('time-epoch')
if time_epoch == '' if time_epoch == -1
NEWS = files('NEWS') NEWS = files('NEWS')
time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout() time_epoch = run_command(stat, '-c', '%Y', NEWS).stdout().to_int()
endif endif
time_epoch = time_epoch.to_int()
conf.set('TIME_EPOCH', time_epoch) conf.set('TIME_EPOCH', time_epoch)
system_uid_max = get_option('system-uid-max') system_uid_max = get_option('system-uid-max')
if system_uid_max == '' if system_uid_max == -1
system_uid_max = run_command( system_uid_max = run_command(
awk, awk,
'/^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }', '/^\s*SYS_UID_MAX\s+/ { uid=$2 } END { print uid }',
'/etc/login.defs').stdout().strip() '/etc/login.defs').stdout().strip()
if system_uid_max == '' if system_uid_max == ''
system_uid_max = '999' system_uid_max = 999
else
system_uid_max = system_uid_max.to_int()
endif endif
endif endif
system_uid_max = system_uid_max.to_int()
conf.set('SYSTEM_UID_MAX', system_uid_max) conf.set('SYSTEM_UID_MAX', system_uid_max)
substs.set('systemuidmax', system_uid_max) substs.set('systemuidmax', system_uid_max)
system_gid_max = get_option('system-gid-max') system_gid_max = get_option('system-gid-max')
if system_gid_max == '' if system_gid_max == -1
system_gid_max = run_command( system_gid_max = run_command(
awk, awk,
'/^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }', '/^\s*SYS_GID_MAX\s+/ { gid=$2 } END { print gid }',
'/etc/login.defs').stdout().strip() '/etc/login.defs').stdout().strip()
if system_gid_max == '' if system_gid_max == ''
system_gid_max = '999' system_gid_max = 999
else
system_gid_max = system_gid_max.to_int()
endif endif
endif endif
system_gid_max = system_gid_max.to_int()
conf.set('SYSTEM_GID_MAX', system_gid_max) conf.set('SYSTEM_GID_MAX', system_gid_max)
substs.set('systemgidmax', system_gid_max) substs.set('systemgidmax', system_gid_max)
dynamic_uid_min = get_option('dynamic-uid-min').to_int() dynamic_uid_min = get_option('dynamic-uid-min')
dynamic_uid_max = get_option('dynamic-uid-max').to_int() dynamic_uid_max = get_option('dynamic-uid-max')
conf.set('DYNAMIC_UID_MIN', dynamic_uid_min) conf.set('DYNAMIC_UID_MIN', dynamic_uid_min)
conf.set('DYNAMIC_UID_MAX', dynamic_uid_max) conf.set('DYNAMIC_UID_MAX', dynamic_uid_max)
substs.set('dynamicuidmin', dynamic_uid_min) substs.set('dynamicuidmin', dynamic_uid_min)
substs.set('dynamicuidmax', dynamic_uid_max) substs.set('dynamicuidmax', dynamic_uid_max)
container_uid_base_min = get_option('container-uid-base-min').to_int() container_uid_base_min = get_option('container-uid-base-min')
container_uid_base_max = get_option('container-uid-base-max').to_int() container_uid_base_max = get_option('container-uid-base-max')
conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min) conf.set('CONTAINER_UID_BASE_MIN', container_uid_base_min)
conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max) conf.set('CONTAINER_UID_BASE_MAX', container_uid_base_max)
substs.set('containeruidbasemin', container_uid_base_min) substs.set('containeruidbasemin', container_uid_base_min)
@ -742,12 +743,8 @@ conf.set('TTY_GID', tty_gid)
substs.set('TTY_GID', tty_gid) substs.set('TTY_GID', tty_gid)
# Ensure provided GID argument is numeric, otherwise fallback to default assignment # Ensure provided GID argument is numeric, otherwise fallback to default assignment
if get_option('users-gid') != '' users_gid = get_option('users-gid')
users_gid = get_option('users-gid').to_int() substs.set('USERS_GID', users_gid < 0 ? '-' : users_gid)
else
users_gid = '-'
endif
substs.set('USERS_GID', users_gid)
conf.set10('ENABLE_ADM_GROUP', get_option('adm-group')) conf.set10('ENABLE_ADM_GROUP', get_option('adm-group'))
conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group')) conf.set10('ENABLE_WHEEL_GROUP', get_option('wheel-group'))
@ -1300,7 +1297,7 @@ if get_option('efi')
have = true have = true
conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME) conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int()) conf.set('SD_TPM_PCR', get_option('tpm-pcrindex'))
else else
have = false have = false
endif endif
@ -2896,7 +2893,7 @@ status = [
'debug shell: @0@ @ @1@'.format(get_option('debug-shell'), 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'),
get_option('debug-tty')), get_option('debug-tty')),
'TTY GID: @0@'.format(tty_gid), 'TTY GID: @0@'.format(tty_gid),
'users GID: @0@'.format(users_gid), 'users GID: @0@'.format(substs.get('USERS_GID')),
'maximum system UID: @0@'.format(system_uid_max), 'maximum system UID: @0@'.format(system_uid_max),
'maximum system GID: @0@'.format(system_gid_max), 'maximum system GID: @0@'.format(system_gid_max),
'minimum dynamic UID: @0@'.format(dynamic_uid_min), 'minimum dynamic UID: @0@'.format(dynamic_uid_min),

View file

@ -150,28 +150,23 @@ option('compat-gateway-hostname', type : 'boolean', value : 'false',
option('default-hierarchy', type : 'combo', option('default-hierarchy', type : 'combo',
choices : ['legacy', 'hybrid', 'unified'], value : 'hybrid', choices : ['legacy', 'hybrid', 'unified'], value : 'hybrid',
description : 'default cgroup hierarchy') description : 'default cgroup hierarchy')
option('time-epoch', type : 'string', option('time-epoch', type : 'integer', value : '-1',
description : 'time epoch for time clients') description : 'time epoch for time clients')
option('system-uid-max', type : 'string', option('system-uid-max', type : 'integer', value : '-1',
description : 'maximum system UID') description : 'maximum system UID')
option('system-gid-max', type : 'string', option('system-gid-max', type : 'integer', value : '-1',
description : 'maximum system GID') description : 'maximum system GID')
option('dynamic-uid-min', type : 'string', option('dynamic-uid-min', type : 'integer', value : 0x0000EF00,
description : 'minimum dynamic UID', description : 'minimum dynamic UID')
value : '61184') # That's → 0x0000EF00 in hex option('dynamic-uid-max', type : 'integer', value : 0x0000FFEF,
option('dynamic-uid-max', type : 'string', description : 'maximum dynamic UID')
description : 'maximum dynamic UID', option('container-uid-base-min', type : 'integer', value : 0x00080000,
value : '65519') # That's → 0x0000FFEF in hex description : 'minimum container UID base')
option('container-uid-base-min', type : 'string', option('container-uid-base-max', type : 'integer', value : 0x6FFF0000,
description : 'minimum container UID base', description : 'maximum container UID base')
value : '524288') # That's → 0x00080000 in hex option('tty-gid', type : 'integer', value : 5,
option('container-uid-base-max', type : 'string', description : 'the numeric GID of the "tty" group')
description : 'maximum container UID base', option('users-gid', type : 'integer', value : '-1',
value : '1878982656') # That's → 0x6FFF0000 in hex
option('tty-gid', type : 'string',
description : 'the numeric GID of the "tty" group',
value : '5')
option('users-gid', type : 'string',
description : 'the numeric GID of the "users" group') description : 'the numeric GID of the "users" group')
option('adm-group', type : 'boolean', option('adm-group', type : 'boolean',
description : 'the ACL for adm group should be added') description : 'the ACL for adm group should be added')
@ -291,7 +286,7 @@ option('efi-ldsdir', type : 'string',
description : 'path to the EFI lds directory') description : 'path to the EFI lds directory')
option('efi-includedir', type : 'string', value : '/usr/include/efi', option('efi-includedir', type : 'string', value : '/usr/include/efi',
description : 'path to the EFI header directory') description : 'path to the EFI header directory')
option('tpm-pcrindex', type : 'string', value : '8', option('tpm-pcrindex', type : 'integer', value : 8,
description : 'TPM PCR register number to use') description : 'TPM PCR register number to use')
option('bashcompletiondir', type : 'string', option('bashcompletiondir', type : 'string',