Write a parallel (godeps) _workspace tree to hold all the missing files.

godeps doesn't get everything we want, so fix the problem but write it
to a parallel tree since _workspace is reserved only for godeps auto-generated
files.
pull/6/head
David McMahon 2016-03-22 16:51:30 -07:00
parent 2c5ece3534
commit 3e613ee341
2 changed files with 13 additions and 6 deletions

View File

@ -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
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_SRC}/${dir_root} -xdev -follow \
-maxdepth ${find_maxdepth} -type f "${find_names[@]}"))
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

View File

@ -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