adoroszlai commented on code in PR #5623: URL: https://github.com/apache/ozone/pull/5623#discussion_r1400406697
########## hadoop-ozone/dev-support/checks/license.sh: ########## @@ -0,0 +1,72 @@ +#!/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 checks if all third-party dependencies have licenses we can use. +# Optionally accepts the aggregated third-party license list file to be checked. +# Otherwise it requires Ozone to be available from Maven repo (can be local), +# so that it can generate the license list. +# +# When adding a new dependency to Ozone with a license that fails to match: +# * verify that the license is allowed, ref: https://www.apache.org/legal/resolved.html +# * tweak the patterns to allow + +set -euo pipefail + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +cd "$DIR/../../.." || exit 1 + +REPORT_DIR=${OUTPUT_DIR:-"$DIR/../../../target/license"} +mkdir -p "$REPORT_DIR" +REPORT_FILE="${REPORT_DIR}/summary.txt" + +DEFAULT_SRC="target/generated-sources/license/THIRD-PARTY.txt" +src="${1:-${DEFAULT_SRC}}" + +if [[ ! -e ${src} ]]; then + MAVEN_OPTIONS="-B -fae -Dskip.npx -Dskip.installnpx --no-transfer-progress ${MAVEN_OPTIONS:-}" + mvn ${MAVEN_OPTIONS} license:aggregate-add-third-party | tee "${REPORT_DIR}/output.log" + src="${DEFAULT_SRC}" Review Comment: I would avoid that unless absolutely necessary. Apache's page [about licenses](https://www.apache.org/legal/resolved.html) describes usage of category X licensed products: > Apache projects can rely on components under prohibited licenses if the component is only needed for optional features. When doing so, a project shall provide the user with instructions on how to obtain and install the non-included work. 1. `test` dependencies are not distributed to users in release artifacts, but users may want to run tests as part of evaluating the release. Then they automatically get these via Maven, which is arguably not the same as "instructions". 2. `provided` dependencies are more clear wrt. distribution, but they introduce the question about "optionality". E.g. Hadoop is a `provided` dependency for Ozone, but it is definitely not optional. I think it's better to start with a more restrictive check. We can re-evaluate as soon as we hit the first questionable dependency we would like to add. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
