594167
From 5a35f08026cad007f460170fe6a3e43bd51f60f9 Mon Sep 17 00:00:00 2001
594167
From: Jan Janssen <medhefgo@web.de>
594167
Date: Tue, 11 Jan 2022 10:56:22 +0100
594167
Subject: [PATCH] meson: Add check argument to remaining run_command() calls
594167
594167
(cherry picked from commit 68a06b3cdfe35ff08092e139033edb4a5189a439)
594167
594167
Related: #2017035
594167
---
594167
 man/meson.build          |  2 +-
594167
 src/basic/meson.build    |  2 +-
594167
 src/boot/efi/meson.build | 11 +++++++----
594167
 src/test/meson.build     |  2 +-
594167
 test/fuzz/meson.build    |  7 ++++---
594167
 test/meson.build         |  8 +++++---
594167
 6 files changed, 19 insertions(+), 13 deletions(-)
594167
594167
diff --git a/man/meson.build b/man/meson.build
594167
index a06a601767..710b4ca008 100644
594167
--- a/man/meson.build
594167
+++ b/man/meson.build
594167
@@ -105,7 +105,7 @@ endforeach
594167
 
594167
 ############################################################
594167
 
594167
-have_lxml = run_command(xml_helper_py).returncode() == 0
594167
+have_lxml = run_command(xml_helper_py, check: false).returncode() == 0
594167
 if not have_lxml
594167
         message('python-lxml not available, not making man page indices')
594167
 endif
594167
diff --git a/src/basic/meson.build b/src/basic/meson.build
594167
index 229ac97c69..5a9e13d741 100644
594167
--- a/src/basic/meson.build
594167
+++ b/src/basic/meson.build
594167
@@ -384,7 +384,7 @@ filesystem_includes = ['linux/magic.h',
594167
                        'linux/gfs2_ondisk.h']
594167
 
594167
 check_filesystems = find_program('check-filesystems.sh')
594167
-r = run_command([check_filesystems, cpp, 'filesystems-gperf.gperf'] + filesystem_includes)
594167
+r = run_command([check_filesystems, cpp, 'filesystems-gperf.gperf'] + filesystem_includes, check: false)
594167
 if r.returncode() != 0
594167
         error('found unknown filesystem(s) defined in kernel headers:\n\n' + r.stdout())
594167
         r.stdout()
594167
diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
594167
index 3e948281f2..fad92f09a1 100644
594167
--- a/src/boot/efi/meson.build
594167
+++ b/src/boot/efi/meson.build
594167
@@ -57,8 +57,11 @@ endif
594167
 efi_libdir = ''
594167
 foreach dir : [get_option('efi-libdir'),
594167
                '/usr/lib/gnuefi' / efi_arch[0],
594167
-               run_command('realpath', '-e',
594167
-                        '/usr/lib' / run_command(cc.cmd_array(), '-print-multi-os-directory').stdout().strip()).stdout().strip()]
594167
+               run_command(
594167
+                        'realpath', '-e',
594167
+                        '/usr/lib' / run_command(cc.cmd_array(), '-print-multi-os-directory', check: false).stdout().strip(),
594167
+                        check: false
594167
+               ).stdout().strip()]
594167
         if dir != '' and fs.is_dir(dir)
594167
                 efi_libdir = dir
594167
                 break
594167
@@ -125,7 +128,7 @@ elif get_option('sbat-distro') != ''
594167
                 value = get_option(sbatvar[0])
594167
                 if (value == '' or value == 'auto') and not meson.is_cross_build()
594167
                         cmd = 'if [ -e /etc/os-release ]; then . /etc/os-release; else . /usr/lib/os-release; fi; echo $@0@'.format(sbatvar[1])
594167
-                        value = run_command(sh, '-c', cmd).stdout().strip()
594167
+                        value = run_command(sh, '-c', cmd, check: true).stdout().strip()
594167
                 endif
594167
                 if value == ''
594167
                         error('Required @0@ option not set and autodetection failed'.format(sbatvar[0]))
