startup.tcl: extend the file search among rename

The renaming of boards and targets is often requiring the simple
replacement of '_' with '-'.
To avoid listing such replacements in 'tcl/file_renaming.cfg', add
the automatic check in 'proc find' allowing till two replacements
of '_' with '-'.

Change-Id: I2623ea78d9c61d86189afcae2553c2910bda8389
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9278
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Nishanth Menon <nm@ti.com>
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2025-11-30 09:25:48 +01:00
parent f8501461c1
commit 5b4557c6f2

View File

@@ -31,23 +31,39 @@ proc find {filename} {
# - path/to/a/certain/vendor_config_file
# - path/to/a/certain/vendor-config_file
# replaced with
# replaced either with
# - path/to/a/certain/vendor/config_file
# or
# - path/to/a/certain/vendor/config-file
regsub {([/\\])([^/\\_-]*)[_-]([^/\\]*$)} $filename "\\1\\2\\1\\3" f
if {[catch {_find_internal $f} t]==0} {
echo "WARNING: '$filename' is deprecated, use '$f' instead"
return $t
}
regsub {([/\\])([^/\\_]*)_([^/\\]*$)} $f "\\1\\2-\\3" f
regsub {([/\\])([^/\\_]*)_([^/\\]*$)} $f "\\1\\2-\\3" f
if {[catch {_find_internal $f} t]==0} {
echo "WARNING: '$filename' is deprecated, use '$f' instead"
return $t
}
foreach vendor {nordic ti sifive st} {
# - path/to/a/certain/config_file
# replaced with
# replaced either with
# - path/to/a/certain/${vendor}/config_file
# or
# - path/to/a/certain/${vendor}/config-file
regsub {([/\\])([^/\\]*$)} $filename "\\1$vendor\\1\\2" f
if {[catch {_find_internal $f} t]==0} {
echo "WARNING: '$filename' is deprecated, use '$f' instead"
return $t
}
regsub {([/\\])([^/\\_]*)_([^/\\]*$)} $f "\\1\\2-\\3" f
regsub {([/\\])([^/\\_]*)_([^/\\]*$)} $f "\\1\\2-\\3" f
if {[catch {_find_internal $f} t]==0} {
echo "WARNING: '$filename' is deprecated, use '$f' instead"
return $t
}
}
# at last, check for explicit renaming