forked from auracaster/openocd
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user