summaryrefslogtreecommitdiff
path: root/hack
diff options
context:
space:
mode:
authorgy95 <1015105054@qq.com>2022-11-22 10:26:07 +0800
committergy95 <1015105054@qq.com>2022-11-22 10:26:07 +0800
commit954b0b911a6aa67a06a307612f2a662b6ec13d53 (patch)
tree8f51c608cc9ed1df354a2d56f7e0fde9ef84e33f /hack
parentMerge pull request #4348 from my-git9/profileimage (diff)
downloadkubeedge-954b0b911a6aa67a06a307612f2a662b6ec13d53.tar.gz
fix update-vendor-licence: No license could be found for package A dir only contains A/v2 dir
Signed-off-by: gy95 <1015105054@qq.com>
Diffstat (limited to 'hack')
-rwxr-xr-xhack/update-vendor-licenses.sh34
1 files changed, 10 insertions, 24 deletions
diff --git a/hack/update-vendor-licenses.sh b/hack/update-vendor-licenses.sh
index 071d17d2e..0119f4f74 100755
--- a/hack/update-vendor-licenses.sh
+++ b/hack/update-vendor-licenses.sh
@@ -192,8 +192,10 @@ if [ -f "${LICENSE_ROOT}/LICENSE" ]; then
mv "${TMP_LICENSE_FILE}" "${TMP_LICENSES_DIR}/LICENSE"
fi
+# Capture all module dependencies
+modules=$(go list -m -json all | jq -r .Path | sort -f)
# Loop through every vendored package
-for PACKAGE in $(go list -m -json all | jq -r .Path | sort -f); do
+for PACKAGE in ${modules}; do
if [[ -e "staging/src/${PACKAGE}" ]]; then
echo "${PACKAGE} is a staging package, skipping" >&2
continue
@@ -202,31 +204,15 @@ for PACKAGE in $(go list -m -json all | jq -r .Path | sort -f); do
echo "${PACKAGE} doesn't exist in ${DEPS_DIR}, skipping" >&2
continue
fi
- # Skip a directory if 1) it has no files and 2) all the subdirectories contain a go.mod file.
- misses_go_mod=false
- DEPS_SUBDIR="${DEPS_DIR}/${PACKAGE}"
- search_for_mods () {
- if [[ -z "$(find "${DEPS_SUBDIR}/" -mindepth 1 -maxdepth 1 -type f)" ]]; then
- while read -d "" -r SUBDIR; do
- if [[ ! -e "${SUBDIR}/go.mod" ]]; then
- DEPS_SUBDIR=${SUBDIR}
- search_for_mods
- fi
- done < <(find "${DEPS_SUBDIR}/" -mindepth 1 -maxdepth 1 -type d -print0)
- else
- misses_go_mod=true
- fi
- }
- search_for_mods
- if [[ $misses_go_mod = false ]]; then
- echo "${PACKAGE} has no files, skipping" >&2
+ # if there are no files vendored under this package...
+ if [[ -z "$(find "${DEPS_DIR}/${PACKAGE}" -mindepth 1 -maxdepth 1 -type f)" ]]; then
+ # and we have the same number of submodules as subdirectories...
+ if [[ "$(find "${DEPS_DIR}/${PACKAGE}/" -mindepth 1 -maxdepth 1 -type d | wc -l)" -eq "$(echo "${modules}" | grep -cE "^${PACKAGE}/")" ]]; then
+ echo "Only submodules of ${PACKAGE} are vendored, skipping" >&2
continue
+ fi
fi
- if [[ "${PACKAGE}" = "go.etcd.io/etcd" ]]; then
- # temporarily treat this way until find out a better rule
- echo "${PACKAGE}, temporarily skipping" >&2
- continue
- fi
+
echo "${PACKAGE}"
process_content "${PACKAGE}" LICENSE