[PATCH 19.11 v2 4/5] build: fix warnings when running external commands

Bruce Richardson bruce.richardson at intel.com
Tue Mar 1 15:44:02 CET 2022


Meson 0.61.1 is giving warnings that the calls to run_command do not
always explicitly specify if the result is to be checked or not, i.e.
there is a missing "check" parameter. This is because the default
behaviour without the parameter is due to change in the future.

We can fix these warnings by explicitly adding into each call whether
the result should be checked by meson or not. This patch therefore
adds in "check: false" to each run_command call where the result is
being checked by the DPDK meson.build code afterwards, and adds in
"check: true" to any calls where the result is currently unchecked.

Bugzilla ID: 921
Cc: stable at dpdk.org

Reported-by: Jerin Jacob <jerinj at marvell.com>
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
Tested-by: Jerin Jacob <jerinj at marvell.com>
---
 app/test/meson.build         | 4 ++--
 config/arm/meson.build       | 2 +-
 config/meson.build           | 4 ++--
 config/x86/meson.build       | 2 +-
 drivers/meson.build          | 4 ++--
 kernel/linux/kni/meson.build | 2 +-
 kernel/linux/meson.build     | 6 +++---
 lib/meson.build              | 4 ++--
 meson.build                  | 4 ++--
 9 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/app/test/meson.build b/app/test/meson.build
index 2e35e93477..5554be9710 100644
--- a/app/test/meson.build
+++ b/app/test/meson.build
@@ -405,7 +405,7 @@ dpdk_test = executable('dpdk-test',
 has_hugepage = true
 if is_linux
 	check_hugepage = run_command('cat',
-				     '/proc/sys/vm/nr_hugepages')
+				     '/proc/sys/vm/nr_hugepages', check: false)
 	if (check_hugepage.returncode() != 0 or
 	    check_hugepage.stdout().strip() == '0')
 		has_hugepage = false
@@ -419,7 +419,7 @@ timeout_seconds = 600
 timeout_seconds_fast = 10
 
 get_coremask = find_program('get-coremask.sh')
-num_cores_arg = '-l ' + run_command(get_coremask).stdout().strip()
+num_cores_arg = '-l ' + run_command(get_coremask, check: true).stdout().strip()
 
 default_test_args = [num_cores_arg]
 
diff --git a/config/arm/meson.build b/config/arm/meson.build
index 60f7b05396..dceea336dd 100644
--- a/config/arm/meson.build
+++ b/config/arm/meson.build
@@ -152,7 +152,7 @@ else
 		# 'Primary Part number', 'Revision']
 		detect_vendor = find_program(join_paths(
 				meson.current_source_dir(), 'armv8_machine.py'))
-		cmd = run_command(detect_vendor.path())
+		cmd = run_command(detect_vendor.path(), check: false)
 		if cmd.returncode() == 0
 			cmd_output = cmd.stdout().to_lower().strip().split(' ')
 		endif
diff --git a/config/meson.build b/config/meson.build
index e87d1ba533..4b03746889 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -22,8 +22,8 @@ is_ms_linker = is_windows and (cc.get_id() == 'clang')
 # depending on the configuration options
 pver = meson.project_version().split('.')
 major_version = '@0 at .@1@'.format(pver.get(0), pver.get(1))
-abi_version = run_command(find_program('cat', 'more'),
-	abi_version_file).stdout().strip()
+abi_version = run_command(find_program('cat', 'more'), abi_version_file,
+		check: true).stdout().strip()
 # experimental libraries are versioned as 0.majorminor versions, e.g. 0.201
 ever = abi_version.split('.')
 experimental_abi_version = '0. at 0@@1@'.format(ever.get(0), ever.get(1))
diff --git a/config/x86/meson.build b/config/x86/meson.build
index adc857ba28..855a7d0edd 100644
--- a/config/x86/meson.build
+++ b/config/x86/meson.build
@@ -3,7 +3,7 @@
 
 # get binutils version for the workaround of Bug 97
 if not is_windows
