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 6E5F44571A; Fri, 2 Aug 2024 14:44:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 607BF42E68; Fri, 2 Aug 2024 14:44:30 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by mails.dpdk.org (Postfix) with ESMTP id 4512042E68 for ; Fri, 2 Aug 2024 14:44:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722602669; x=1754138669; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WarrK7xpoPedsoSqEKDvhif+/e3nGkTSZP5YXo75ibo=; b=EEbeWQaggMOVYDXi6uw4CXIelBrGCi+LUhetI/39pwf6gqAyFbJo+BD0 vbh672tz4xbzCQRjCZBpN7jMDpr+AnXGFhACkYmfwofpNXIlthtCAQ0n+ lg8ImVA5PDM4zBuaNEfhRMNKVGHCjWeU6lIBcAbRlFKbCRk6z2VB8yr+5 wHmuBNH3uS1U97rbqu831yzPtjiR19WAHXE/z/5vxZk8NZAB0gn1jrUcK hv7SaIOrvo3OIQ1zYILKguZoav8p33abGzYfbl5l6ejwqsCVhexP4PKZ8 kVsBHPwcnCBHWO1+LW+fgjhG+rbuiztuhK3cr1+YsiNv5ZcvpYzHtZmuL w==; X-CSE-ConnectionGUID: /EtZmIRkQ+SPq8EFWUxjrg== X-CSE-MsgGUID: HY0CAYYFRue7FlWqFBsYhg== X-IronPort-AV: E=McAfee;i="6700,10204,11152"; a="20499764" X-IronPort-AV: E=Sophos;i="6.09,257,1716274800"; d="scan'208";a="20499764" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2024 05:44:28 -0700 X-CSE-ConnectionGUID: WQf+3k1YRq+GGgjW45A2BA== X-CSE-MsgGUID: ysyS+HA1TTOoJdvDrXwHTg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,257,1716274800"; d="scan'208";a="56149890" Received: from silpixa00401385.ir.intel.com ([10.237.214.25]) by orviesa008.jf.intel.com with ESMTP; 02 Aug 2024 05:44:26 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: ferruh.yigit@amd.com, konstantin.ananyev@huawei.com, anatoly.burakov@intel.com, Bruce Richardson Subject: [PATCH v2 1/7] build: output a dependency log in build directory Date: Fri, 2 Aug 2024 13:44:05 +0100 Message-ID: <20240802124411.485430-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240802124411.485430-1-bruce.richardson@intel.com> References: <20240730145508.551075-1-bruce.richardson@intel.com> <20240802124411.485430-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. 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". Signed-off-by: Bruce Richardson 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 diff --git a/app/meson.build b/app/meson.build index 5b2c80c7a1..837a57ad0a 100644 --- a/app/meson.build +++ b/app/meson.build @@ -76,6 +76,7 @@ foreach app:apps if build subdir(name) + run_command([log_deps_cmd, 'dpdk-' + name, deps], check: false) if not build and require_apps error('Cannot build explicitly requested app "@0@".\n'.format(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 = 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) == 1: + os.remove(depsfile) + sys.exit(0) + +try: + contents = file_to_list(depsfile) +except FileNotFoundError: + contents = ['digraph {\n', '}\n'] + +component = sys.argv[1] +if len(sys.argv) > 2: + contents[-1] = f'"{component}" -> {{ "{"\", \"".join(sys.argv[2:])}" }}\n' +else: + contents[-1] = f'"{component}"\n' + +contents.append('}\n') + +list_to_file(depsfile, contents) diff --git a/buildtools/meson.build b/buildtools/meson.build index 3adf34e1a8..e2ba9d0ad4 100644 --- a/buildtools/meson.build +++ b/buildtools/meson.build @@ -24,6 +24,8 @@ get_numa_count_cmd = py3 + files('get-numa-count.py') get_test_suites_cmd = py3 + files('get-test-suites.py') has_hugepages_cmd = py3 + files('has-hugepages.py') cmdline_gen_cmd = py3 + files('dpdk-cmdline-gen.py') +log_deps_cmd = py3 + files('log-deps.py') +run_command(log_deps_cmd, check: false) # call with no parameters to reset the file # install any build tools that end-users might want also install_data([ diff --git a/drivers/meson.build b/drivers/meson.build index 66931d4241..d56308f1c1 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, class + '_' + name, deps], check: false) if dpdk_conf.get('RTE_IOVA_IN_MBUF') == 0 and require_iova_in_mbuf build = false diff --git a/lib/meson.build b/lib/meson.build index 162287753f..106c2a947c 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -160,6 +160,7 @@ foreach l:libraries if build subdir(l) + run_command([log_deps_cmd, l, deps], check: false) if not build and require_libs error('Cannot build explicitly requested lib "@0@".\n'.format(name) +'\tReason: ' + reason) -- 2.43.0