### _Why are the changes needed?_ This PR updates the LICENSE and NOTICE files for both source release and binary release, and enhances the `collect_licenses.sh` script to support 1)collect `NOTICE*`(previous only `NOTICE`) files, 2) remove redundant or duplicated text from final NOTICE This PR also fix the LICENSE and NOTICE files for shaded modules ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #2115 from pan3793/license. Closes #2115 e515eaaf [Cheng Pan] nit 53052ee6 [Cheng Pan] License for static resource b14837fe [Cheng Pan] Remove CCO 2fe01d58 [Cheng Pan] nit cb617e15 [Cheng Pan] log conf 7aaf2dbf [Cheng Pan] Update LICENSE 412a04f4 [Cheng Pan] Fix kyuubi-version-info.properties 0ed01fa7 [Cheng Pan] recover MANIFEST.MF f0a5d192 [Cheng Pan] Update LICENSE for shade modules 407b9ddb [Cheng Pan] python3 830c7a92 [Cheng Pan] Revert "Setup python3" 239890da [Cheng Pan] Revert "setup-python@v3" b0b27664 [Cheng Pan] setup-python@v3 3487cd45 [Cheng Pan] Setup python3 82ae8f01 [Cheng Pan] Revert "Update Dockerfile install python3" 4df10c7c [Cheng Pan] Update Dockerfile install python3 bbd87a43 [Cheng Pan] niy 152d2d03 [Cheng Pan] nit 85e89dcf [Cheng Pan] update license df891a63 [Cheng Pan] Revert "Clean LICENSE" 09dcba9f [Cheng Pan] enhance collect_license.sh acb624c9 [Cheng Pan] enhance collect-licenses.sh 7e0d5657 [Cheng Pan] Clean LICENSE 8eb5e356 [Cheng Pan] [LICENSE] Update LICENSE-binary Authored-by: Cheng Pan <chengpan@apache.org> Signed-off-by: Cheng Pan <chengpan@apache.org>
69 lines
2.3 KiB
Bash
Executable File
69 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
#
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
# this work for additional information regarding copyright ownership.
|
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
# (the "License"); you may not use this file except in compliance with
|
|
# the License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
|
|
# This script extracts from all jars in the specified directory the NOTICE files and the
|
|
# licenses folders. It then concatenates all NOTICE files and collects the contents of all
|
|
# licenses folders in the specified output directory.
|
|
#
|
|
# This tool can be used to generate a rough skeleton for the binary NOTICE file. Be aware,
|
|
# that it does not deduplicate contents.
|
|
|
|
set -o pipefail
|
|
set -e
|
|
|
|
SRC=${1:-.}
|
|
DST=${2:-licenses-output}
|
|
KYUUBI_DIR="$(cd "$(dirname "$0")"/../..; pwd)"
|
|
TMP="${DST}/tmp"
|
|
NOTICE_BINARY_PREAMBLE="${KYUUBI_DIR}/NOTICE-binary"
|
|
|
|
USAGE="$0 <SOURCE_DIRECTORY:-.> <OUTPUT_DIRECTORY:-licenses-output>"
|
|
|
|
source "$KYUUBI_DIR/build/util.sh"
|
|
|
|
if [ "${SRC}" = "-h" ]; then
|
|
echo "${USAGE}"
|
|
exit 0
|
|
fi
|
|
|
|
for jar_file in $(find -L "${SRC}" -name "*.jar")
|
|
do
|
|
if [[ "$(basename ${jar_file})" != "kyuubi-"* ]]; then
|
|
DIR="${TMP}/$(basename -- "${jar_file}" .jar)"
|
|
mkdir -p "${DIR}"
|
|
JAR=$(realpath "${jar_file}")
|
|
(cd "${DIR}" && jar xf ${JAR} META-INF/NOTICE META-INF/licenses)
|
|
fi
|
|
done
|
|
|
|
NOTICE="${DST}/NOTICE"
|
|
[ -f "${NOTICE}" ] && rm "${NOTICE}"
|
|
cp "${NOTICE_BINARY_PREAMBLE}" "${NOTICE}"
|
|
(export LC_ALL=C; find "${TMP}" -name "NOTICE*" | sort | xargs ${KYUUBI_DIR}/build/release/append_notice.py "${NOTICE}")
|
|
|
|
LICENSES="${DST}/licenses"
|
|
[ -f "${LICENSES}" ] && rm -r "${LICENSES}"
|
|
find "${TMP}" -name "licenses" -type d -exec cp -r -- "{}" "${DST}" \;
|
|
|
|
# Search and collect license files that not bundled in any jars.
|
|
find "${SRC}" -name "LICENSE.*" -type f \
|
|
! -path "${DST}/licenses/*" ! -path "${TMP}/licenses/*" -exec cp -- "{}" "${DST}/licenses" \;
|
|
|
|
rm -r "${TMP}"
|