-	ldver = run_command('ld', '-v').stdout().strip()
+	ldver = run_command('ld', '-v', check: true).stdout().strip()
 	if ldver.contains('2.30') and cc.has_argument('-mno-avx512f')
 		machine_args += '-mno-avx512f'
 		message('Binutils 2.30 detected, disabling AVX512 support as workaround for bug #97')
diff --git a/drivers/meson.build b/drivers/meson.build
index 0400d84675..22cc049142 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -127,8 +127,8 @@ foreach class:dpdk_driver_classes
 					meson.current_source_dir(),
 					drv_path, lib_name)
 
-			is_experimental = run_command(is_experimental_cmd,
-				files(version_map)).returncode()
+			is_experimental = run_command(is_experimental_cmd, files(version_map),
+					check: false).returncode()
 
 			if is_experimental != 0
 				lib_version = experimental_abi_version
diff --git a/kernel/linux/kni/meson.build b/kernel/linux/kni/meson.build
index facc6d8a69..eb97ec1491 100644
--- a/kernel/linux/kni/meson.build
+++ b/kernel/linux/kni/meson.build
@@ -5,7 +5,7 @@
 # Ref: https://jira.devtools.intel.com/browse/DPDK-29263
 kmod_cflags = ''
 file_path = kernel_source_dir + '/include/linux/netdevice.h'
-run_cmd = run_command('grep', 'ndo_tx_timeout', file_path)
+run_cmd = run_command('grep', 'ndo_tx_timeout', file_path, check: false)
 
 if run_cmd.stdout().contains('txqueue') == true
    kmod_cflags = '-DHAVE_ARG_TX_QUEUE'
diff --git a/kernel/linux/meson.build b/kernel/linux/meson.build
index cd74739905..793c58ef56 100644
--- a/kernel/linux/meson.build
+++ b/kernel/linux/meson.build
@@ -13,7 +13,7 @@ kernel_dir = get_option('kernel_dir')
 kernel_source_dir = get_option('kernel_dir')
 if kernel_dir == ''
 	# use default path for native builds
-	kernel_version = run_command('uname', '-r').stdout().strip()
+	kernel_version = run_command('uname', '-r', check: true).stdout().strip()
 	kernel_dir = '/lib/modules/' + kernel_version
 	if kernel_source_dir == ''
 		# use default path for native builds
@@ -22,8 +22,8 @@ if kernel_dir == ''
 endif
 
 # test running make in kernel directory, using "make kernelversion"
-make_returncode = run_command('make', '-sC', kernel_dir + '/build',
-		'kernelversion').returncode()
+make_returncode = run_command('make', '-sC', kernel_dir + '/build', 'kernelversion',
+		check: false).returncode()
 if make_returncode != 0
 	warning('Cannot compile kernel modules as requested - are kernel headers installed?')
 	subdir_done()
diff --git a/lib/meson.build b/lib/meson.build
index f8da4f3168..6d86ca3e26 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -108,8 +108,8 @@ foreach l:libraries
 			version_map = '@0@/@1@/rte_ at 2@_version.map'.format(
 					meson.current_source_dir(), dir_name, name)
 
-			is_experimental = run_command(is_experimental_cmd,
-					files(version_map)).returncode()
+			is_experimental = run_command(is_experimental_cmd, files(version_map),
+					check: false).returncode()
 
 			if is_experimental != 0
 				lib_version = experimental_abi_version
diff --git a/meson.build b/meson.build
index a32bcda1c9..94f51a8c6c 100644
--- a/meson.build
+++ b/meson.build
@@ -4,8 +4,8 @@
 project('DPDK', 'C',
 	# Get version number from file.
 	# Fallback to "more" for Windows compatibility.
-	version: run_command(find_program('cat', 'more'),
-		files('VERSION')).stdout().strip(),
+	version: run_command(find_program('cat', 'more'), files('VERSION'),
+			check: true).stdout().strip(),
 	license: 'BSD',
 	default_options: [
         'buildtype=release',
-- 
2.32.0



More information about the stable mailing list