From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 88E4EA034F;
	Fri,  7 May 2021 13:54:21 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 086094013F;
	Fri,  7 May 2021 13:54:21 +0200 (CEST)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [216.205.24.124])
 by mails.dpdk.org (Postfix) with ESMTP id A103540040
 for <dev@dpdk.org>; Fri,  7 May 2021 13:54:19 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1620388458;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=CeBQOmt6lsSwPJrWxxMfdlrzH6ANwFA1lZn3GIiln0w=;
 b=PkGqKeFGFzI2hmld5QBOo6q1S2HIPGc/scUUpmM5pzk2YO64rPr5D4A8JgNMUu6xZvjM5h
 z3oD6XS9SjP/usf2+Z2XxBOt27HlL7Hw7Lmv8BQZZ1HqYJyT4FECwKjH3uKsgMmOdas6qk
 T+ul16CYt9OJRDXBgBgdzm+SGMMxV1w=
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
 [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-297-nYIalWooPrm7dqUP3c5S9g-1; Fri, 07 May 2021 07:54:16 -0400
X-MC-Unique: nYIalWooPrm7dqUP3c5S9g-1
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com
 [10.5.11.16])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 902EC18B9EC3;
 Fri,  7 May 2021 11:54:14 +0000 (UTC)
Received: from dmarchan.remote.csb (unknown [10.40.192.60])
 by smtp.corp.redhat.com (Postfix) with ESMTP id AD4175C1C5;
 Fri,  7 May 2021 11:54:11 +0000 (UTC)
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
 Robin Jarry <robin.jarry@6wind.com>, Luca Boccassi <bluca@debian.org>,
 =?UTF-8?q?Juraj=20Linke=C5=A1?= <juraj.linkes@pantheon.tech>,
 Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,
 Ruifeng Wang <ruifeng.wang@arm.com>
Date: Fri,  7 May 2021 13:54:04 +0200
Message-Id: <20210507115404.19828-1-david.marchand@redhat.com>
In-Reply-To: <20210507092158.12284-1-david.marchand@redhat.com>
References: <20210507092158.12284-1-david.marchand@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16
Authentication-Results: relay.mimecast.com;
 auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="US-ASCII"
Subject: [dpdk-dev] [PATCH v2] build: fix drivers config with no python
 interpreter
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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: ab9407c3addd ("build: allow using wildcards to disable drivers")
Fixes: 2e33309ebe03 ("config: enable/disable drivers in Arm builds")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 buildtools/meson.build | 2 +-
 drivers/meson.build    | 6 +++---
 lib/meson.build        | 3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/buildtools/meson.build b/buildtools/meson.build
index c520896b4b..df94782bdc 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -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')
@@ -16,6 +15,7 @@ else
 endif
 map_to_win_cmd = py3 + files('map_to_win.py')
 sphinx_wrapper = py3 + files('call-sphinx-build.py')
+list_dir_globs = py3 + files('list-dir-globs.py')
 
 # select library and object file format
 pmdinfo = py3 + files('gen-pmdinfo-cfile.py') + [meson.current_build_dir()]
diff --git a/drivers/meson.build b/drivers/meson.build
index b78cac3897..0052247a55 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -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
diff --git a/lib/meson.build b/lib/meson.build
index 77f363a516..a4fb0dbdd4 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -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))
-- 
2.23.0