Merge pull request #538 from Random-Liu/improve-update-vendor

Change hack/update-vendor.sh to sync again with new vendor
This commit is contained in:
Lantao Liu 2018-01-11 16:32:26 -08:00 committed by GitHub
commit 859fb747d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,15 +21,15 @@ set -o pipefail
source $(dirname "${BASH_SOURCE[0]}")/utils.sh source $(dirname "${BASH_SOURCE[0]}")/utils.sh
cd ${ROOT} cd ${ROOT}
echo "Compare vendor with hack/versions..." update_hack_versions() {
need_update=false need_update=false
declare -A map=() declare -A map=()
map["RUNC_VERSION"]="github.com/opencontainers/runc" map["RUNC_VERSION"]="github.com/opencontainers/runc"
map["CNI_VERSION"]="github.com/containernetworking/cni" map["CNI_VERSION"]="github.com/containernetworking/cni"
map["CONTAINERD_VERSION"]="github.com/containerd/containerd" map["CONTAINERD_VERSION"]="github.com/containerd/containerd"
map["KUBERNETES_VERSION"]="k8s.io/kubernetes" map["KUBERNETES_VERSION"]="k8s.io/kubernetes"
for key in ${!map[@]} for key in ${!map[@]}
do do
vendor_commitid=$(grep ${map[${key}]} vendor.conf | awk '{print $2}') vendor_commitid=$(grep ${map[${key}]} vendor.conf | awk '{print $2}')
version_commitid=$(grep ${key} hack/versions | awk -F "=" '{print $2}') version_commitid=$(grep ${key} hack/versions | awk -F "=" '{print $2}')
if [ ${vendor_commitid} != ${version_commitid} ]; then if [ ${vendor_commitid} != ${version_commitid} ]; then
@ -41,12 +41,16 @@ do
sed -i "s/\b${version_commitid}$/${vendor_commitid}/g" hack/versions sed -i "s/\b${version_commitid}$/${vendor_commitid}/g" hack/versions
fi fi
fi fi
done done
if [ ${need_update} = true ]; then if [ ${need_update} = true ]; then
echo "Please update \"hack/versions\" by executing \"hack/update-vendor.sh\"!" echo "Please update \"hack/versions\" by executing \"hack/update-vendor.sh\"!"
exit 1 exit 1
fi fi
}
echo "Compare vendor with hack/versions..."
update_hack_versions
# hack/versions should be correct now. # hack/versions should be correct now.
echo "Compare vendor with containerd vendors..." echo "Compare vendor with containerd vendors..."
@ -91,6 +95,9 @@ if ! diff vendor.conf ${tmp_vendor} > /dev/null; then
fi fi
rm ${containerd_vendor} rm ${containerd_vendor}
echo "Compare new vendor with hack/versions..."
update_hack_versions
echo "Sort vendor.conf..." echo "Sort vendor.conf..."
sort vendor.conf -o vendor.conf sort vendor.conf -o vendor.conf