2023-12-29 03:07:12

by Wei Yang

[permalink] [raw]
Subject: [PATCH 1/4] scripts/tags.sh: use more portable -path instead of -wholename

According to the manual, -path is more portable than -wholename. Also
for consistency, let's use -path here.

Signed-off-by: Wei Yang <[email protected]>
CC: Guennadi Liakhovetski <[email protected]>
CC: WANG Cong <[email protected]>
CC: Michal Marek <[email protected]>

merg
---
scripts/tags.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/tags.sh b/scripts/tags.sh
index a70d43723146..fbae1a087ee1 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -50,7 +50,7 @@ fi
find_arch_sources()
{
for i in $archincludedir; do
- prune="$prune -wholename $i -prune -o"
+ prune="$prune ( -path $i ) -prune -o"
done
find ${tree}arch/$1 $ignore $prune -name "$2" -not -type l -print;
}
--
2.34.1



2023-12-29 03:07:25

by Wei Yang

[permalink] [raw]
Subject: [PATCH 2/4] scripts/tags.sh: add local annotation

Commit 'f81b1be40c44 tags: include headers before source files'
introduce two local variables.

Let's add local annotation to make it obvious.

Signed-off-by: Wei Yang <[email protected]>
---
scripts/tags.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/tags.sh b/scripts/tags.sh
index fbae1a087ee1..83e3731b5bdf 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -50,7 +50,7 @@ fi
find_arch_sources()
{
for i in $archincludedir; do
- prune="$prune ( -path $i ) -prune -o"
+ local prune="$prune ( -path $i ) -prune -o"
done
find ${tree}arch/$1 $ignore $prune -name "$2" -not -type l -print;
}
@@ -58,7 +58,7 @@ find_arch_sources()
# find sources in arch/$1/include
find_arch_include_sources()
{
- include=$(find ${tree}arch/$1/ -name include -type d -print);
+ 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;
--
2.34.1


2023-12-29 03:07:40

by Wei Yang

[permalink] [raw]
Subject: [PATCH 3/4] scripts/tags.sh: use -n to test archinclude

In bash, "! -z" is equivalent to "-n", which seems to be more intuitive.

Signed-off-by: Wei Yang <[email protected]>
CC: Sam Ravnborg <[email protected]>
---
scripts/tags.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/tags.sh b/scripts/tags.sh
index 83e3731b5bdf..5061ec255291 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -89,7 +89,7 @@ find_sources()
all_sources()
{
find_arch_include_sources ${SRCARCH} '*.[chS]'
- if [ ! -z "$archinclude" ]; then
+ if [ -n "$archinclude" ]; then
find_arch_include_sources $archinclude '*.[chS]'
fi
find_include_sources '*.[chS]'
--
2.34.1


2023-12-29 03:07:56

by Wei Yang

[permalink] [raw]
Subject: [PATCH 4/4] scripts/tags.sh: remove find_sources

After commit '4f628248a578 kbuild: reintroduce ALLSOURCE_ARCHS support for
tags/cscope', find_sources only invoke find_arch_sources.

Signed-off-by: Wei Yang <[email protected]>
CC: Jike Song <[email protected]>
---
scripts/tags.sh | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/scripts/tags.sh b/scripts/tags.sh
index 5061ec255291..45568fee0cbb 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -81,11 +81,6 @@ find_other_sources()
-name "$1" -not -type l -print;
}

-find_sources()
-{
- find_arch_sources $1 "$2"
-}
-
all_sources()
{
find_arch_include_sources ${SRCARCH} '*.[chS]'
@@ -95,7 +90,7 @@ all_sources()
find_include_sources '*.[chS]'
for arch in $ALLSOURCE_ARCHS
do
- find_sources $arch '*.[chS]'
+ find_arch_sources $arch '*.[chS]'
done
find_other_sources '*.[chS]'
}
@@ -125,7 +120,7 @@ all_kconfigs()
find ${tree}arch/ -maxdepth 1 $ignore \
-name "Kconfig*" -not -type l -print;
for arch in $ALLSOURCE_ARCHS; do
- find_sources $arch 'Kconfig*'
+ find_arch_sources $arch 'Kconfig*'
done
find_other_sources 'Kconfig*'
}
--
2.34.1