mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-11 17:52:00 +03:00
fix(bt): Normalize source paths for log compression pattern matching
This commit is contained in:
@@ -118,6 +118,12 @@ if(LOG_COMPRESSED_MODULE)
|
||||
string(REPLACE ";" "|" MODULE_CODE_PATH "${LOG_COMPRESSED_MODULE_CODE_PATH}")
|
||||
set(MATCH_PATTERN "(${MODULE_CODE_PATH}).+\\.c")
|
||||
foreach(src ${srcs})
|
||||
# Normalize absolute paths to relative paths (relative to CODE_BASE_PATH)
|
||||
# so that pattern matching works and .compressed_srcs/ has a clean layout
|
||||
if(IS_ABSOLUTE "${src}")
|
||||
get_filename_component(src "${src}" ABSOLUTE)
|
||||
file(RELATIVE_PATH src "${CODE_BASE_PATH}" "${src}")
|
||||
endif()
|
||||
if(src MATCHES ${MATCH_PATTERN})
|
||||
set(dest "${LOG_COMPRESSED_SRCS_DIR}/${src}")
|
||||
file(WRITE "${dest}" "")
|
||||
|
||||
@@ -663,9 +663,15 @@ class LogCompressor:
|
||||
compressed_file_cnt = 0
|
||||
total_cnt = 0
|
||||
for src in srcs:
|
||||
if pattern.match(src):
|
||||
src_path = self.code_base_path / src
|
||||
dest_path = self.bt_compressed_srcs_path / src
|
||||
# Convert absolute paths to relative (to code_base_path) for pattern matching
|
||||
src_for_match = src
|
||||
try:
|
||||
src_for_match = str(Path(src).relative_to(self.code_base_path))
|
||||
except ValueError:
|
||||
pass # Not under code_base_path, keep as-is
|
||||
if pattern.match(src_for_match):
|
||||
src_path = self.code_base_path / src_for_match
|
||||
dest_path = self.bt_compressed_srcs_path / src_for_match
|
||||
temp_path = f'{dest_path}.tmp'
|
||||
total_cnt += 1
|
||||
# Skip if already processed
|
||||
|
||||
Reference in New Issue
Block a user