DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, robin.jarry@6wind.com, amo@semihalf.com,
	bluca@debian.org, Bruce Richardson <bruce.richardson@intel.com>
Subject: [dpdk-dev] [PATCH v5] build: allow using wildcards to disable drivers
Date: Mon, 27 Jan 2020 14:28:22 +0000
Message-ID: <20200127142822.23068-1-bruce.richardson@intel.com> (raw)
In-Reply-To: <20200120173725.57529-1-bruce.richardson@intel.com>

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>
Reviewed-by: Robin Jarry <robin.jarry@6wind.com>
Acked-by: Luca Boccassi <bluca@debian.org>
---
V5:
- add a couple of lines to the doc as an example of using this

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 +-
 doc/build-sdk-meson.txt      |  5 ++++-
 drivers/meson.build          |  3 ++-
 4 files changed, 26 insertions(+), 3 deletions(-)
 create mode 100755 buildtools/list-dir-globs.py

diff --git a/buildtools/list-dir-globs.py b/buildtools/list-dir-globs.py
new file mode 100755
index 000000000..80b5e801f
--- /dev/null
+++ b/buildtools/list-dir-globs.py
@@ -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))
diff --git a/buildtools/meson.build b/buildtools/meson.build
index cd1d05403..0f563d89a 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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
diff --git a/doc/build-sdk-meson.txt b/doc/build-sdk-meson.txt
index fc7fe37b5..319a19ef6 100644
--- a/doc/build-sdk-meson.txt
+++ b/doc/build-sdk-meson.txt
@@ -84,7 +84,10 @@ Project-specific options are passed used -Doption=value::
 
 	meson -Dmachine=default  # use builder-independent baseline -march
 
-Examples of setting the same options using meson configure::
+	meson -Ddisable_drivers=event/*,net/tap  # disable tap driver and all
+					# eventdev PMDs for a smaller build
+
+Examples of setting some of the same options using meson configure::
 
 	meson configure -Dwerror=true
 
diff --git a/drivers/meson.build b/drivers/meson.build
index 29708cc2b..3ee998d80 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -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')
-- 
2.20.1


  parent reply	other threads:[~2020-01-27 14:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-20 17:37 [dpdk-dev] [PATCH] " Bruce Richardson
2020-01-20 18:59 ` Thomas Monjalon
2020-01-21  9:11   ` Robin Jarry
2020-01-21 10:17     ` Bruce Richardson
2020-01-21 10:13   ` Bruce Richardson
2020-01-21 11:12 ` [dpdk-dev] [PATCH v2] " Bruce Richardson
2020-01-21 13:22   ` Robin Jarry
2020-01-21 13:37     ` Bruce Richardson
2020-01-21 13:48       ` Robin Jarry
2020-01-24 10:32 ` [dpdk-dev] [PATCH v3] " Bruce Richardson
2020-01-24 12:28   ` Robin Jarry
2020-01-24 14:57     ` Richardson, Bruce
2020-01-24 15:10 ` [dpdk-dev] [PATCH v4] " Bruce Richardson
2020-01-24 15:34   ` Robin Jarry
2020-01-27 11:26   ` Andrzej Ostruszka
2020-01-27 12:15     ` Bruce Richardson
2020-01-27 12:12   ` Luca Boccassi
2020-01-27 14:28 ` Bruce Richardson [this message]
2020-02-06  2:26   ` [dpdk-dev] [PATCH v5] " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200127142822.23068-1-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=amo@semihalf.com \
    --cc=bluca@debian.org \
    --cc=dev@dpdk.org \
    --cc=robin.jarry@6wind.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git