]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: Use fs module
authorJan Janssen <medhefgo@web.de>
Sat, 13 Nov 2021 16:01:16 +0000 (17:01 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 14 Nov 2021 04:54:27 +0000 (13:54 +0900)
Turns out that meson provides a fs module since 0.53.0, making it unnecessary
to call out to test.

meson.build
src/boot/efi/meson.build

index 0c4e5a711bd0521f3955e708c9e27d69e907282b..f8b1156455f4f412a6477d19cb2b45744e403f8f 100644 (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()
index 9ffc839289f7946a74a39916116dd419b4f90ae1..06e42d979d6cf799545d8fda8c2ebe5f5fd1430c 100644 (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