mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 02:08:13 +00:00 
			
		
		
		
	Restructure licenses again (revert cd4474a)
				
					
				
			This moves licenses of vendored code from one monolith file into a tree of individual files for easier reviews. This fixes both the bash and bazel paths.
This commit is contained in:
		
							
								
								
									
										23749
									
								
								Godeps/LICENSES
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										23749
									
								
								Godeps/LICENSES
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										4
									
								
								Godeps/OWNERS
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								Godeps/OWNERS
									
									
									
										generated
									
									
									
								
							| @@ -1,4 +0,0 @@ | ||||
| # See the OWNERS docs at https://go.k8s.io/owners | ||||
|  | ||||
| approvers: | ||||
| - dep-approvers | ||||
| @@ -203,7 +203,7 @@ function kube::release::package_node_tarballs() { | ||||
|     cp "${client_bins[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \ | ||||
|       "${release_stage}/node/bin/" | ||||
|  | ||||
|     cp "${KUBE_ROOT}/Godeps/LICENSES" "${release_stage}/" | ||||
|     cp -R "${KUBE_ROOT}/LICENSES" "${release_stage}/" | ||||
|  | ||||
|     cp "${RELEASE_TARS}/kubernetes-src.tar.gz" "${release_stage}/" | ||||
|  | ||||
| @@ -275,7 +275,7 @@ function kube::release::package_server_tarballs() { | ||||
|     cp "${client_bins[@]/#/${LOCAL_OUTPUT_BINPATH}/${platform}/}" \ | ||||
|       "${release_stage}/server/bin/" | ||||
|  | ||||
|     cp "${KUBE_ROOT}/Godeps/LICENSES" "${release_stage}/" | ||||
|     cp -R "${KUBE_ROOT}/LICENSES" "${release_stage}/" | ||||
|  | ||||
|     cp "${RELEASE_TARS}/kubernetes-src.tar.gz" "${release_stage}/" | ||||
|  | ||||
| @@ -559,7 +559,7 @@ EOF | ||||
|  | ||||
|   cp -R "${KUBE_ROOT}/docs" "${release_stage}/" | ||||
|   cp "${KUBE_ROOT}/README.md" "${release_stage}/" | ||||
|   cp "${KUBE_ROOT}/Godeps/LICENSES" "${release_stage}/" | ||||
|   cp -R "${KUBE_ROOT}/LICENSES" "${release_stage}/" | ||||
|  | ||||
|   echo "${KUBE_GIT_VERSION}" > "${release_stage}/version" | ||||
|  | ||||
|   | ||||
| @@ -70,13 +70,20 @@ pkg_tar( | ||||
| ) | ||||
|  | ||||
| # Included in node and server tarballs. | ||||
| filegroup( | ||||
|     name = "license-targets", | ||||
| pkg_tar( | ||||
|     name = "license-artifacts", | ||||
|     srcs = [ | ||||
|         ":kubernetes-src.tar.gz", | ||||
|         "//:Godeps/LICENSES", | ||||
|         ":kubernetes-src.tar.gz",  # we want the tar file itself | ||||
|     ], | ||||
|     mode = "0755", | ||||
|     tags = [ | ||||
|         "manual", | ||||
|         "no-cache", | ||||
|     ], | ||||
|     visibility = ["//visibility:private"], | ||||
|     deps = [ | ||||
|         "//:LICENSES",  # we want to expand this | ||||
|     ], | ||||
| ) | ||||
|  | ||||
| pkg_tar( | ||||
| @@ -119,7 +126,7 @@ pkg_tar( | ||||
|  | ||||
| [[pkg_tar( | ||||
|     name = "kubernetes-node-%s-%s" % (os, arch), | ||||
|     srcs = [":license-targets"], | ||||
|     srcs = [], | ||||
|     extension = "tar.gz", | ||||
|     mode = "0644", | ||||
|     package_dir = "kubernetes", | ||||
| @@ -127,7 +134,9 @@ pkg_tar( | ||||
|         "manual", | ||||
|         "no-cache", | ||||
|     ], | ||||
|     deps = select({go_platform_constraint(os, arch): [":_node-bin"]}), | ||||
|     deps = select({go_platform_constraint(os, arch): [":_node-bin"]}) + [ | ||||
|         ":license-artifacts", | ||||
|     ], | ||||
| ) for arch in archs] for os, archs in NODE_PLATFORMS.items()] | ||||
|  | ||||
| pkg_tar( | ||||
| @@ -170,7 +179,7 @@ pkg_tar( | ||||
|  | ||||
| [[pkg_tar( | ||||
|     name = "kubernetes-server-%s-%s" % (os, arch), | ||||
|     srcs = [":license-targets"], | ||||
|     srcs = [], | ||||
|     extension = "tar.gz", | ||||
|     mode = "0644", | ||||
|     package_dir = "kubernetes", | ||||
| @@ -183,7 +192,9 @@ pkg_tar( | ||||
|             ":_server-addons", | ||||
|             ":_server-bin", | ||||
|         ], | ||||
|     }), | ||||
|     }) + [ | ||||
|         ":license-artifacts", | ||||
|     ], | ||||
| ) for arch in archs] for os, archs in SERVER_PLATFORMS.items()] | ||||
|  | ||||
| pkg_tar( | ||||
| @@ -235,7 +246,6 @@ pkg_tar( | ||||
| pkg_tar( | ||||
|     name = "kubernetes", | ||||
|     srcs = [ | ||||
|         "//:Godeps/LICENSES", | ||||
|         "//:README.md", | ||||
|         "//:version", | ||||
|         "//cluster:all-srcs", | ||||
| @@ -253,6 +263,7 @@ pkg_tar( | ||||
|     tags = ["no-cache"], | ||||
|     deps = [ | ||||
|         ":_full_server", | ||||
|         ":license-artifacts", | ||||
|     ], | ||||
| ) | ||||
|  | ||||
|   | ||||
| @@ -17,6 +17,7 @@ | ||||
| package(default_visibility = ["//visibility:public"]) | ||||
|  | ||||
| load("@io_k8s_repo_infra//defs:build.bzl", "gcs_upload") | ||||
| load("@io_k8s_repo_infra//defs:pkg.bzl", "pkg_tar") | ||||
| load("//build:platforms.bzl", "for_platforms") | ||||
|  | ||||
| filegroup( | ||||
| @@ -124,3 +125,18 @@ platform( | ||||
|       {PARENT_REMOTE_EXECUTION_PROPERTIES} | ||||
|     """, | ||||
| ) | ||||
|  | ||||
| pkg_tar( | ||||
|     name = "LICENSES", | ||||
|     srcs = glob( | ||||
|         ["LICENSES/**/LICENSE"], | ||||
|         allow_empty = False, | ||||
|         exclude_directories = 0, | ||||
|     ), | ||||
|     mode = "0755", | ||||
|     strip_prefix = "//", | ||||
|     tags = [ | ||||
|         "manual", | ||||
|         "no-cache", | ||||
|     ], | ||||
| ) | ||||
|   | ||||
| @@ -322,7 +322,7 @@ function install-exec-auth-plugin { | ||||
|   local -r license_url="${EXEC_AUTH_PLUGIN_LICENSE_URL}" | ||||
|   echo "Downloading gke-exec-auth-plugin license" | ||||
|   download-or-bust "" "${license_url}" | ||||
|   mv "${KUBE_HOME}/LICENSE" "${KUBE_BIN}/gke-exec-auth-plugin-license" | ||||
|   mv "${KUBE_HOME}/LICENSES/LICENSE" "${KUBE_BIN}/gke-exec-auth-plugin-license" | ||||
| } | ||||
|  | ||||
| function install-kube-manifests { | ||||
|   | ||||
							
								
								
									
										2
									
								
								hack/tools/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								hack/tools/.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1 +1 @@ | ||||
| vendor/ | ||||
| /vendor/ | ||||
|   | ||||
| @@ -38,6 +38,6 @@ pushd "${KUBE_ROOT}/hack/tools" >/dev/null | ||||
|   go mod tidy | ||||
|   go mod vendor | ||||
|  | ||||
|   LICENSE_ROOT="${PWD}" VENDOR_LICENSE_FILE="LICENSES" "${KUBE_ROOT}/hack/update-vendor-licenses.sh" | ||||
|   LICENSE_ROOT="${PWD}" "${KUBE_ROOT}/hack/update-vendor-licenses.sh" | ||||
|   rm -rf vendor | ||||
| popd >/dev/null | ||||
|   | ||||
| @@ -13,8 +13,8 @@ | ||||
| # See the License for the specific language governing permissions and | ||||
| # limitations under the License. | ||||
|  | ||||
| # Update the Godeps/LICENSES document. | ||||
| # Generates a table of Godep dependencies and their license. | ||||
| # Update the LICENSES directory. | ||||
| # Generates a table of Go dependencies and their licenses. | ||||
| # | ||||
| # Usage: | ||||
| #    $0 [--create-missing] [/path/to/licenses] | ||||
| @@ -24,12 +24,15 @@ | ||||
| #    additionally created files into the vendor auto-generated tree. | ||||
| # | ||||
| #    Run every time a license file is added/modified within /vendor to | ||||
| #    update /Godeps/LICENSES | ||||
| #    update /LICENSES | ||||
|  | ||||
| set -o errexit | ||||
| set -o nounset | ||||
| set -o pipefail | ||||
|  | ||||
| KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. | ||||
| source "${KUBE_ROOT}/hack/lib/init.sh" | ||||
|  | ||||
| export LANG=C | ||||
| export LC_ALL=C | ||||
|  | ||||
| @@ -130,8 +133,6 @@ process_content () { | ||||
| ############################################################################# | ||||
| # MAIN | ||||
| ############################################################################# | ||||
| KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. | ||||
| source "${KUBE_ROOT}/hack/lib/init.sh" | ||||
|  | ||||
| export GO111MODULE=on | ||||
|  | ||||
| @@ -153,13 +154,24 @@ fi | ||||
| LICENSE_ROOT="${LICENSE_ROOT:-${KUBE_ROOT}}" | ||||
| cd "${LICENSE_ROOT}" | ||||
|  | ||||
| VENDOR_LICENSE_FILE="${VENDOR_LICENSE_FILE:-"Godeps/LICENSES"}" | ||||
| TMP_LICENSE_FILE="/tmp/Godeps.LICENSES.$$" | ||||
| kube::util::ensure-temp-dir | ||||
|  | ||||
| # Save the genreated LICENSE file for each package temporarily | ||||
| TMP_LICENSE_FILE="${KUBE_TEMP}/LICENSES.$$" | ||||
|  | ||||
| # The directory to save all the LICENSE files | ||||
| LICENSES_DIR="${LICENSES_DIR:-${LICENSE_ROOT}/LICENSES}" | ||||
| mkdir -p "${LICENSES_DIR}" | ||||
|  | ||||
| # The tmp directory to save all the LICENSE files, will move to LICENSES_DIR | ||||
| TMP_LICENSES_DIR="${KUBE_TEMP}/LICENSES.DIR.$$" | ||||
| mkdir -p "${TMP_LICENSES_DIR}" | ||||
|  | ||||
| DEPS_DIR="vendor" | ||||
| declare -Ag CONTENT | ||||
|  | ||||
| if [[ -f "${LICENSE_ROOT}/LICENSE" ]]; then | ||||
| # Put the K8S LICENSE on top | ||||
| if [ -f "${LICENSE_ROOT}/LICENSE" ]; then | ||||
|   ( | ||||
|     echo "================================================================================" | ||||
|     echo "= Kubernetes licensed under: =" | ||||
| @@ -168,27 +180,28 @@ if [[ -f "${LICENSE_ROOT}/LICENSE" ]]; then | ||||
|     echo | ||||
|     echo "= LICENSE $(kube::util::md5 "${LICENSE_ROOT}/LICENSE")" | ||||
|     echo "================================================================================" | ||||
|   ) > ${TMP_LICENSE_FILE} | ||||
|   ) > "${TMP_LICENSE_FILE}" | ||||
|   mv "${TMP_LICENSE_FILE}" "${TMP_LICENSES_DIR}/LICENSE" | ||||
| fi | ||||
|  | ||||
| # Loop through every vendored package | ||||
| for PACKAGE in $(go list -m -json all | jq -r .Path | sort -f); do | ||||
|   if [[ -e "staging/src/${PACKAGE}" ]]; then | ||||
|     echo "$PACKAGE is a staging package, skipping" > /dev/stderr | ||||
|     echo "${PACKAGE} is a staging package, skipping" > /dev/stderr | ||||
|     continue | ||||
|   fi | ||||
|   if [[ ! -e "${DEPS_DIR}/${PACKAGE}" ]]; then | ||||
|     echo "$PACKAGE doesn't exist in vendor, skipping" > /dev/stderr | ||||
|     echo "${PACKAGE} doesn't exist in ${DEPS_DIR}, skipping" > /dev/stderr | ||||
|     continue | ||||
|   fi | ||||
|   echo "${PACKAGE}" | ||||
|  | ||||
|   process_content "${PACKAGE}" LICENSE | ||||
|   process_content "${PACKAGE}" COPYRIGHT | ||||
|   process_content "${PACKAGE}" COPYING | ||||
|  | ||||
|   # display content | ||||
|   echo | ||||
|   echo "================================================================================" | ||||
|   # copy content and throw error message | ||||
|   { | ||||
|     echo "= ${DEPS_DIR}/${PACKAGE} licensed under: =" | ||||
|     echo | ||||
|  | ||||
| @@ -213,12 +226,18 @@ Options: | ||||
| __EOF__ | ||||
|       exit 9 | ||||
|     fi | ||||
|   cat "${file}" | ||||
|  | ||||
|     cat "${file}" | ||||
|     echo | ||||
|     echo "= ${file} $(kube::util::md5 "${file}")" | ||||
|   echo "================================================================================" | ||||
|   echo | ||||
| done >> ${TMP_LICENSE_FILE} | ||||
|   } >> "${TMP_LICENSE_FILE}" | ||||
|  | ||||
| cat ${TMP_LICENSE_FILE} > "${VENDOR_LICENSE_FILE}" | ||||
|   dest_dir="${TMP_LICENSES_DIR}/vendor/${PACKAGE}" | ||||
|   mkdir -p "${dest_dir}" | ||||
|   mv "${TMP_LICENSE_FILE}" "${dest_dir}/LICENSE" | ||||
| done | ||||
|  | ||||
| # Leave things like OWNERS alone. | ||||
| rm -f "${LICENSES_DIR}/LICENSE" | ||||
| rm -rf "${LICENSES_DIR}/vendor" | ||||
| mv "${TMP_LICENSES_DIR}"/* "${LICENSES_DIR}" | ||||
|   | ||||
| @@ -319,8 +319,7 @@ for repo in $(kube::util::list_staging_repos); do | ||||
| done | ||||
|  | ||||
|  | ||||
| # Phase 6: rebuild vendor directory | ||||
|  | ||||
| # Phase 7: rebuild vendor directory | ||||
| kube::log::status "vendor: running 'go mod vendor'" | ||||
| go mod vendor >>"${LOG_FILE}" 2>&1 | ||||
|  | ||||
| @@ -341,18 +340,19 @@ kube::log::status "vendor: updating BUILD files" | ||||
| # Assume that anything imported through vendor doesn't need Bazel to build. | ||||
| # Prune out any Bazel build files, since these can break the build due to | ||||
| # missing dependencies that aren't included by go mod vendor. | ||||
| find vendor/ -type f \( -name BUILD -o -name BUILD.bazel -o -name WORKSPACE \) -exec rm -f {} \; | ||||
| find vendor/ -type f \ | ||||
|     \( -name BUILD -o -name BUILD.bazel -o -name WORKSPACE \) \ | ||||
|     -exec rm -f {} \; | ||||
| hack/update-bazel.sh >>"${LOG_FILE}" 2>&1 | ||||
|  | ||||
| kube::log::status "vendor: updating LICENSES file" | ||||
| kube::log::status "vendor: updating vendor/LICENSES" | ||||
| hack/update-vendor-licenses.sh >>"${LOG_FILE}" 2>&1 | ||||
|  | ||||
| kube::log::status "vendor: creating OWNERS file" | ||||
| rm -f "Godeps/OWNERS" "vendor/OWNERS" | ||||
| cat <<__EOF__ > "Godeps/OWNERS" | ||||
| rm -f "vendor/OWNERS" | ||||
| cat <<__EOF__ > "vendor/OWNERS" | ||||
| # See the OWNERS docs at https://go.k8s.io/owners | ||||
|  | ||||
| approvers: | ||||
| - dep-approvers | ||||
| __EOF__ | ||||
| cp "Godeps/OWNERS" "vendor/OWNERS" | ||||
|   | ||||
| @@ -14,7 +14,7 @@ | ||||
| # See the License for the specific language governing permissions and | ||||
| # limitations under the License. | ||||
|  | ||||
| # This script checks whether updating of vendor licenses file is needed | ||||
| # This script checks whether updating of licenses files is needed | ||||
| # or not. We should run `hack/update-vendor-licenses.sh` and commit the results, | ||||
| # if actually updates them. | ||||
| # Usage: `hack/verify-vendor-licenses.sh`. | ||||
| @@ -30,7 +30,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh" | ||||
| # must be in the user dir (e.g. KUBE_ROOT) in order for the docker volume mount | ||||
| # to work with docker-machine on macs | ||||
| mkdir -p "${KUBE_ROOT}/_tmp" | ||||
| _tmpdir="$(mktemp -d "${KUBE_ROOT}/_tmp/kube-vendor-licenses.XXXXXX")" | ||||
| _tmpdir="$(mktemp -d "${KUBE_ROOT}/_tmp/kube-licenses.XXXXXX")" | ||||
| #echo "Created workspace: ${_tmpdir}" | ||||
| function cleanup { | ||||
|   #echo "Removing workspace: ${_tmpdir}" | ||||
| @@ -38,17 +38,22 @@ function cleanup { | ||||
| } | ||||
| kube::util::trap_add cleanup EXIT | ||||
|  | ||||
| cp -r "${KUBE_ROOT}/Godeps" "${_tmpdir}/Godeps" | ||||
| # symlink all vendor subfolders in temp vendor | ||||
| mkdir -p "${_tmpdir}/vendor" | ||||
| for child in "${KUBE_ROOT}/vendor"/* | ||||
| do | ||||
|   ln -s "${child}" "${_tmpdir}/vendor" | ||||
| done | ||||
|  | ||||
| ln -s "${KUBE_ROOT}/LICENSE" "${_tmpdir}" | ||||
| ln -s "${KUBE_ROOT}/vendor" "${_tmpdir}" | ||||
| ln -s "${KUBE_ROOT}/staging" "${_tmpdir}" | ||||
|  | ||||
| # Update vendor Licenses | ||||
| # Update licenses | ||||
| LICENSE_ROOT="${_tmpdir}" "${KUBE_ROOT}/hack/update-vendor-licenses.sh" | ||||
|  | ||||
| # Compare vendor Licenses | ||||
| if ! _out="$(diff -Naupr "${KUBE_ROOT}/Godeps/LICENSES" "${_tmpdir}/Godeps/LICENSES")"; then | ||||
|   echo "Your vendor licenses file is out of date. Run hack/update-vendor-licenses.sh and commit the results." >&2 | ||||
| # Compare licenses | ||||
| if ! _out="$(diff -Naupr -x OWNERS "${KUBE_ROOT}/LICENSES" "${_tmpdir}/LICENSES")"; then | ||||
|   echo "Your LICENSES tree is out of date. Run hack/update-vendor-licenses.sh and commit the results." >&2 | ||||
|   echo "${_out}" >&2 | ||||
|   exit 1 | ||||
| fi | ||||
|   | ||||
| @@ -25,7 +25,7 @@ set -o pipefail | ||||
| KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. | ||||
| source "${KUBE_ROOT}/hack/lib/init.sh" | ||||
|  | ||||
| # create a nice clean place to put our new licenses | ||||
| # create a nice clean place to put our new vendor tree | ||||
| # must be in the user dir (e.g. KUBE_ROOT) in order for the docker volume mount | ||||
| # to work with docker-machine on macs | ||||
| mkdir -p "${KUBE_ROOT}/_tmp" | ||||
| @@ -59,7 +59,7 @@ export GO111MODULE=on | ||||
|  | ||||
| pushd "${_kubetmp}" > /dev/null 2>&1 | ||||
|   # Destroy deps in the copy of the kube tree | ||||
|   rm -rf ./Godeps/LICENSES ./vendor | ||||
|   rm -rf ./vendor ./LICENSES | ||||
|  | ||||
|   # Recreate the vendor tree using the nice clean set we just downloaded | ||||
|   hack/update-vendor.sh | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Tim Hockin
					Tim Hockin