All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Subject: [dpdk-dev] [RFC PATCH 1/3] build: add a dpdk-specific meson log file
Date: Thu, 22 Oct 2020 15:59:42 +0100	[thread overview]
Message-ID: <20201022145944.470054-2-bruce.richardson@intel.com> (raw)
In-Reply-To: <20201022145944.470054-1-bruce.richardson@intel.com>

While meson itself writes a log file of all the tests it runs and the
output of those, to help debug any build problems and provide more
developer information it can be helpful to have a logfile created and
controlled by the dpdk meson.build files themselves.

Since meson doesn't directly support this we need to use run_command to
implement it manually. Using a python script to do the writing of the log
makes things cross-platform, and as initial log entries we can add in the
messages about the defined internal dependencies, since these are of
developer interest only.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 buildtools/meson.build        |  1 +
 buildtools/write-log-entry.py | 23 +++++++++++++++++++++++
 drivers/meson.build           |  2 +-
 lib/meson.build               |  2 +-
 meson.build                   |  8 ++++++--
 5 files changed, 32 insertions(+), 4 deletions(-)
 create mode 100644 buildtools/write-log-entry.py

diff --git a/buildtools/meson.build b/buildtools/meson.build
index 04808dabc..35a8f4290 100644
--- a/buildtools/meson.build
+++ b/buildtools/meson.build
@@ -17,3 +17,4 @@ else
 endif
 map_to_win_cmd = py3 + files('map_to_win.py')
 sphinx_wrapper = py3 + files('call-sphinx-build.py')
+log = py3 + [files('write-log-entry.py'), 'dpdk-meson.log']
diff --git a/buildtools/write-log-entry.py b/buildtools/write-log-entry.py
new file mode 100644
index 000000000..6ec748a4f
--- /dev/null
+++ b/buildtools/write-log-entry.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2020 Intel Corporation
+
+from sys import argv, exit
+from time import strftime
+from os import environ
+from os.path import join as path_join
+
+if len(argv) < 2: # error if no filename
+    exit(1)
+if len(argv) < 3: # do nothing if no contents to log
+    exit(0)
+
+build_dir = environ.get('MESON_BUILD_ROOT', '.')
+filename = path_join(build_dir, argv[1])
+
+# append dates to headings
+if argv[2].startswith('===='):
+    argv.append(strftime('@@ %Y-%m-%d %X'))
+
+with open(filename, 'a') as log:
+    print(" ".join(argv[2:]), file=log)
diff --git a/drivers/meson.build b/drivers/meson.build
index a5a6fed06..c008abd4a 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -228,7 +228,7 @@ foreach subpath:subdirs
 			set_variable('shared_@0@'.format(lib_name), shared_dep)
 			set_variable('static_@0@'.format(lib_name), static_dep)
 			dependency_name = ''.join(lib_name.split('rte_'))
-			message('drivers/@0@: Defining dependency "@1@"'.format(
+			run_command(log, 'drivers/@0@: Defining dependency "@1@"'.format(
 					drv_path, dependency_name))
 		endif # build
 	endforeach
diff --git a/lib/meson.build b/lib/meson.build
index dd55b5cb5..2715c0f66 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -200,7 +200,7 @@ foreach l:libraries
 
 		set_variable('shared_rte_' + name, shared_dep)
 		set_variable('static_rte_' + name, static_dep)
-		message('lib/@0@: Defining dependency "@1@"'.format(
+		run_command(log, 'lib/@0@: Defining dependency "@1@"'.format(
 				dir_name, name))
 	endif # if build
 endforeach
diff --git a/meson.build b/meson.build
index 61d9a4f5f..ab950a2ce 100644
--- a/meson.build
+++ b/meson.build
@@ -11,6 +11,11 @@ project('DPDK', 'C',
 	meson_version: '>= 0.47.1'
 )
 
+# get tool paths and scripts
+subdir('buildtools')
+
+run_command(log, '======= Starting meson =======')
+
 # set up some global vars for compiler, platform, configuration, etc.
 cc = meson.get_compiler('c')
 dpdk_conf = configuration_data()
@@ -40,8 +45,7 @@ global_inc = include_directories('.', 'config',
 	'lib/librte_eal/@0@/include'.format(arch_subdir),
 )
 
-# do configuration and get tool paths
-subdir('buildtools')
+# do main build config
 subdir('config')
 
 # build libs and drivers
-- 
2.25.1


  reply	other threads:[~2020-10-22 15:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22 14:59 [dpdk-dev] [RFC PATCH 0/3] add custom logging to DPDK meson runs Bruce Richardson
2020-10-22 14:59 ` Bruce Richardson [this message]
2020-10-22 14:59 ` [dpdk-dev] [RFC PATCH 2/3] build: shorten top-level build file Bruce Richardson
2020-10-22 14:59 ` [dpdk-dev] [RFC PATCH 3/3] build: write messages to dpdk build log file Bruce Richardson
2021-09-15 16:23 ` [dpdk-dev] [RFC PATCH 0/3] add custom logging to DPDK meson runs Bruce Richardson
2021-09-17 13:36   ` Bruce Richardson

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=20201022145944.470054-2-bruce.richardson@intel.com \
    --to=bruce.richardson@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.