mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 03:35:32 -04:00
scripts/tags.sh: Add support for rust source files
When executing the command `make cscope`, the `cscope.files` file generated by it includes only filenames with the extensions *.h, *.c, *.S and not includes filenames with *.rs extensions. To fix this, modify the functions `find_arch_sources()`, `find_arch_include_sources()`, `find_include_sources()`, and `find_other_sources()` so that they can accept an unlimited number of filename patterns as parameters for the search. Add the `setup_name_pattern()` function to convert these filename pattern parameters into a list of parameters that can be passed to the `find` utility via the new `pattern` variable. Signed-off-by: Sergei Litvin <litvindev@gmail.com> Acked-by: Miguel Ojeda <ojeda@kernel.org> Tested-by: Nicolas Schier <n.schier@fritz.com> Reviewed-by: Nicolas Schier <n.schier@fritz.com> Link: https://patch.msgid.link/20260714125259.78824-1-litvindev@gmail.com [nsc: cleaned-up commit message line breaks and removed cc trailers] Signed-off-by: Nicolas Schier <nsc@kernel.org>
This commit is contained in:
committed by
Nicolas Schier
parent
a9b93c3462
commit
2ca47eed70
@@ -46,13 +46,31 @@ elif [ "${ALLSOURCE_ARCHS}" = "all" ]; then
|
||||
ALLSOURCE_ARCHS=$(find ${tree}arch/ -mindepth 1 -maxdepth 1 -type d -printf '%f ')
|
||||
fi
|
||||
|
||||
setup_name_pattern()
|
||||
{
|
||||
pattern=()
|
||||
for ext; do
|
||||
if [ ${#pattern[@]} -gt 0 ]; then
|
||||
pattern+=("-o" "-name" "$ext")
|
||||
else
|
||||
pattern+=("(" "-name" "$ext")
|
||||
fi
|
||||
done
|
||||
if [ ${#pattern[@]} -gt 0 ]; then
|
||||
pattern+=(")")
|
||||
fi
|
||||
}
|
||||
|
||||
# find sources in arch/$1
|
||||
find_arch_sources()
|
||||
{
|
||||
for i in $archincludedir; do
|
||||
local prune="$prune ( -path $i ) -prune -o"
|
||||
done
|
||||
find ${tree}arch/$1 $ignore $prune -name "$2" -not -type l -print;
|
||||
local src=${tree}arch/$1
|
||||
shift
|
||||
setup_name_pattern "$@"
|
||||
find $src $ignore $prune "${pattern[@]}" -not -type l -print;
|
||||
}
|
||||
|
||||
# find sources in arch/$1/include
|
||||
@@ -61,14 +79,17 @@ find_arch_include_sources()
|
||||
local include=$(find ${tree}arch/$1/ -name include -type d -print);
|
||||
if [ -n "$include" ]; then
|
||||
archincludedir="$archincludedir $include"
|
||||
find $include $ignore -name "$2" -not -type l -print;
|
||||
shift
|
||||
setup_name_pattern "$@"
|
||||
find $include $ignore "${pattern[@]}" -not -type l -print;
|
||||
fi
|
||||
}
|
||||
|
||||
# find sources in include/
|
||||
find_include_sources()
|
||||
{
|
||||
find ${tree}include $ignore -name config -prune -o -name "$1" \
|
||||
setup_name_pattern "$@"
|
||||
find ${tree}include $ignore -name config -prune -o "${pattern[@]}" \
|
||||
-not -type l -print;
|
||||
}
|
||||
|
||||
@@ -76,23 +97,24 @@ find_include_sources()
|
||||
# we could benefit from a list of dirs to search in here
|
||||
find_other_sources()
|
||||
{
|
||||
setup_name_pattern "$@"
|
||||
find ${tree}* $ignore \
|
||||
\( -path ${tree}include -o -path ${tree}arch -o -name '.tmp_*' \) -prune -o \
|
||||
-name "$1" -not -type l -print;
|
||||
"${pattern[@]}" -not -type l -print;
|
||||
}
|
||||
|
||||
all_sources()
|
||||
{
|
||||
find_arch_include_sources ${SRCARCH} '*.[chS]'
|
||||
find_arch_include_sources ${SRCARCH} '*.[chS]' '*.rs'
|
||||
if [ -n "$archinclude" ]; then
|
||||
find_arch_include_sources $archinclude '*.[chS]'
|
||||
find_arch_include_sources $archinclude '*.[chS]' '*.rs'
|
||||
fi
|
||||
find_include_sources '*.[chS]'
|
||||
find_include_sources '*.[chS]' '*.rs'
|
||||
for arch in $ALLSOURCE_ARCHS
|
||||
do
|
||||
find_arch_sources $arch '*.[chS]'
|
||||
find_arch_sources $arch '*.[chS]' '*.rs'
|
||||
done
|
||||
find_other_sources '*.[chS]'
|
||||
find_other_sources '*.[chS]' '*.rs'
|
||||
}
|
||||
|
||||
all_compiled_sources()
|
||||
|
||||
Reference in New Issue
Block a user