From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7E7B8456FF; Wed, 31 Jul 2024 11:18:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4DA6D42D7D; Wed, 31 Jul 2024 11:18:38 +0200 (CEST) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id 612D440668 for ; Wed, 31 Jul 2024 11:07:54 +0200 (CEST) Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4WYmR70fhtz6K60p; Wed, 31 Jul 2024 17:05:55 +0800 (CST) Received: from frapeml100007.china.huawei.com (unknown [7.182.85.133]) by mail.maildlp.com (Postfix) with ESMTPS id CE98614065C; Wed, 31 Jul 2024 17:07:52 +0800 (CST) Received: from frapeml500007.china.huawei.com (7.182.85.172) by frapeml100007.china.huawei.com (7.182.85.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 31 Jul 2024 11:07:52 +0200 Received: from frapeml500007.china.huawei.com ([7.182.85.172]) by frapeml500007.china.huawei.com ([7.182.85.172]) with mapi id 15.01.2507.039; Wed, 31 Jul 2024 11:07:52 +0200 From: Konstantin Ananyev To: Bruce Richardson , "dev@dpdk.org" CC: "anatoly.burakov@intel.com" Subject: RE: [PATCH] build: output a dependency log in build directory Thread-Topic: [PATCH] build: output a dependency log in build directory Thread-Index: AQHa4pCLrpQ4sE6FqUah/g2Kemh0RrIQjD/A Date: Wed, 31 Jul 2024 09:07:52 +0000 Message-ID: References: <20240730145508.551075-1-bruce.richardson@intel.com> In-Reply-To: <20240730145508.551075-1-bruce.richardson@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.48.153.218] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > As meson processes our DPDK source tree it manages dependencies > specified by each individual driver. To enable future analysis of the > dependency links between components, log the dependencies of each DPDK > component as it gets processed. This could potentially allow other tools > to automatically enable or disable components based on the desired end > components to be built, e.g. if the user requests net/ice, ensure that > common/iavf is also enabled in the drivers. >=20 > The output file produced is in "dot" or "graphviz" format, which allows > producing a graphical representation of the DPDK dependency tree if so > desired. For example: "dot -Tpng -O build/deps.dot" to produce the > image file "build/deps.dot.png". >=20 > Signed-off-by: Bruce Richardson I think it is a great idea. Acked-by: Konstantin Ananyev > --- > app/meson.build | 1 + > buildtools/log-deps.py | 43 ++++++++++++++++++++++++++++++++++++++++++ > buildtools/meson.build | 2 ++ > drivers/meson.build | 1 + > lib/meson.build | 1 + > 5 files changed, 48 insertions(+) > create mode 100644 buildtools/log-deps.py >=20 > diff --git a/app/meson.build b/app/meson.build > index 5b2c80c7a1..6afa457f4c 100644 > --- a/app/meson.build > +++ b/app/meson.build > @@ -76,6 +76,7 @@ foreach app:apps >=20 > if build > subdir(name) > + run_command([log_deps_cmd, name, deps]) > if not build and require_apps > error('Cannot build explicitly requested app "@0@".\n'.forma= t(name) > + '\tReason: ' + reason) > diff --git a/buildtools/log-deps.py b/buildtools/log-deps.py > new file mode 100644 > index 0000000000..a4331fa15b > --- /dev/null > +++ b/buildtools/log-deps.py > @@ -0,0 +1,43 @@ > +#! /usr/bin/env python3 > +# SPDX-License-Identifier: BSD-3-Clause > +# Copyright(c) 2024 Intel Corporation > + > +"""Utility script to build up a list of dependencies from meson.""" > + > +import os > +import sys > + > + > +def file_to_list(filename): > + """Read file into a list of strings.""" > + with open(filename) as f: > + return f.readlines() > + > + > +def list_to_file(filename, lines): > + """Write a list of strings out to a file.""" > + with open(filename, 'w') as f: > + f.writelines(lines) > + > + > +depsfile =3D f'{os.environ["MESON_BUILD_ROOT"]}/deps.dot' > + > +# to reset the deps file on each build, the script is called without any= params > +if len(sys.argv) =3D=3D 1: > + os.remove(depsfile) > + sys.exit(0) > + > +try: > + contents =3D file_to_list(depsfile) > +except FileNotFoundError: > + contents =3D ['digraph {\n', '}\n'] > + > +component =3D sys.argv[1] > +if len(sys.argv) > 2: > + contents[-1] =3D f'"{component}" -> {{ "{"\", \"".join(sys.argv[2:])= }" }}\n' > +else: > + contents[-1] =3D f'"{component}"\n' > + > +contents.append('}\n') > + > +list_to_file(depsfile, contents) > diff --git a/buildtools/meson.build b/buildtools/meson.build > index 3adf34e1a8..332f0f3d38 100644 > --- a/buildtools/meson.build > +++ b/buildtools/meson.build > @@ -24,6 +24,8 @@ get_numa_count_cmd =3D py3 + files('get-numa-count.py') > get_test_suites_cmd =3D py3 + files('get-test-suites.py') > has_hugepages_cmd =3D py3 + files('has-hugepages.py') > cmdline_gen_cmd =3D py3 + files('dpdk-cmdline-gen.py') > +log_deps_cmd =3D py3 + files('log-deps.py') > +run_command(log_deps_cmd) # call with no parameters to reset the file >=20 > # install any build tools that end-users might want also > install_data([ > diff --git a/drivers/meson.build b/drivers/meson.build > index 66931d4241..44935e067c 100644 > --- a/drivers/meson.build > +++ b/drivers/meson.build > @@ -154,6 +154,7 @@ foreach subpath:subdirs > if build > # pull in driver directory which should update all the local= variables > subdir(drv_path) > + run_command([log_deps_cmd, drv_path.underscorify(), deps]) >=20 > if dpdk_conf.get('RTE_IOVA_IN_MBUF') =3D=3D 0 and require_io= va_in_mbuf > build =3D false > diff --git a/lib/meson.build b/lib/meson.build > index 162287753f..da2815465f 100644 > --- a/lib/meson.build > +++ b/lib/meson.build > @@ -160,6 +160,7 @@ foreach l:libraries >=20 > if build > subdir(l) > + run_command([log_deps_cmd, l, deps]) > if not build and require_libs > error('Cannot build explicitly requested lib "@0@".\n'.forma= t(name) > +'\tReason: ' + reason) > -- > 2.43.0