1
0
mirror of https://github.com/systemd/systemd synced 2024-07-08 20:15:55 +00:00

meson: Use fs module

Turns out that meson provides a fs module since 0.53.0, making it unnecessary
to call out to test.
This commit is contained in:
Jan Janssen 2021-11-13 17:01:16 +01:00 committed by Yu Watanabe
parent 4728625490
commit 4cf8a6092e
2 changed files with 6 additions and 6 deletions

View File

@ -55,8 +55,9 @@ endif
#####################################################################
fs = import('fs')
if get_option('split-usr') == 'auto'
split_usr = run_command('test', '-L', '/bin').returncode() != 0
split_usr = not fs.is_symlink('/bin')
else
split_usr = get_option('split-usr') == 'true'
endif
@ -69,7 +70,7 @@ conf.set10('HAVE_SPLIT_USR', split_usr,
description : '/usr/bin and /bin directories are separate')
if get_option('split-bin') == 'auto'
split_bin = run_command('test', '-L', '/usr/sbin').returncode() != 0
split_bin = not fs.is_symlink('/usr/sbin')
else
split_bin = get_option('split-bin') == 'true'
endif
@ -593,7 +594,6 @@ versiondep = declare_dependency(sources: version_h)
sh = find_program('sh')
echo = find_program('echo')
test = find_program('test')
sed = find_program('sed')
awk = find_program('awk')
stat = find_program('stat')
@ -742,7 +742,7 @@ endif
time_epoch = get_option('time-epoch')
if time_epoch == -1
time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"').stdout().strip()
if time_epoch == '' and git.found() and run_command('test', '-e', '.git').returncode() == 0
if time_epoch == '' and git.found() and fs.exists('.git')
# If we're in a git repository, use the creation time of the latest git tag.
latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags').stdout().strip()
time_epoch = run_command(git, 'log', '--no-show-signature', '-1', '--format=%at', latest_tag).stdout()

View File

@ -61,7 +61,7 @@ foreach dir : [get_option('efi-libdir'),
'/usr/lib/gnuefi' / efi_arch[0],
run_command('realpath', '-e',
'/usr/lib' / run_command(efi_cc, '-print-multi-os-directory').stdout().strip()).stdout().strip()]
if run_command(test, '-d', dir).returncode() == 0
if dir != '' and fs.is_dir(dir)
efi_libdir = dir
break
endif
@ -83,7 +83,7 @@ foreach location : [ # New locations first introduced with gnu-efi 3.0.11
efi_libdir / 'gnuefi' / 'crt0-efi-@0@.o'.format(efi_arch[1])],
[efi_libdir / 'elf_@0@_efi.lds'.format(efi_arch[1]),
efi_libdir / 'crt0-efi-@0@.o'.format(efi_arch[1])]]
if run_command(test, '-f', location[0], '-a', '-f', location[1]).returncode() == 0
if fs.is_file(location[0]) and fs.is_file(location[1])
efi_lds = location[0]
efi_crt0 = location[1]
break