[v2,2/2] examples: skip installing unbuildable examples

Message ID 20201111155647.1720787-2-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v2,1/2] examples: fix flattening directory layout on install |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-testing fail Testing issues
ci/Intel-compilation fail Compilation issues
ci/travis-robot success Travis build: passed
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Bruce Richardson Nov. 11, 2020, 3:56 p.m. UTC
  Rather than just installing all examples, we can use the build checks to
filter out any examples that are missing dependencies or are otherwise
unbuildable on the current system.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/meson.build | 54 +++++++++++++++++++++++++++-----------------
 meson.build          |  2 ++
 2 files changed, 35 insertions(+), 21 deletions(-)
  

Comments

Bruce Richardson Nov. 11, 2020, 5:33 p.m. UTC | #1
On Wed, Nov 11, 2020 at 03:56:47PM +0000, Bruce Richardson wrote:
> Rather than just installing all examples, we can use the build checks to
> filter out any examples that are missing dependencies or are otherwise
> unbuildable on the current system.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  examples/meson.build | 54 +++++++++++++++++++++++++++-----------------
>  meson.build          |  2 ++
>  2 files changed, 35 insertions(+), 21 deletions(-)
> 
This seems to have broken the windows builds because we now process all the
examples meson.build file, even if not asked to build them. l2fwd-keepalive
has a mandatory, unconditional dependency on librt, which needs to be made
optional.

Based on that, V3 pending...
  
David Marchand Nov. 12, 2020, 9:14 a.m. UTC | #2
On Wed, Nov 11, 2020 at 6:33 PM Bruce Richardson
<bruce.richardson@intel.com> wrote:
>
> On Wed, Nov 11, 2020 at 03:56:47PM +0000, Bruce Richardson wrote:
> > Rather than just installing all examples, we can use the build checks to
> > filter out any examples that are missing dependencies or are otherwise
> > unbuildable on the current system.
> >
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > ---
> >  examples/meson.build | 54 +++++++++++++++++++++++++++-----------------
> >  meson.build          |  2 ++
> >  2 files changed, 35 insertions(+), 21 deletions(-)
> >
> This seems to have broken the windows builds because we now process all the
> examples meson.build file, even if not asked to build them. l2fwd-keepalive
> has a mandatory, unconditional dependency on librt, which needs to be made
> optional.
>
> Based on that, V3 pending...

Strange, the v3 patches 2 and 3 linked to the v2 series.
As far as I can see, the lab only tested the v3 series with patches
84029 and 30, so the error on Windows is still reported.
  
Bruce Richardson Nov. 12, 2020, 9:24 a.m. UTC | #3
On Thu, Nov 12, 2020 at 10:14:23AM +0100, David Marchand wrote:
> On Wed, Nov 11, 2020 at 6:33 PM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> >
> > On Wed, Nov 11, 2020 at 03:56:47PM +0000, Bruce Richardson wrote:
> > > Rather than just installing all examples, we can use the build checks to
> > > filter out any examples that are missing dependencies or are otherwise
> > > unbuildable on the current system.
> > >
> > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > > ---
> > >  examples/meson.build | 54 +++++++++++++++++++++++++++-----------------
> > >  meson.build          |  2 ++
> > >  2 files changed, 35 insertions(+), 21 deletions(-)
> > >
> > This seems to have broken the windows builds because we now process all the
> > examples meson.build file, even if not asked to build them. l2fwd-keepalive
> > has a mandatory, unconditional dependency on librt, which needs to be made
> > optional.
> >
> > Based on that, V3 pending...
> 
> Strange, the v3 patches 2 and 3 linked to the v2 series.
> As far as I can see, the lab only tested the v3 series with patches
> 84029 and 30, so the error on Windows is still reported.
> 
> -- 
> David Marchand
> 
Yes, I see that in patchwork, and it's a bit strange. The emails seem
correctly threaded to me in my mail client though.

I'll resubmit as v4 with a cover letter to see if that allows the CI to run
properly.

/Bruce
  
David Marchand Nov. 12, 2020, 9:27 a.m. UTC | #4
On Thu, Nov 12, 2020 at 10:25 AM Bruce Richardson
<bruce.richardson@intel.com> wrote:
> > Strange, the v3 patches 2 and 3 linked to the v2 series.
> > As far as I can see, the lab only tested the v3 series with patches
> > 84029 and 30, so the error on Windows is still reported.
> >
> > --
> > David Marchand
> >
> Yes, I see that in patchwork, and it's a bit strange. The emails seem
> correctly threaded to me in my mail client though.