594167
@@ -254,7 +257,7 @@ if efi_arch[1] == 'arm'
594167
         efi_ldflags += ['-Wl,--no-warn-mismatch']
594167
 endif
594167
 
594167
-if run_command('grep', '-q', '__CTOR_LIST__', efi_lds).returncode() == 0
594167
+if run_command('grep', '-q', '__CTOR_LIST__', efi_lds, check: false).returncode() == 0
594167
         # fedora has a patched gnu-efi that adds support for ELF constructors.
594167
         # If ld is called by gcc something about these symbols breaks, resulting
594167
         # in sd-boot freezing when gnu-efi runs the constructors. Force defining
594167
diff --git a/src/test/meson.build b/src/test/meson.build
594167
index 9e224d69ce..75f78e2e1a 100644
594167
--- a/src/test/meson.build
594167
+++ b/src/test/meson.build
594167
@@ -11,7 +11,7 @@ test_hashmap_ordered_c = custom_target(
594167
 
594167
 test_include_dir = include_directories('.')
594167
 
594167
-path = run_command(sh, '-c', 'echo "$PATH"').stdout().strip()
594167
+path = run_command(sh, '-c', 'echo "$PATH"', check: true).stdout().strip()
594167
 test_env = environment()
594167
 test_env.set('SYSTEMD_LANGUAGE_FALLBACK_MAP', language_fallback_map)
594167
 test_env.set('PATH', project_build_root + ':' + path)
594167
diff --git a/test/fuzz/meson.build b/test/fuzz/meson.build
594167
index 30e26b09cf..b4766de3eb 100644
594167
--- a/test/fuzz/meson.build
594167
+++ b/test/fuzz/meson.build
594167
@@ -13,12 +13,13 @@ sanitize_address_undefined = custom_target(
594167
 
594167
 sanitizers = [['address,undefined', sanitize_address_undefined]]
594167
 
594167
-if git.found()
594167
+if git.found() and fs.exists(project_source_root / '.git')
594167
         out = run_command(env, '-u', 'GIT_WORK_TREE',
594167
                           git, '--git-dir=@0@/.git'.format(project_source_root),
594167
-                          'ls-files', ':/test/fuzz/*/*')
594167
+                          'ls-files', ':/test/fuzz/*/*',
594167
+                          check: true)
594167
 else
594167
-        out = run_command(sh, '-c', 'ls @0@/test/fuzz/*/*'.format(project_source_root))
594167
+        out = run_command(sh, '-c', 'ls @0@/test/fuzz/*/*'.format(project_source_root), check: true)
594167
 endif
594167
 
594167
 fuzz_regression_tests = []
594167
diff --git a/test/meson.build b/test/meson.build
594167
index 04ae9ebc78..baf94703ea 100644
594167
--- a/test/meson.build
594167
+++ b/test/meson.build
594167
@@ -182,14 +182,16 @@ endif
594167
 if want_tests != 'false' and dmi_arches.contains(host_machine.cpu_family())
594167
         udev_dmi_memory_id_test = find_program('udev-dmi-memory-id-test.sh')
594167
 
594167
-        if git.found()
594167
+        if git.found() and fs.exists(project_source_root / '.git')
594167
                 out = run_command(
594167
                         env, '-u', 'GIT_WORK_TREE',
594167
                         git, '--git-dir=@0@/.git'.format(project_source_root),
594167
-                        'ls-files', ':/test/dmidecode-dumps/*.bin')
594167
+                        'ls-files', ':/test/dmidecode-dumps/*.bin',
594167
+                        check: true)
594167
         else
594167
                 out = run_command(
594167
-                        sh, '-c', 'ls @0@/test/dmidecode-dumps/*.bin'.format(project_source_root))
594167
+                        sh, '-c', 'ls @0@/test/dmidecode-dumps/*.bin'.format(project_source_root),
594167
+                        check: true)
594167
         endif
594167
 
594167
         foreach p : out.stdout().split()