[v4] build: allow using wildcards to disable drivers
Checks
Commit Message
Rather than having to explicitly list each and every driver to disable in a
build, we can use a small python script and the python glob library to
expand out the wildcards. This means that we can configure meson using e.g.
meson -Ddisable_drivers=crypto/*,event/* build
to do a build omitting all the crypto and event drivers. Explicitly
specified drivers e.g. net/i40e, work as before, and can be mixed with
wildcarded drivers as required.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
V4:
- get pep8/pycodestyle compliance
- simplify getting the root directory
V3:
- added check for correct number of params
- replaced list comprehension with loops for simplicity
- allow running without meson environmental vars set (for easier testing)
V2:
- fixed file suffix
- since it's being called from meson, make this python3 only
- remove use of chdir()
- use '\n' rather than ',' between entries
---
buildtools/list-dir-globs.py | 19 +++++++++++++++++++
buildtools/meson.build | 2 +-
drivers/meson.build | 3 ++-
3 files changed, 22 insertions(+), 2 deletions(-)
create mode 100755 buildtools/list-dir-globs.py
Comments
2020-01-24, Bruce Richardson:
> Rather than having to explicitly list each and every driver to disable in a
> build, we can use a small python script and the python glob library to
> expand out the wildcards. This means that we can configure meson using e.g.
>
> meson -Ddisable_drivers=crypto/*,event/* build
>
> to do a build omitting all the crypto and event drivers. Explicitly
> specified drivers e.g. net/i40e, work as before, and can be mixed with
> wildcarded drivers as required.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Looks good to me.
Reviewed-by: Robin Jarry <robin.jarry@6wind.com>
On 1/24/20 4:10 PM, Bruce Richardson wrote:
> Rather than having to explicitly list each and every driver to disable in a
> build, we can use a small python script and the python glob library to
> expand out the wildcards. This means that we can configure meson using e.g.
>
> meson -Ddisable_drivers=crypto/*,event/* build
Maybe documenting that in 'build-sdk-meson.txt' would be beneficial?
With regards
Andrzej Ostruszka
On Fri, 2020-01-24 at 15:10 +0000, Bruce Richardson wrote:
> Rather than having to explicitly list each and every driver to
> disable in a
> build, we can use a small python script and the python glob library
> to
> expand out the wildcards. This means that we can configure meson
> using e.g.
>
> meson -Ddisable_drivers=crypto/*,event/* build
>
> to do a build omitting all the crypto and event drivers. Explicitly
> specified drivers e.g. net/i40e, work as before, and can be mixed
> with
> wildcarded drivers as required.
>
> Signed-off-by: Bruce Richardson <
> bruce.richardson@intel.com
> >
> ---
>
> V4:
> - get pep8/pycodestyle compliance
> - simplify getting the root directory
>
> V3:
> - added check for correct number of params
> - replaced list comprehension with loops for simplicity
> - allow running without meson environmental vars set (for easier
> testing)
>
> V2:
> - fixed file suffix
> - since it's being called from meson, make this python3 only
> - remove use of chdir()
> - use '\n' rather than ',' between entries
Acked-by: Luca Boccassi <bluca@debian.org>
On Mon, Jan 27, 2020 at 12:26:53PM +0100, Andrzej Ostruszka wrote:
> On 1/24/20 4:10 PM, Bruce Richardson wrote:
> > Rather than having to explicitly list each and every driver to disable in a
> > build, we can use a small python script and the python glob library to
> > expand out the wildcards. This means that we can configure meson using e.g.
> >
> > meson -Ddisable_drivers=crypto/*,event/* build
>
> Maybe documenting that in 'build-sdk-meson.txt' would be beneficial?
>
Yes, yes it would. Thanks for the suggestion.
/Bruce
new file mode 100755
@@ -0,0 +1,19 @@
+#! /usr/bin/env python3
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2020 Intel Corporation
+
+import sys
+import os
+from glob import iglob
+
+if len(sys.argv) != 2:
+ print("Usage: {0} <path-glob>[,<path-glob>[,...]]".format(sys.argv[0]))
+ sys.exit(1)
+
+root = os.path.join(os.getenv('MESON_SOURCE_ROOT', '.'),
+ os.getenv('MESON_SUBDIR', '.'))
+
+for path in sys.argv[1].split(','):
+ for p in iglob(os.path.join(root, path)):
+ if os.path.isdir(p):
+ print(os.path.relpath(p))
@@ -4,7 +4,7 @@
subdir('pmdinfogen')
pmdinfo = find_program('gen-pmdinfo-cfile.sh')
-
+list_dir_globs = find_program('list-dir-globs.py')
check_experimental_syms = find_program('check-experimental-syms.sh')
# set up map-to-def script using python, either built-in or external
@@ -17,7 +17,8 @@ dpdk_driver_classes = ['common',
'event', # depends on common, bus, mempool and net.
'baseband'] # depends on common and bus.
-disabled_drivers = get_option('disable_drivers').split(',')
+disabled_drivers = run_command(list_dir_globs, get_option('disable_drivers'),
+ ).stdout().split()
default_cflags = machine_args
if cc.has_argument('-Wno-format-truncation')