[v2] build: check drivers class dependencies early

Message ID 20230801134133.2860104-1-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [v2] build: check drivers class dependencies early |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS

Commit Message

David Marchand Aug. 1, 2023, 1:41 p.m. UTC
  Drivers implementing a class of devices (for example, drivers/event)
depend on the associated abstraction library (lib/eventdev).
This dependency is expressed in the top level meson.build for this class
(drivers/event/meson.build).

As we are making more libraries optional, custom constructs referencing
the class dependencies in some drivers meson.build (event/dlb2) may break.

It would be possible to add more checks in those drivers meson.build but
it is more straightforward to not even consider a driver meson.build when
the class dependencies are not met.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
Changes since v1:
- added break on the first missing dependency,
- added logs for disabled drivers,

---
 drivers/meson.build | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
  

Comments

Bruce Richardson Aug. 1, 2023, 2:01 p.m. UTC | #1
On Tue, Aug 01, 2023 at 03:41:33PM +0200, David Marchand wrote:
> Drivers implementing a class of devices (for example, drivers/event)
> depend on the associated abstraction library (lib/eventdev).
> This dependency is expressed in the top level meson.build for this class
> (drivers/event/meson.build).
> 
> As we are making more libraries optional, custom constructs referencing
> the class dependencies in some drivers meson.build (event/dlb2) may break.
> 
> It would be possible to add more checks in those drivers meson.build but
> it is more straightforward to not even consider a driver meson.build when
> the class dependencies are not met.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  
Tyler Retzlaff Aug. 2, 2023, 4:11 p.m. UTC | #2
On Tue, Aug 01, 2023 at 03:01:31PM +0100, Bruce Richardson wrote:
> On Tue, Aug 01, 2023 at 03:41:33PM +0200, David Marchand wrote:
> > Drivers implementing a class of devices (for example, drivers/event)
> > depend on the associated abstraction library (lib/eventdev).
> > This dependency is expressed in the top level meson.build for this class
> > (drivers/event/meson.build).
> > 
> > As we are making more libraries optional, custom constructs referencing
> > the class dependencies in some drivers meson.build (event/dlb2) may break.
> > 
> > It would be possible to add more checks in those drivers meson.build but
> > it is more straightforward to not even consider a driver meson.build when
> > the class dependencies are not met.
> > 
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
  
David Marchand Aug. 8, 2023, 7:43 a.m. UTC | #3
On Tue, Aug 1, 2023 at 3:41 PM David Marchand <david.marchand@redhat.com> wrote:
>
> Drivers implementing a class of devices (for example, drivers/event)
> depend on the associated abstraction library (lib/eventdev).
> This dependency is expressed in the top level meson.build for this class
> (drivers/event/meson.build).
>
> As we are making more libraries optional, custom constructs referencing
> the class dependencies in some drivers meson.build (event/dlb2) may break.
>
> It would be possible to add more checks in those drivers meson.build but
> it is more straightforward to not even consider a driver meson.build when
> the class dependencies are not met.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>

Applied, thanks.

Bruce, could you rebase your series marking more libraries optional?
There is some conflicts after removal of kni/flow_classify, and adding
a unit test (perf reasm).
  
Bruce Richardson Aug. 8, 2023, 8:07 a.m. UTC | #4
On Tue, Aug 08, 2023 at 09:43:25AM +0200, David Marchand wrote:
> On Tue, Aug 1, 2023 at 3:41 PM David Marchand <david.marchand@redhat.com> wrote:
> >
> > Drivers implementing a class of devices (for example, drivers/event)
> > depend on the associated abstraction library (lib/eventdev).
> > This dependency is expressed in the top level meson.build for this class
> > (drivers/event/meson.build).
> >
> > As we are making more libraries optional, custom constructs referencing
> > the class dependencies in some drivers meson.build (event/dlb2) may break.
> >
> > It would be possible to add more checks in those drivers meson.build but
> > it is more straightforward to not even consider a driver meson.build when
> > the class dependencies are not met.
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> 
> Applied, thanks.
> 
> Bruce, could you rebase your series marking more libraries optional?
> There is some conflicts after removal of kni/flow_classify, and adding
> a unit test (perf reasm).
>
Yes, I plan to do so. However, I think I'd rather defer that set until
after the set reworking the build of the tests completely. It makes
everything a lot simpler in that regard. In fact, I may merge the two sets
into one.

/Bruce
  

Patch

diff --git a/drivers/meson.build b/drivers/meson.build
index 74ae8cb96b..c909070c30 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -70,6 +70,25 @@  foreach subpath:subdirs
     else
         class = subpath
         subdir(class)
+        skip_class = false
+        foreach d:std_deps
+            if not is_variable('shared_rte_' + d)
+                skip_class = true
+                reason = 'missing internal dependency, "@0@"'.format(d)
+                if dpdk_libs_deprecated.contains(d)
+                    reason += ' (deprecated lib)'
+                endif
+                message('Disabling @1@/* drivers: missing internal dependency "@0@"'
+                        .format(d, class))
+                break
+            endif
+        endforeach
+        if skip_class
+            drv_path = join_paths(class, '*')
+            dpdk_drvs_disabled += drv_path
+            set_variable(drv_path.underscorify() + '_disable_reason', reason)
+            continue
+        endif
     endif
 
     # save class name on first occurrence