[dpdk-dev] [PATCH 2/4] examples: simplify getting list of all examples

Bruce Richardson bruce.richardson at intel.com
Wed Apr 24 00:06:42 CEST 2019


Using find rather than shelling out to a one-liner script is easier to
read and understand, as well as allowing shorter lines in the code.

Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
 examples/meson.build | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/examples/meson.build b/examples/meson.build
index 1a6134f12..19f2686b2 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -8,8 +8,9 @@ endif
 
 execinfo = cc.find_library('execinfo', required: false)
 
-all_examples = run_command('sh', '-c',
-	'cd $MESON_SOURCE_ROOT/$MESON_SUBDIR && for d in * ; do if [ -d $d ] ; then echo $d ; fi ; done'
+all_examples = run_command('find', meson.current_source_dir(),
+	'-maxdepth', '1', '-mindepth', '1',
+	'-type', 'd', '-printf', '%f '
 	).stdout().split()
 # install all example code on install - irrespective of whether the example in
 # question is to be built as part of this build or not.
-- 
2.20.1



More information about the dev mailing list