From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C8BEFA0531; Fri, 24 Jan 2020 11:36:06 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8F8123576; Fri, 24 Jan 2020 11:36:05 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 5AC2C2BD5 for ; Fri, 24 Jan 2020 11:36:03 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jan 2020 02:36:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,357,1574150400"; d="scan'208";a="251254141" Received: from silpixa00399126.ir.intel.com ([10.237.222.218]) by fmsmga004.fm.intel.com with ESMTP; 24 Jan 2020 02:36:00 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: thomas@monjalon.net, robin.jarry@6wind.com, Bruce Richardson Date: Fri, 24 Jan 2020 10:32:57 +0000 Message-Id: <20200124103257.44092-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200120173725.57529-1-bruce.richardson@intel.com> References: <20200120173725.57529-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3] build: allow using wildcards to disable drivers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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 | 21 +++++++++++++++++++++ buildtools/meson.build | 2 +- drivers/meson.build | 3 ++- 3 files changed, 24 insertions(+), 2 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..b9a536869 --- /dev/null +++ b/buildtools/list-dir-globs.py @@ -0,0 +1,21 @@ +#! /usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Intel Corporation + +import sys +import os +from glob import iglob +from os.path import join, relpath, isdir + +if len(sys.argv) != 2: + print("Usage: {0} [,[,...]]".format(sys.argv[0])) + sys.exit(1) + +root = '.' +if 'MESON_SOURCE_ROOT' in os.environ and 'MESON_SUBDIR' in os.environ: + root = join(os.environ['MESON_SOURCE_ROOT'], os.environ['MESON_SUBDIR']) + +for path in sys.argv[1].split(','): + for p in iglob(join(root, path)): + if isdir(p): + print(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/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