This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-dist.git
commit 66b7577c97f398619f6928d0ba1aeb2d7a5a29f9 Author: Alex Heneveld <[email protected]> AuthorDate: Tue Jun 2 09:45:02 2020 +0100 rework license generation scripts so that: * the NOTICE file only has things actually included in that bundle * a DEPENDENCIES file has source and runtime dependencies * license generation maven runs against one project, not all modules, usu the karaf/features subdir * additional licenses are added and aliases tidied --- dist/licensing/README.md | 14 +- dist/licensing/generate-all.sh | 80 ++++++----- dist/licensing/generate-one-for-testing.sh | 146 --------------------- .../license-metadata-manual-go-libraries.yaml | 12 +- ...adata-manual-mvn-aggregation-and-overrides.yaml | 1 + dist/licensing/parts/license-deps | 2 +- .../{license-deps => license-deps-source-dist} | 2 +- .../parts/license-deps-with-additional-binary | 5 + ...{notice-additional => notice-additional-binary} | 2 +- dist/licensing/parts/notice-top | 4 +- .../parts/{notice-top => notice-top-source-dist} | 4 +- .../parts/notice-top-with-additional-binary | 17 +++ 12 files changed, 87 insertions(+), 202 deletions(-) diff --git a/dist/licensing/README.md b/dist/licensing/README.md index 2a1d458..53d7869 100644 --- a/dist/licensing/README.md +++ b/dist/licensing/README.md @@ -28,21 +28,21 @@ First it is useful to know how these routines work. It builds for various modes depending where the item is being used: -* The projects and JARs strictly speaking only require any 3rd party items - included therein. There usually aren't any (one exception is JS has been checked out - locally). Where these are required, they should be in a `license-inclusions-source-*` file. - This mode is called `binary-omitted`. (For projects where there are no such inclusions, +* The projects and JARs strictly NOTICE and LICENSE only require any 3rd party items included therein. + There usually aren't any, except for some JS and Go where some code is checked out locally). + Where these are required, they should be in a `license-inclusions-source-*` file. + This mode is called `source-only`. (For projects where there are no such inclusions, the build adds a stock Apache LICENSE and Apache Brooklyn NOTICE.) * Because people will usually build these and need the resulting information, and because attribution is good, we include details of runtime dependencies in some places - (e.g. the root of projects) in a separate section in the NOTICE. These dependencies can + (e.g. the root of projects) in a separate DEPENDENCIES file. These dependencies can be specified in files matching `license-inclusions-binary-*` (this is not needed for `mvn` - deps which are inferred automatically). This mode is called `binary-additional`. + deps which are inferred automatically). This mode is called `source-then-additional-binary`. * The TGZ includes third-party dependencies and so needs LICENSE and NOTICE updates for everything that is bundled, including all `license-inclusions-{source,binary}-*`. - This mode is called `binary-primary`. + This mode is called `binary`. The generation then proceeds by collecting the relevant `license-inclusions-*` under the project directory, giving a list of project `id` fields, and collecting `license-metadata-*` files containing diff --git a/dist/licensing/generate-all.sh b/dist/licensing/generate-all.sh index 8de8d24..58f90ef 100755 --- a/dist/licensing/generate-all.sh +++ b/dist/licensing/generate-all.sh @@ -63,35 +63,37 @@ prefix_and_join_array() { done } -# takes root dir in first arg, then regex expression +# takes a base dir in first arg, then sub-project dir to build, then output, mode, then search root relative to output dir make_for() { - PROJ=$(cd $1 ; pwd -P) - OUT=${PROJ}/$2 - MODE=$3 - SEARCH_ROOT=$4 - ARGS=$5 - if [ -z "$SEARCH_ROOT" ] ; then SEARCH_ROOT=$PROJ ; fi - - echo Generating for $PROJ mode $MODE to $2... + BASE=$(cd $1 ; pwd -P) + PROJ=$(cd $BASE ; cd $2; pwd -P) + OUT=$(cd $BASE ; cd $3; pwd -P) + MODE=$4 + SEARCH_ROOT=$5 + if [ -z "$SEARCH_ROOT" ] ; then SEARCH_ROOT=. ; fi + SEARCH_ROOT=$(cd $BASE ; cd $SEARCH_ROOT; pwd -P) + ARGS=$6 + + echo Generating for $PROJ mode $MODE to $OUT... echo "" pushd $PROJ > /dev/null - if [ "$MODE" == "binary-additional" ] ; then + if [ "$MODE" == "source-then-additional-binary" ] ; then $REF_DIR/generate-license-and-notice.sh \ -o $OUT \ --license $PARTS_DIR/license-top \ - --license $PARTS_DIR/license-deps \ - --notice $PARTS_DIR/notice-top --notice-compute-with-flags " + --license $PARTS_DIR/license-deps-with-additional-binary \ + --notice $PARTS_DIR/notice-top-with-additional-binary --notice-compute-with-flags " -DextrasFiles=$(prefix_and_join_array "" ":" "" $(find -L $SEARCH_ROOT -name "license-inclusions-source-*")) -DonlyExtras=true" \ - --notice $PARTS_DIR/notice-additional --notice-compute-with-flags " + --notice $PARTS_DIR/notice-additional-binary --notice-compute-with-flags " -DextrasFiles=$(prefix_and_join_array "" ":" "" $(find -L $SEARCH_ROOT -name "license-inclusions-binary-*"))" \ $ARGS \ --libraries ${REF_DIR} ${SEARCH_ROOT} - elif [ "$MODE" == "binary-primary" ] ; then + elif [ "$MODE" == "binary" ] ; then $REF_DIR/generate-license-and-notice.sh \ -o $OUT \ @@ -102,13 +104,13 @@ make_for() { $ARGS \ --libraries ${REF_DIR} ${SEARCH_ROOT} - elif [ "$MODE" == "binary-omitted" ] ; then + elif [ "$MODE" == "source-only" ] ; then $REF_DIR/generate-license-and-notice.sh \ -o $OUT \ --license $PARTS_DIR/license-top \ - --license $PARTS_DIR/license-deps \ - --notice $PARTS_DIR/notice-top --notice-compute-with-flags " + --license $PARTS_DIR/license-deps-source-dist \ + --notice $PARTS_DIR/notice-top-source-dist --notice-compute-with-flags " -DextrasFiles=$(prefix_and_join_array "" ":" "" $(find -L $SEARCH_ROOT -name "license-inclusions-source-*")) -DonlyExtras=true" \ $ARGS \ @@ -123,6 +125,16 @@ make_for() { popd > /dev/null } +make_for_source() { + make_for "$1" "$2" "$3" source-then-additional-binary "$4" "$5" + # DEPENDENCIES + mv $OUT/NOTICE $OUT/DEPENDENCIES + echo "" >> $OUT/DEPENDENCIES + cat $OUT/LICENSE >> $OUT/DEPENDENCIES + rm $OUT/LICENSE + + make_for "$1" "$2" "$3" source-only "$4" "$5" +} # build licenses for all the projects @@ -133,38 +145,36 @@ else # include deps in files pulled in to Go CLI binary builds -make_for $ROOT_DIR/brooklyn-client/cli/ release/license/files binary-primary -make_for $ROOT_DIR/brooklyn-client/cli/ . binary-additional +make_for $ROOT_DIR/brooklyn-client/cli/ . release/license/files binary +make_for_source $ROOT_DIR/brooklyn-client/cli/ . . # Server CLI has embedded JS; gets custom files in sub-project root, also included in JAR -make_for $ROOT_DIR/brooklyn-server/server-cli/ . binary-additional +make_for_source $ROOT_DIR/brooklyn-server/server-cli/ . . # UI gets files at root -make_for $ROOT_DIR/brooklyn-ui/ . binary-additional +make_for_source $ROOT_DIR/brooklyn-ui/ features . # for UI also do for each standalone module for x in $(ls $ROOT_DIR/brooklyn-ui/ui-modules/*/package.json) ; do - make_for ${x%package.json} . binary-additional + make_for_source ${x%package.json} . . # and in modules which make a WAR/JAR files we embed binaries - if [ -d ${x%package.json}/src/main/webapp ] ; then make_for ${x%package.json} src/main/webapp/WEB-INF/classes/META-INF/ binary-primary ; fi + if [ -d ${x%package.json}/src/main/webapp ] ; then make_for ${x%package.json} . src/main/webapp/WEB-INF/classes/META-INF/ binary ; fi done # main projects have their binaries included at root -make_for $ROOT_DIR/brooklyn-server/ . binary-additional -make_for $ROOT_DIR/brooklyn-client/ . binary-additional -make_for $ROOT_DIR/brooklyn-library/ . binary-additional -# dist is trickier, just don't mention binaries in the generated items -make_for $ROOT_DIR/brooklyn-dist/ . binary-omitted +make_for_source $ROOT_DIR/brooklyn-server/ karaf/features . +make_for_source $ROOT_DIR/brooklyn-client/ java . +make_for_source $ROOT_DIR/brooklyn-library karaf/features . +make_for_source $ROOT_DIR/brooklyn-dist karaf/features . + # brooklyn-docs skipped # the docs don't make a build and don't include embedded code so no special license there -# and the binary dists; dist/ project which has biggest deps set, but search in all brooklyn projects -make_for $ROOT_DIR/brooklyn-dist/dist src/main/license/files/ binary-primary $ROOT_DIR -cp $OUT/{NOTICE,LICENSE} $PROJ/../karaf/apache-brooklyn/src/main/resources/ - -# finally in root project list everything -make_for $ROOT_DIR/brooklyn-dist/dist ../.. binary-additional $ROOT_DIR +# for the root source do as for dist but get the additional includes from all brooklyn projects +make_for_source $ROOT_DIR/brooklyn-dist karaf/features .. $ROOT_DIR +# and the binary dist is the same, stored in a couple places for inclusion in the binary builds +make_for $ROOT_DIR/brooklyn-dist karaf/features dist/src/main/license/files/ binary $ROOT_DIR +cp $OUT/{NOTICE,LICENSE} $PROJ/../apache-brooklyn/src/main/resources/ fi - diff --git a/dist/licensing/generate-one-for-testing.sh b/dist/licensing/generate-one-for-testing.sh deleted file mode 100755 index 4b20c69..0000000 --- a/dist/licensing/generate-one-for-testing.sh +++ /dev/null @@ -1,146 +0,0 @@ -# -# 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. -# - -set -e - -usage() { - cat >&2 << EOF - -Usage: generate-all.sh - -Execute generate-license-and-notice.sh to generate LICENSE and NOTICE files for all Brooklyn projects. - -EOF -} - -while [ ! -z "$*" ] ; do - - if [ "$1" == "--help" ]; then usage ; exit 0; fi - - usage - echo Unexpected argument: $1 - exit 1 - -done - - -REF_DIR=$(pushd $(dirname $0) > /dev/null ; pwd -P ; popd > /dev/null) -PARTS_DIR=$REF_DIR/parts -ROOT_DIR=$REF_DIR/../../.. -MVN_OUTFILE=$REF_DIR/notices.autogenerated - -prefix_and_join_array() { - PREFIX=$2 - JOIN_BEFORE_PREFIX=$1 - JOIN_AFTER_PREFIX=$3 - echo -n ${PREFIX}$4 - shift 4 - while (($# >= 1)) ; do - echo -n "${JOIN_BEFORE_PREFIX}${PREFIX}${JOIN_AFTER_PREFIX}$1" - shift - done -} - -# takes root dir in first arg, then regex expression -make_for() { - PROJ=$(cd $1 ; pwd -P) - OUT=${PROJ}/$2 - MODE=$3 - SEARCH_ROOT=$4 - if [ -z "$SEARCH_ROOT" ] ; then SEARCH_ROOT=$PROJ ; fi - - echo Generating for $PROJ mode $MODE to $2... - echo "" - - pushd $PROJ > /dev/null - - if [ "$MODE" == "binary-additional" ] ; then - - $REF_DIR/generate-license-and-notice.sh \ - -o $OUT \ - --license $PARTS_DIR/license-top \ - --license $PARTS_DIR/license-deps \ - --notice $PARTS_DIR/notice-top --notice-compute-with-flags " - -DextrasFiles=$(prefix_and_join_array "" ":" "" $(find $SEARCH_ROOT -name "license-inclusions-source-*")) - -DonlyExtras=true" \ - --notice $PARTS_DIR/notice-additional --notice-compute-with-flags " - -DextrasFiles=$(prefix_and_join_array "" ":" "" $(find $SEARCH_ROOT -name "license-inclusions-binary-*"))" \ - --libraries ${REF_DIR} ${SEARCH_ROOT} - - elif [ "$MODE" == "binary-primary" ] ; then - - $REF_DIR/generate-license-and-notice.sh \ - -o $OUT \ - --license $PARTS_DIR/license-top \ - --license $PARTS_DIR/license-deps \ - --notice $PARTS_DIR/notice-top --notice-compute-with-flags " - -DextrasFiles=$(prefix_and_join_array "" ":" "" $(find $SEARCH_ROOT -name "license-inclusions-source-*" -or -name "license-inclusions-binary-*"))" \ - --libraries ${REF_DIR} ${SEARCH_ROOT} - - elif [ "$MODE" == "binary-omitted" ] ; then - - $REF_DIR/generate-license-and-notice.sh \ - -o $OUT \ - --license $PARTS_DIR/license-top \ - --license $PARTS_DIR/license-deps \ - --notice $PARTS_DIR/notice-top --notice-compute-with-flags " - -DextrasFiles=$(prefix_and_join_array "" ":" "" $(find $SEARCH_ROOT -name "license-inclusions-source-*")) - -DonlyExtras=true" \ - --libraries ${REF_DIR} ${SEARCH_ROOT} - - else - echo FAILED - unknown mode $MODE - exit 1 - fi - echo "" - - popd > /dev/null -} - - -# build all the projects - -make_for $ROOT_DIR/brooklyn-ui/ui-modules/home . binary-additional -exit - -# include deps in files pulled in to Go CLI binary builds -make_for $ROOT_DIR/brooklyn-client/cli/ release/license/files binary-primary -make_for $ROOT_DIR/brooklyn-client/cli/ . binary-additional - -# Server CLI has embedded JS; gets custom files in sub-project root, also included in JAR -make_for $ROOT_DIR/brooklyn-server/server-cli/ . binary-additional - -# UI gets files at root, also included in WAR - -# main projects have their binaries included at root -make_for $ROOT_DIR/brooklyn-server/ . binary-additional -make_for $ROOT_DIR/brooklyn-client/ . binary-additional -make_for $ROOT_DIR/brooklyn-library/ . binary-additional -# dist is trickier, just don't mention binaries in the generated items -make_for $ROOT_DIR/brooklyn-dist/ . binary-omitted - -# brooklyn-docs skipped -# the docs don't make a build and don't include embedded code so no special license there - -# and the binary dists; dist/ project which has biggest deps set, but search in all brooklyn projects -make_for $ROOT_DIR/brooklyn-dist/dist src/main/license/files/ binary-primary $ROOT_DIR -cp $OUT/{NOTICE,LICENSE} $PROJ/../karaf/apache-brooklyn/src/main/resources/ - -# finally in root project list everything -make_for $ROOT_DIR/brooklyn-dist/dist ../.. binary-additional $ROOT_DIR diff --git a/dist/licensing/license-metadata-manual-go-libraries.yaml b/dist/licensing/license-metadata-manual-go-libraries.yaml index 1c4a19e..fa5b256 100644 --- a/dist/licensing/license-metadata-manual-go-libraries.yaml +++ b/dist/licensing/license-metadata-manual-go-libraries.yaml @@ -32,13 +32,11 @@ notices: - Copyright (c) 2016 Jeremy Saenz & Contributors -- id: github.com/NodePrime/jsonpath/cli/jsonpath - url: github.com/NodePrime/jsonpath/ - name: github.com/NodePrime/jsonpath/cli/jsonpath - description: OpenSource JSON-Path - license: MIT - notices: - - Copyright (c) 2015 NodePrime Inc. +- id: github.com/kubernetes/client-go/util/jsonpath + url: github.com/kubernetes/client-go + name: Go client for Kubernetes + description: Only used for the JSON-Path library + license: Apache-2.0 - id: golang.org/x/crypto/ssh url: https://godoc.org/golang.org/x/crypto/ssh diff --git a/dist/licensing/license-metadata-manual-mvn-aggregation-and-overrides.yaml b/dist/licensing/license-metadata-manual-mvn-aggregation-and-overrides.yaml index 0c82e7a..e43bcab 100644 --- a/dist/licensing/license-metadata-manual-mvn-aggregation-and-overrides.yaml +++ b/dist/licensing/license-metadata-manual-mvn-aggregation-and-overrides.yaml @@ -55,6 +55,7 @@ - javax.ws.rs.javax.ws.rs-api - javax.servlet.javax.servlet-api - org.jboss.spec.javax.xml.bind.jboss-jaxb-api_2.3_spec + - com.sun.activation.javax.activation - ids: - javax.annotation.jsr250-api - org.jboss.spec.javax.annotation.jboss-annotations-api_1.2_spec:1.0.0.Final diff --git a/dist/licensing/parts/license-deps b/dist/licensing/parts/license-deps index c534e67..c9da88b 100644 --- a/dist/licensing/parts/license-deps +++ b/dist/licensing/parts/license-deps @@ -1,7 +1,7 @@ Dependency licenses: - # This software includes dependencies released under their licenses. + # This software includes third-party code under their licenses. # These licenses are compatible with the Apache License above. # Details of these dependencies can be found in the accompanying NOTICE file. # These licenses are included below with their full text. diff --git a/dist/licensing/parts/license-deps b/dist/licensing/parts/license-deps-source-dist similarity index 75% copy from dist/licensing/parts/license-deps copy to dist/licensing/parts/license-deps-source-dist index c534e67..510bb6f 100644 --- a/dist/licensing/parts/license-deps +++ b/dist/licensing/parts/license-deps-source-dist @@ -1,7 +1,7 @@ Dependency licenses: - # This software includes dependencies released under their licenses. + # This source distribution includes third-party code under their licenses. # These licenses are compatible with the Apache License above. # Details of these dependencies can be found in the accompanying NOTICE file. # These licenses are included below with their full text. diff --git a/dist/licensing/parts/license-deps-with-additional-binary b/dist/licensing/parts/license-deps-with-additional-binary new file mode 100644 index 0000000..cf5ad80 --- /dev/null +++ b/dist/licensing/parts/license-deps-with-additional-binary @@ -0,0 +1,5 @@ + +Dependency licenses: + + # Licenses of the source and binary dependencies of this software are included below. + diff --git a/dist/licensing/parts/notice-additional b/dist/licensing/parts/notice-additional-binary similarity index 62% rename from dist/licensing/parts/notice-additional rename to dist/licensing/parts/notice-additional-binary index be02d16..da378f2 100644 --- a/dist/licensing/parts/notice-additional +++ b/dist/licensing/parts/notice-additional-binary @@ -1,6 +1,6 @@ Runtime dependencies: - # This artifact depends on additional third-party components at runtime. + # This software depends on additional third-party components at runtime. # These are not bundled here but may be included as part of a build. diff --git a/dist/licensing/parts/notice-top b/dist/licensing/parts/notice-top index 5dddc00..3fc2fe3 100644 --- a/dist/licensing/parts/notice-top +++ b/dist/licensing/parts/notice-top @@ -1,7 +1,7 @@ Notice: | Apache Brooklyn - Copyright 2014-2018 The Apache Software Foundation + Copyright 2014-2020 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). @@ -9,6 +9,6 @@ Notice: | Bundled dependencies: - # This software includes the following bundled third-party components. + # This software distribution includes the following bundled third-party components. # Referenced licenses can be found in the accompanying LICENSE file. diff --git a/dist/licensing/parts/notice-top b/dist/licensing/parts/notice-top-source-dist similarity index 62% copy from dist/licensing/parts/notice-top copy to dist/licensing/parts/notice-top-source-dist index 5dddc00..0473ec3 100644 --- a/dist/licensing/parts/notice-top +++ b/dist/licensing/parts/notice-top-source-dist @@ -1,7 +1,7 @@ Notice: | Apache Brooklyn - Copyright 2014-2018 The Apache Software Foundation + Copyright 2014-2020 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). @@ -9,6 +9,6 @@ Notice: | Bundled dependencies: - # This software includes the following bundled third-party components. + # This source code distribution includes the following bundled third-party components. # Referenced licenses can be found in the accompanying LICENSE file. diff --git a/dist/licensing/parts/notice-top-with-additional-binary b/dist/licensing/parts/notice-top-with-additional-binary new file mode 100644 index 0000000..33f9f83 --- /dev/null +++ b/dist/licensing/parts/notice-top-with-additional-binary @@ -0,0 +1,17 @@ +Notice: | + + Apache Brooklyn + Copyright 2014-2020 The Apache Software Foundation + + This product includes software developed at + The Apache Software Foundation (http://www.apache.org/). + + This software is released under the Apache Software License, verison 2.0. + This license and the licenses for all dependencies are included below + following the dependencies and their notices. + +Source dependencies: + + # This software includes the following third-party components in its source code. + # Additional runtime dependencies are required when built and are listed in the subsequent section. +
