DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
	Anatoly Burakov <anatoly.burakov@intel.com>
Subject: [PATCH 2/2] build: fail if explicitly requested driver is unbuildable
Date: Fri,  1 Sep 2023 15:23:32 +0100	[thread overview]
Message-ID: <20230901142332.588856-2-bruce.richardson@intel.com> (raw)
In-Reply-To: <20230901142332.588856-1-bruce.richardson@intel.com>

When the user passes a list of desired drivers to build via the
"enable_drivers" option, the expectation is that those drivers should be
part of the build. However, if those drivers have either external or
internal dependencies, they still may be silently disabled, for example:
running "meson setup -Denable_drivers=net/iavf build" will successfully
run, but the iavf net driver will not be configured as "common/iavf" is
missing.

We can fix this by setting a flag to indicate when the drivers are
specified via an enable_drivers flag. However, unlike when erroring out
on missing libs, we don't error out if a driver in unbuildable, unless
the driver name explicitly appears in the "enable_drivers" list. This is
implemented this way to ensure that wildcarding still works. For
example: we still want to allow "meson setup -Denable_drivers=net/*" to
work, configuring only the buildable network drivers. While it's true
that this additional restriction may cause some builds to pass when they
should fail, e.g. if the wildcard refers only to a single driver,
implementing things this way avoids massive amounts of complexity, and
is still an improvement on the status-quo.

Suggested-by: Anatoly Burakov <anatoly.burakov@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/meson.build | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/meson.build b/drivers/meson.build
index 417b64b8fc..8c775bbe62 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -41,7 +41,9 @@ disable_drivers = run_command(list_dir_globs, disable_drivers, check: true).stdo
 # add cmdline enabled drivers and meson enabled drivers together
 enable_drivers = ',' + get_option('enable_drivers')
 enable_drivers = run_command(list_dir_globs, enable_drivers, check: true).stdout().split()
+require_drivers = true
 if enable_drivers.length() == 0
+    require_drivers = false
     enable_drivers = run_command(list_dir_globs, '*/*', check: true).stdout().split()
 endif
 
@@ -155,6 +157,12 @@ foreach subpath:subdirs
                 build = false
                 reason = 'requires IOVA in mbuf (set enable_iova_as_pa option)'
             endif
+            # error out if we can't build a driver and that driver was explicitly requested,
+            # i.e. not via wildcard.
+            if not build and require_drivers and get_option('enable_drivers').contains(drv_path)
+                error('Cannot build explicitly requested driver "@0@".\n'.format(drv_path)
+                        +'\tReason: ' + reason)
+            endif
 
             # get dependency objs from strings
             shared_deps = ext_deps
@@ -171,6 +179,12 @@ foreach subpath:subdirs
                     endif
                     message('Disabling @1@ [@2@]: missing internal dependency "@0@"'
                             .format(d, name, 'drivers/' + drv_path))
+                    # error out if we can't build a driver and that driver was explicitly
+                    # requested, i.e. not via wildcard.
+                    if require_drivers and get_option('enable_drivers').contains(drv_path)
+                        error('Cannot build explicitly requested driver "@0@".\n'.format(drv_path)
+                                +'\tPlease enable missing dependency "@0@"'.format(d))
+                    endif
                 else
                     shared_deps += [get_variable('shared_rte_' + d)]
                     static_deps += [get_variable('static_rte_' + d)]
-- 
2.39.2


  reply	other threads:[~2023-09-01 14:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01 14:23 [PATCH 1/2] build: fail if explicitly requested lib " Bruce Richardson
2023-09-01 14:23 ` Bruce Richardson [this message]
2023-09-01 15:41   ` [PATCH 2/2] build: fail if explicitly requested driver " Morten Brørup
2023-09-02 17:24     ` Patrick Robb
2023-09-14  9:42       ` Bruce Richardson
2023-09-01 14:29 ` [PATCH 1/2] build: fail if explicitly requested lib " David Marchand
2023-09-01 14:30   ` David Marchand
2023-09-01 14:44     ` Bruce Richardson
2023-09-04 13:38       ` David Marchand
2023-09-01 15:40 ` Morten Brørup
2023-09-14  9:53 ` Bruce Richardson
2023-09-19 15:57 ` Bruce Richardson
2023-09-21  7:01 ` David Marchand

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=20230901142332.588856-2-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).