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 EE387A04DD; Tue, 21 Jan 2020 10:11:37 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 416AA2BF5; Tue, 21 Jan 2020 10:11:37 +0100 (CET) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 62471F72 for ; Tue, 21 Jan 2020 10:11:35 +0100 (CET) Received: by mail-wr1-f67.google.com with SMTP id w15so2270571wru.4 for ; Tue, 21 Jan 2020 01:11:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=fxMY2/5LHtutIyyNAaDX8dsBH41fTnQLrEsRUxKnzOI=; b=ZtGXc8tSjxuX7DMKP3NaCz0+3+a8dFozHP+zF6ojuhFy4vgzTUvhQO6L0Z995+82Az feP7NlLnK5sx+BYh9lBrfLuK921NFQDbHv2odSRBnt6Y/pjh4oDmunR5bGjk/MgSat51 o6Ma/Os35Q9X2nCYkX/g5laU++1jzqi7vpP7WVqABHc/iuaJNKnuQxJfvcvXyWWKs9xV 9NZSbPCuRC/T5fd+HYNPI4gNqP2UqatFuz8AYuRzpx6KbxoW7rUKBsIZLoAp28gV+EQu ffVDCRyWbMzZTygZc1PAr+AfxlDnweZ+iFz2baf4WR3m9g5oB2AS3dbn7VY4LZE4d8Hl Sh8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=fxMY2/5LHtutIyyNAaDX8dsBH41fTnQLrEsRUxKnzOI=; b=F9Fi4cdyhthZygeOqg5m4ItRh+ozqrFlWUusyqQrkW7+OqqPmMKVL+Q+YRX49F/raK T2ztxm24MPyNUZAZUJj0bltZKbVvWYUYUauiAeo/9FQAbgjfKsWEkiZ6D7EUPMFF0rHk 2DZ3IAv3D16K+/fadT1n0A68WaZPTWRb5YYIRaqiOvRchiYpUQmxKWvA8Slb21HMXIJy pin9hDnUFtNBvMt9nlgjmQ4rtlmG9Ww4+Da3wHKO3arWDaLlxmiwhdvRnaiIMmy7kv1Z 5MgUiJCi7h66YWa1JrxENmfTyHAF5kFjxNsaOQdS0xB4GDGyQbLaEOxcGCxpzhVX2GEt bTvA== X-Gm-Message-State: APjAAAWbo2ZJY2+9r4EnNxq47JoCHoY5REE+UlnRCAayBljukEbT7/2J eR/W2o0nMyBKlceK9beVK0GgDA== X-Google-Smtp-Source: APXvYqyaGGo/DDH6LBz+V+WWqgU6tLoq/R/eH2pcIxQWPhnidY6tPlFzJUIa00sqecGiSAQGrCTSdw== X-Received: by 2002:adf:ea42:: with SMTP id j2mr3929525wrn.270.1579597894919; Tue, 21 Jan 2020 01:11:34 -0800 (PST) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id u22sm54090646wru.30.2020.01.21.01.11.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2020 01:11:34 -0800 (PST) Date: Tue, 21 Jan 2020 10:11:33 +0100 From: Robin Jarry To: Thomas Monjalon Cc: Bruce Richardson , dev@dpdk.org Message-ID: <20200121091133.qfbdrlcnmbmzd7jq@6wind.com> References: <20200120173725.57529-1-bruce.richardson@intel.com> <2317106.JBEolbzBkm@xps> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2317106.JBEolbzBkm@xps> User-Agent: NeoMutt/20180716 Subject: Re: [dpdk-dev] [PATCH] 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" 2020-01-20, 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 > --- [snip] > +++ b/buildtools/list-dir-globs.sh > @@ -0,0 +1,15 @@ > +#! /usr/bin/env python > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright(c) 2020 Intel Corporation > + > +from __future__ import print_function > +from os import chdir, environ > +from sys import argv > +from glob import iglob # glob iterator > +from os.path import isdir, join > + > +chdir(join(environ['MESON_SOURCE_ROOT'], environ['MESON_SUBDIR'])) > +dirs = [] > +for path in argv[1].split(','): > + dirs.extend([entry for entry in iglob(path) if isdir(entry)]) I do not fancy changing the current directory in scripts. This can lead to unexpected behavior. You don't need to, you can achieve the same result with the following code: from __future__ import print_function import argparse import os import glob parser = argparse.ArgumentParser() parser.add_argument('disable_drivers', type=lambda s: s.split(',')) args = parser.parse_args() root = os.path.join(os.environ['MESON_SOURCE_ROOT'], os.environ['MESON_SUBDIR']) dirs = [] for driver in args.disable_drivers: driver_path = os.path.join(root, driver) for path in glob.iglob(driver_path): if os.path.isdir(path): dirs.append(os.path.relpath(path, root)) print(','.join(dirs)) I did not see why you used iglob instead of glob. iglob is case insensitive. Is that for windows support? > +++ 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().strip().split(',') Why adding commas again? Since you are processing the option value through a script, you might as well print one folder per line and use the .splitlines() meson function. It will make the code simpler as you do not need to use an intermediate list to store the disabled drivers before printing them. -- Robin