Yes, it looks correct to me too..

> I'll resubmit as v4 with a cover letter to see if that allows the CI to run
> properly.

I don't think the cover letter matters.. but let's see how it behaves.

Thanks Bruce.
  
Bruce Richardson Nov. 12, 2020, 9:35 a.m. UTC | #5
On Thu, Nov 12, 2020 at 10:27:09AM +0100, David Marchand wrote:
> On Thu, Nov 12, 2020 at 10:25 AM Bruce Richardson
> <bruce.richardson@intel.com> wrote:
> > > Strange, the v3 patches 2 and 3 linked to the v2 series.
> > > As far as I can see, the lab only tested the v3 series with patches
> > > 84029 and 30, so the error on Windows is still reported.
> > >
> > > --
> > > David Marchand
> > >
> > Yes, I see that in patchwork, and it's a bit strange. The emails seem
> > correctly threaded to me in my mail client though.
> 
> Yes, it looks correct to me too..
> 
> > I'll resubmit as v4 with a cover letter to see if that allows the CI to run
> > properly.
> 
> I don't think the cover letter matters.. but let's see how it behaves.
> 
It shouldn't matter, I agree, but I'm leaving nothing to chance on this :-)
  

Patch

diff --git a/examples/meson.build b/examples/meson.build
index 46ec80919e..9d268c9786 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -48,15 +48,11 @@  all_examples = [
 	'vmdq', 'vmdq_dcb',
 ]
 
-if get_option('examples') == ''
-	subdir_done()
-endif
-
 if get_option('examples').to_lower() == 'all'
-	examples = all_examples
+	requested_examples = all_examples
 	allow_skips = true # don't flag an error if we can't build an app
 else
-	examples = get_option('examples').split(',')
+	requested_examples = get_option('examples').split(',')
 	allow_skips = false # error out if we can't build a requested app
 endif
 default_cflags = machine_args
@@ -64,7 +60,9 @@  if cc.has_argument('-Wno-format-truncation')
 	default_cflags += '-Wno-format-truncation'
 endif
 
-foreach example: examples
+# iterate through all examples to see what we need to install
+# only actually build requested ones
+foreach example: all_examples
 	name = example.split('/')[-1]
 	build = true
 	sources = []
@@ -81,22 +79,36 @@  foreach example: examples
 		foreach d:deps
 			var_name = get_option('default_library') + '_rte_' + d
 			if not is_variable(var_name)
-				error('Missing dependency "@0@" for example "@1@"'.format(d, name))
+				message('Missing dependency "@0@" for example "@1@"'.format(d, name))
+				build = false
+			else
+				dep_objs += [get_variable(var_name)]
 			endif
-			dep_objs += [get_variable(var_name)]
 		endforeach
-		if allow_experimental_apis
-			cflags += '-DALLOW_EXPERIMENTAL_API'
+	endif # build
+
+	if not build
+		# exclude based on top-level directory only
+		dir = example.split('/')[0]
+		dpdk_examples_exclude += dir
+		message('Excluding example directory "@0@" from install'.format(dir))
+	endif
+
+	if requested_examples.contains(example)
+		if build
+			if allow_experimental_apis
+				cflags += '-DALLOW_EXPERIMENTAL_API'
+			endif
+			executable('dpdk-' + name, sources,
+				include_directories: includes,
+				link_whole: link_whole_libs,
+				link_args: dpdk_extra_ldflags,
+				c_args: cflags,
+				dependencies: dep_objs)
+		elif not allow_skips
+			error('Cannot build requested example "' + name + '"')
+		else
+			message('Skipping example "' + name + '"')
 		endif
-		executable('dpdk-' + name, sources,
-			include_directories: includes,
-			link_whole: link_whole_libs,
-			link_args: dpdk_extra_ldflags,
-			c_args: cflags,
-			dependencies: dep_objs)
-	elif not allow_skips
-		error('Cannot build requested example "' + name + '"')
-	else
-		message('Skipping example "' + name + '"')
 	endif
 endforeach
diff --git a/meson.build b/meson.build
index 45d974cd2c..559a9d2f1b 100644
--- a/meson.build
+++ b/meson.build
@@ -58,9 +58,11 @@  subdir('doc')
 
 # build any examples explicitly requested - useful for developers - and
 # install any example code into the appropriate install path
+dpdk_examples_exclude = []
 subdir('examples')
 install_subdir('examples',
 	install_dir: get_option('datadir') + '/dpdk',
+	exclude_directories: dpdk_examples_exclude,
 	exclude_files: 'meson.build')
 
 # build kernel modules if enabled