build: fix default drivers list without Python

If no enable_drivers option is passed, the default is to build
the drivers list by calling list-dir-globs.py.

But if no Python interpreter is installed, no error is reported
and all drivers end up being disabled.

Example on a minimal FreeBSD VM:

  dpdk@freebsd:~/dpdk $ meson setup build
  ...
  drivers:
	  common/cpt:	not in enabled drivers build config
	  common/dpaax:	not in enabled drivers build config
	  common/iavf:	not in enabled drivers build config
	  common/mvep:	not in enabled drivers build config
	  common/octeontx:	not in enabled drivers build config
	  common/octeontx2:	not in enabled drivers build config
	  bus/dpaa:	not in enabled drivers build config
	  bus/fslmc:	not in enabled drivers build config
  ...

  dpdk@freebsd:~/dpdk $ cd drivers/
  dpdk@freebsd:~/dpdk/drivers $ ~/dpdk/buildtools/list-dir-globs.py */*
  env: python3: No such file or directory

Rely on meson internal interpreter.
Check return code when calling this script.

Fixes: ab9407c3ad ("build: allow using wildcards to disable drivers")
Fixes: 2e33309ebe ("config: enable/disable drivers in Arm builds")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
David Marchand 2021-05-07 13:54:04 +02:00 committed by Thomas Monjalon
parent 0d655820e0
commit 627c5b41bb
3 changed files with 6 additions and 5 deletions

View File

@ -2,7 +2,6 @@
# Copyright(c) 2017-2019 Intel Corporation
pkgconf = find_program('pkg-config', 'pkgconf', required: false)
list_dir_globs = find_program('list-dir-globs.py')
check_symbols = find_program('check-symbols.sh')
ldflags_ibverbs_static = find_program('options-ibverbs-static.sh')
binutils_avx512_check = find_program('binutils-avx512-check.sh')
@ -14,6 +13,7 @@ if python3.found()
else
py3 = ['meson', 'runpython']
endif
list_dir_globs = py3 + files('list-dir-globs.py')
map_to_win_cmd = py3 + files('map_to_win.py')
sphinx_wrapper = py3 + files('call-sphinx-build.py')

View File

@ -27,13 +27,13 @@ endif
# add cmdline disabled drivers and meson disabled drivers together
disable_drivers += ',' + get_option('disable_drivers')
disable_drivers = run_command(list_dir_globs, disable_drivers).stdout().split()
disable_drivers = run_command(list_dir_globs, disable_drivers, check: true).stdout().split()
# add cmdline enabled drivers and meson enabled drivers together
enable_drivers = ',' + get_option('enable_drivers')
enable_drivers = run_command(list_dir_globs, enable_drivers).stdout().split()
enable_drivers = run_command(list_dir_globs, enable_drivers, check: true).stdout().split()
if enable_drivers.length() == 0
enable_drivers = run_command(list_dir_globs, '*/*').stdout().split()
enable_drivers = run_command(list_dir_globs, '*/*', check: true).stdout().split()
endif
# these drivers must always be enabled, otherwise the build breaks

View File

@ -88,7 +88,8 @@ optional_libs = [
]
disabled_libs = []
opt_disabled_libs = run_command(list_dir_globs, get_option('disable_libs')).stdout().split()
opt_disabled_libs = run_command(list_dir_globs, get_option('disable_libs'),
check: true).stdout().split()
foreach l:opt_disabled_libs
if not optional_libs.contains(l)
warning('Cannot disable mandatory library "@0@"'.format(l))