mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-18 04:12:19 +00:00
Rewrite list-licenses.sh to use array+find
This commit is contained in:
parent
97b0513f99
commit
a5331ea544
@ -5,15 +5,16 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
GREP_CMD=ggrep
|
||||
FIND_CMD=gfind
|
||||
else
|
||||
FIND_CMD=find
|
||||
GREP_CMD=grep
|
||||
FIND_CMD='find'
|
||||
GREP_CMD='grep'
|
||||
fi
|
||||
|
||||
ROOT_PATH="$(git rev-parse --show-toplevel)"
|
||||
LIBS_PATH="${ROOT_PATH}/contrib"
|
||||
|
||||
ls -1 -d ${LIBS_PATH}/*/ "${ROOT_PATH}/base/poco" | ${GREP_CMD} -F -v -- '-cmake' | LC_ALL=C sort | while read LIB; do
|
||||
LIB_NAME=$(basename $LIB)
|
||||
mapfile -t libs < <(echo "${ROOT_PATH}/base/poco"; find "${LIBS_PATH}" -type d -maxdepth 1 ! -name '*-cmake' | LC_ALL=C sort)
|
||||
for LIB in "${libs[@]}"; do
|
||||
LIB_NAME=$(basename "$LIB")
|
||||
|
||||
LIB_LICENSE=$(
|
||||
LC_ALL=C ${FIND_CMD} "$LIB" -type f -and '(' -iname 'LICENSE*' -or -iname 'COPYING*' -or -iname 'COPYRIGHT*' ')' -and -not '(' -iname '*.html' -or -iname '*.htm' -or -iname '*.rtf' -or -name '*.cpp' -or -name '*.h' -or -iname '*.json' ')' -printf "%d\t%p\n" |
|
||||
|
Loading…
Reference in New Issue
Block a user