diff --git a/hack/update-godep-licenses.sh b/hack/update-godep-licenses.sh index 7e92c18916..316b8f9bc0 100755 --- a/hack/update-godep-licenses.sh +++ b/hack/update-godep-licenses.sh @@ -73,6 +73,7 @@ process_content () { local ensure_pattern local package_root_url local dir_root + local godeps_root local find_maxdepth local find_names local -a local_files=() @@ -111,9 +112,14 @@ process_content () { # Find LOCAL files first - only root and package level for dir_root in ${package} ${package_root}; do - # One (set) of these is fine - local_files+=($(find ${GODEPS_SRC}/${dir_root} -xdev -follow \ - -maxdepth ${find_maxdepth} -type f "${find_names[@]}")) + for godeps_root in ${GODEPS_SRC} ${GODEPS_AUX}; do + [[ -d ${godeps_root}/${dir_root} ]] || continue + + # One (set) of these is fine + local_files+=($(find ${godeps_root}/${dir_root} \ + -xdev -follow -maxdepth ${find_maxdepth} \ + -type f "${find_names[@]}")) + done done # Uniquely sort the array IFS=$'\n' local_files=($(LC_ALL=C sort -u <<<"${local_files[*]-}")) @@ -143,9 +149,9 @@ process_content () { if [[ -n "${FILE_CONTENT[${package}-${type}]-}" ]]; then if ((CREATE_MISSING)); then - mkdir -p ${GODEPS_SRC}/${package_root} + mkdir -p ${GODEPS_AUX}/${package_root} echo "${FILE_CONTENT[${package}-${type}]}" \ - > ${GODEPS_SRC}/${package_root}/${f} + > ${GODEPS_AUX}/${package_root}/${f} fi break fi @@ -172,6 +178,7 @@ GODEPS_STATE="Godeps/.license_file_state" GODEPS_LICENSE_FILE=${1:-"Godeps/LICENSES"} GODEPS_SRC="Godeps/_workspace/src" +GODEPS_AUX="Godeps/_workspace_aux/src" declare -Ag FILE_CONTENT diff --git a/hack/verify-godep-licenses.sh b/hack/verify-godep-licenses.sh index 3223a83e7e..09c0244ab0 100755 --- a/hack/verify-godep-licenses.sh +++ b/hack/verify-godep-licenses.sh @@ -45,7 +45,7 @@ KUBE_ROOT="${_tmpdir}" "${KUBE_ROOT}/hack/update-godep-licenses.sh" # Compare Godep Licenses if ! _out="$(diff -Naupr ${KUBE_ROOT}/Godeps/LICENSES ${_tmpdir}/Godeps/LICENSES)"; then - echo "Your godep licenses file is out of date. Run hack/update-godep-licenses.sh and commit the results." + echo "Your godep licenses file is out of date. Run hack/update-godep-licenses.sh --create-missing and commit the results." echo "${_out}" exit 1 fi