Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix hack/update-vendor-licenses.sh on macOS #79314

Merged
merged 2 commits into from
Jun 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions hack/lib/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,15 @@ function kube::util::require-jq {
fi
}

# outputs md5 hash of $1, works on macOS and Linux
function kube::util::md5() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a 1:1 copy of kube::release:md5, it's such a trivial method that it didn't seem particularly worth deduping even, but we don't want to source the whole release machinery in update-vendor-licenses.sh

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(see build/lib/release.sh)

I can't find any consumers of kube::release::md5 but I'm wary of potentially breaking some script elsewhere (k/release??) and removing it would be a somewhat orthogonal change.

if which md5 >/dev/null 2>&1; then
md5 -q "$1"
else
md5sum "$1" | awk '{ print $1 }'
fi
}

# kube::util::read-array
# Reads in stdin and adds it line by line to the array provided. This can be
# used instead of "mapfile -t", and is bash 3 compatible.
Expand Down
4 changes: 2 additions & 2 deletions hack/update-vendor-licenses.sh
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ echo "= Kubernetes licensed under: ="
echo
cat "${LICENSE_ROOT}/LICENSE"
echo
echo "= LICENSE $(md5sum < "${LICENSE_ROOT}/LICENSE" | awk '{print $1}')"
echo "= LICENSE $(kube::util::md5 "${LICENSE_ROOT}/LICENSE")"
echo "================================================================================"
) > ${TMP_LICENSE_FILE}

Expand Down Expand Up @@ -211,7 +211,7 @@ __EOF__
cat "${file}"

echo
echo "= ${file} $(md5sum < "${file}" | awk '{print $1}')"
echo "= ${file} $(kube::util::md5 "${file}")"
echo "================================================================================"
echo
done >> ${TMP_LICENSE_FILE}
Expand Down