From 7313d8c70492da69cd0dd89d78701cfcf699db06 Mon Sep 17 00:00:00 2001 From: Vincent-Dalstra <51883563+Vincent-Dalstra@users.noreply.github.com> Date: Wed, 17 Sep 2025 14:48:39 +0800 Subject: [PATCH 1/3] fix: Add quotes around node ID in dependency graph Graphviz node ID's are represented as strings, that can only use a restricted set of characters (characters, digits, and underscores), and must not match a reserved keyword. These restrictions do not apply when the string is wrapped in double quotes. This allows for component names with dashes in them, for example. Closes https://github.com/espressif/esp-idf/pull/17594 --- tools/cmake/depgraph.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/cmake/depgraph.cmake b/tools/cmake/depgraph.cmake index fc312db7ad..9e80666265 100644 --- a/tools/cmake/depgraph.cmake +++ b/tools/cmake/depgraph.cmake @@ -35,10 +35,10 @@ function(depgraph_add_edge dep_from dep_to) # However, show which components are "common" by adding an edge from a node named "common". # If necessary, add a new build property to customize this behavior. if(NOT dep_from IN_LIST common_reqs) - idf_build_set_property(__BUILD_COMPONENT_DEPGRAPH "common -> ${dep_to}" APPEND) + idf_build_set_property(__BUILD_COMPONENT_DEPGRAPH "\"common\" -> \"${dep_to}\"" APPEND) endif() else() - idf_build_set_property(__BUILD_COMPONENT_DEPGRAPH "${dep_from} -> ${dep_to} ${attr}" APPEND) + idf_build_set_property(__BUILD_COMPONENT_DEPGRAPH "\"${dep_from}\" -> \"${dep_to}\" ${attr}" APPEND) endif() endfunction() From 66bdf5b54d0369462da2192c8e0f1488d45be45e Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Tue, 23 Sep 2025 08:40:14 +0200 Subject: [PATCH 2/3] fix(test_apps): reflect changes in component_deps.dot in the g1_components test The commit 51f3c021158d ("Add quotes around node ID in dependency graph") introduced proper quoting for node IDs in the generated dot file. Since the dot format does not allow dashes in node names without quoting, and dashes are used in component names, the component names in the generated dot file are now correctly quoted. Adjust the g1_components test to accommodate this change by stripping the quotes. Signed-off-by: Frantisek Hrbata --- tools/test_apps/system/g1_components/check_dependencies.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test_apps/system/g1_components/check_dependencies.py b/tools/test_apps/system/g1_components/check_dependencies.py index 3f0e8e7c1b..08a7f310f2 100644 --- a/tools/test_apps/system/g1_components/check_dependencies.py +++ b/tools/test_apps/system/g1_components/check_dependencies.py @@ -26,8 +26,8 @@ def parse_dependencies(file_path: str) -> Tuple[Dict[str, List[str]], List[str]] parts = line.split(' -> ') if (len(parts) >= 2): - source = parts[0] - target = parts[1].split()[0] # Extracting the target component + source = parts[0].strip('"') + target = parts[1].split()[0].strip('"') # Extracting the target component logging.debug(f'Parsed dependency: {source} -> {target}') # Check that g1/g0 dependencies are either on the list of expected violations From 52724f4ce2f3e8c83270110ef867d82623a6701f Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Mon, 13 Oct 2025 15:12:44 +0200 Subject: [PATCH 3/3] fix(tools): check_dependencies.py ruff formatting Signed-off-by: Frantisek Hrbata --- .../g1_components/check_dependencies.py | 37 ++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/tools/test_apps/system/g1_components/check_dependencies.py b/tools/test_apps/system/g1_components/check_dependencies.py index 08a7f310f2..7ff34ca5ef 100644 --- a/tools/test_apps/system/g1_components/check_dependencies.py +++ b/tools/test_apps/system/g1_components/check_dependencies.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Unlicense OR CC0-1.0 import argparse import logging @@ -6,13 +6,30 @@ from typing import Dict from typing import List from typing import Tuple -g1_g0_components = ['hal', 'cxx', 'newlib', 'freertos', 'esp_hw_support', 'heap', 'log', 'soc', 'esp_rom', - 'esp_common', 'esp_system', 'xtensa', 'riscv', 'spi_flash', 'esp_mm'] +g1_g0_components = [ + 'hal', + 'cxx', + 'newlib', + 'freertos', + 'esp_hw_support', + 'heap', + 'log', + 'soc', + 'esp_rom', + 'esp_common', + 'esp_system', + 'xtensa', + 'riscv', + 'spi_flash', + 'esp_mm', +] -expected_dep_violations = {'esp_system': ['esp_timer', 'bootloader_support', 'esp_pm'], - 'spi_flash': ['bootloader_support', 'app_update', 'esp_driver_gpio'], - 'esp_hw_support': ['efuse', 'bootloader_support', 'esp_driver_gpio', 'esp_timer', 'esp_pm', 'esp_security'], - 'cxx': ['pthread']} +expected_dep_violations = { + 'esp_system': ['esp_timer', 'bootloader_support', 'esp_pm'], + 'spi_flash': ['bootloader_support', 'app_update', 'esp_driver_gpio'], + 'esp_hw_support': ['efuse', 'bootloader_support', 'esp_driver_gpio', 'esp_timer', 'esp_pm', 'esp_security'], + 'cxx': ['pthread'], +} def parse_dependencies(file_path: str) -> Tuple[Dict[str, List[str]], List[str]]: @@ -25,7 +42,7 @@ def parse_dependencies(file_path: str) -> Tuple[Dict[str, List[str]], List[str]] if line: parts = line.split(' -> ') - if (len(parts) >= 2): + if len(parts) >= 2: source = parts[0].strip('"') target = parts[1].split()[0].strip('"') # Extracting the target component logging.debug(f'Parsed dependency: {source} -> {target}') @@ -48,7 +65,9 @@ def parse_dependencies(file_path: str) -> Tuple[Dict[str, List[str]], List[str]] if __name__ == '__main__': parser = argparse.ArgumentParser(description='Check G1 dependencies') - parser.add_argument('--component_deps_file', required=True, type=str, help='The path to the component_deps.dot file') + parser.add_argument( + '--component_deps_file', required=True, type=str, help='The path to the component_deps.dot file' + ) args = parser.parse_args()