mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 02:41:25 +00:00
Remove old make-helper script
This commit is contained in:
parent
48b5b0c238
commit
d8988801c2
@ -1,79 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copyright 2014 The Kubernetes Authors.
|
|
||||||
#
|
|
||||||
# Licensed 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 finds, caches, and prints a list of all directories that hold
|
|
||||||
# *.go files. If any directory is newer than the cache, re-find everything and
|
|
||||||
# update the cache. Otherwise use the cached file.
|
|
||||||
|
|
||||||
set -o errexit
|
|
||||||
set -o nounset
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
if [[ -z "${1:-}" ]]; then
|
|
||||||
echo "usage: $0 <cache-file>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
CACHE="$1"; shift
|
|
||||||
|
|
||||||
trap 'rm -f "${CACHE}"' HUP INT TERM ERR
|
|
||||||
|
|
||||||
# This is a partial 'find' command. The caller is expected to pass the
|
|
||||||
# remaining arguments.
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# kfind -type f -name foobar.go
|
|
||||||
function kfind() {
|
|
||||||
# We want to include the "special" vendor directories which are actually
|
|
||||||
# part of the Kubernetes source tree (./staging/*) but we need them to be
|
|
||||||
# named as their ./vendor/* equivalents. Also, we do not want all of
|
|
||||||
# ./vendor nor ./hack/tools/vendor nor even all of ./vendor/k8s.io.
|
|
||||||
find -H . \
|
|
||||||
\( \
|
|
||||||
-not \( \
|
|
||||||
\( \
|
|
||||||
-name '_*' -o \
|
|
||||||
-name '.[^.]*' -o \
|
|
||||||
\( \
|
|
||||||
-name 'vendor' \
|
|
||||||
-type d \
|
|
||||||
\) -o \
|
|
||||||
\( \
|
|
||||||
-name 'testdata' \
|
|
||||||
-type d \
|
|
||||||
\) \
|
|
||||||
\) -prune \
|
|
||||||
\) \
|
|
||||||
\) \
|
|
||||||
"$@" \
|
|
||||||
| sed 's|^./staging/src|vendor|'
|
|
||||||
}
|
|
||||||
|
|
||||||
# It's *significantly* faster to check whether any directories are newer than
|
|
||||||
# the cache than to blindly rebuild it.
|
|
||||||
if [[ -f "${CACHE}" && -n "${CACHE}" ]]; then
|
|
||||||
N=$(kfind -type d -newer "${CACHE}" -print -quit | wc -l)
|
|
||||||
if [[ "${N}" == 0 ]]; then
|
|
||||||
cat "${CACHE}"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p "$(dirname "${CACHE}")"
|
|
||||||
kfind -type f -name \*.go \
|
|
||||||
| sed 's|/[^/]*$||' \
|
|
||||||
| sed 's|^./||' \
|
|
||||||
| LC_ALL=C sort -u \
|
|
||||||
| tee "${CACHE}"
|
|
@ -24,6 +24,7 @@ KUBE_VERBOSE="${KUBE_VERBOSE:-1}"
|
|||||||
|
|
||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
cd "${KUBE_ROOT}"
|
||||||
|
|
||||||
kube::golang::setup_env
|
kube::golang::setup_env
|
||||||
|
|
||||||
@ -41,6 +42,44 @@ if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
|||||||
kube::log::status "DBG: starting generated_files"
|
kube::log::status "DBG: starting generated_files"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# This is a partial 'find' command. The caller is expected to pass the
|
||||||
|
# remaining arguments.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# kfind -type f -name foobar.go
|
||||||
|
function kfind() {
|
||||||
|
# We want to include the "special" vendor directories which are actually
|
||||||
|
# part of the Kubernetes source tree (./staging/*) but we need them to be
|
||||||
|
# named as their ./vendor/* equivalents. Also, we do not want all of
|
||||||
|
# ./vendor nor ./hack/tools/vendor nor even all of ./vendor/k8s.io.
|
||||||
|
find -H . \
|
||||||
|
\( \
|
||||||
|
-not \( \
|
||||||
|
\( \
|
||||||
|
-name '_*' -o \
|
||||||
|
-name '.[^.]*' -o \
|
||||||
|
\( \
|
||||||
|
-name 'vendor' \
|
||||||
|
-type d \
|
||||||
|
\) -o \
|
||||||
|
\( \
|
||||||
|
-name 'testdata' \
|
||||||
|
-type d \
|
||||||
|
\) \
|
||||||
|
\) -prune \
|
||||||
|
\) \
|
||||||
|
\) \
|
||||||
|
"$@" \
|
||||||
|
| sed 's|^./staging/src|vendor|'
|
||||||
|
}
|
||||||
|
|
||||||
|
function find_all_go_dirs() {
|
||||||
|
kfind -type f -name \*.go \
|
||||||
|
| sed 's|/[^/]*$||' \
|
||||||
|
| sed 's|^./||' \
|
||||||
|
| LC_ALL=C sort -u
|
||||||
|
}
|
||||||
|
|
||||||
# This variable holds a list of every directory that contains Go files in this
|
# This variable holds a list of every directory that contains Go files in this
|
||||||
# project. Other rules and variables can use this as a starting point to
|
# project. Other rules and variables can use this as a starting point to
|
||||||
# reduce filesystem accesses.
|
# reduce filesystem accesses.
|
||||||
@ -48,8 +87,7 @@ if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
|||||||
kube::log::status "DBG: finding all *.go dirs"
|
kube::log::status "DBG: finding all *.go dirs"
|
||||||
fi
|
fi
|
||||||
ALL_GO_DIRS=()
|
ALL_GO_DIRS=()
|
||||||
kube::util::read-array ALL_GO_DIRS < \
|
kube::util::read-array ALL_GO_DIRS < <(find_all_go_dirs)
|
||||||
<(hack/make-rules/helpers/cache_go_dirs.sh .make/all_go_dirs)
|
|
||||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||||
kube::log::status "DBG: found ${#ALL_GO_DIRS[@]} *.go dirs"
|
kube::log::status "DBG: found ${#ALL_GO_DIRS[@]} *.go dirs"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user