mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
Also exclude the files generated by the kernel v5.15 build system. Additionally, sort the output and fix shellcheck warnings.
80 lines
1.9 KiB
Bash
Executable File
80 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
list_source_files() {
|
|
local d r
|
|
|
|
d="$(cd "$1" && echo "$PWD")"
|
|
r="$d"
|
|
while [ "$r" != "/" ] && [ ! -e "$r/.svn" ] && [ ! -e "$r/.git" ] &&
|
|
[ ! -e "$r/.hg" ]; do
|
|
r="$(dirname "$r")"
|
|
done
|
|
|
|
if [ -e "$r/.svn" ]; then
|
|
(
|
|
cd "$d" || exit $?
|
|
svn status -v | \
|
|
grep -vE '^[D?]|^Performing|^$' | \
|
|
cut -c3- | \
|
|
while read -r a b c f; do
|
|
if [ -f "$f" ] || [ -h "$f" ]; then
|
|
echo "$a $b $c" >/dev/null
|
|
echo "$f"
|
|
fi
|
|
done
|
|
)
|
|
elif [ -e "$r/.git" ]; then
|
|
subdir="${d#"${r}"}"
|
|
if [ "$r" != "" ]; then
|
|
( cd "$d" && git ls-tree --name-only -r HEAD ) | sed "s|^$subdir/||"
|
|
else
|
|
echo "Ignored directory $1" >&2
|
|
fi
|
|
elif [ -e "$r/.hg" ]; then
|
|
subdir="${d#"${r}"}"
|
|
if [ -n "${subdir}" ]; then
|
|
subdir="${subdir#/}/"
|
|
hg manifest | sed -n "s|^$subdir||p"
|
|
else
|
|
hg manifest
|
|
fi
|
|
else
|
|
(
|
|
cd "$d" &&
|
|
find . -type f -o -type l |
|
|
sed -e 's/^\.\///' \
|
|
-e '/\.depend_\(adm\|d\|f\)$/d' \
|
|
-e '/\.o$/d' \
|
|
-e '/\.o\.d$/d' \
|
|
-e '/\.o\.cmd$/d' \
|
|
-e '/\.ko$/d' \
|
|
-e '/\.ko\.cmd$/d' \
|
|
-e '/\.mod$/d' \
|
|
-e '/\.mod\.c$/d' \
|
|
-e '/\.mod\.cmd$/d' \
|
|
-e '/\/Module\.\(symver\|marker\)s$/d' \
|
|
-e '/\/\.Module\.symvers\.cmd$/d' \
|
|
-e '/\/\.modules\.order\.cmd$/d' \
|
|
-e '/\/\.tmp_versions\(\/\|$\)/d' \
|
|
-e '/\/blib\//d' \
|
|
-e '/\/conftest\/.*\/build-output-.*\.txt$/d' \
|
|
-e '/\/conftest\/.*\/result-.*\.txt$/d' \
|
|
-e '/\/modules\.order$/d' \
|
|
-e '/\/rpmbuilddir\//d' \
|
|
-e '/^iscsi-scst\/usr\/iscsi-scst-adm$/d' \
|
|
-e '/^iscsi-scst\/usr\/iscsi-scstd$/d' \
|
|
-e '/^rpmbuilddir\//d' \
|
|
-e '/^usr\/fileio\/fileio_tgt$/d' \
|
|
-e '/^usr\/stpgd\/stpgd$/d' \
|
|
-e '/debian\/tmp\//d' \
|
|
-e '/~$/d'
|
|
)
|
|
fi | sort
|
|
}
|
|
|
|
if [ $# = 0 ]; then
|
|
list_source_files "$PWD"
|
|
else
|
|
for d in "$@"; do list_source_files "$d"; done
|
|
fi
|