Merge pull request #319 from kadel/glide

Switch from godep to glide
This commit is contained in:
Suraj Deshmukh
2016-12-16 13:40:40 +05:30
committed by GitHub
865 changed files with 17027 additions and 81707 deletions
+70
View File
@@ -0,0 +1,70 @@
#!/bin/bash
# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Check if there are nested vendor dirs inside Kompose vendor.
# All dependencies should be flattened and there shouldn't be vendor in inside vendor.
function check_nested_vendor() {
echo "Checking if there are nested vendor dirs"
# count all vendor directories inside Kompose vendor
NO_NESTED_VENDORS=$(find vendor/ -type d | sed 's/^[^/]*.//g' | grep -E "vendor$" | grep -v _vendor | wc -l)
if [ $NO_NESTED_VENDORS -ne 0 ]; then
echo "ERROR"
echo " There are $NO_NESTED_VENDORS nested vendors in Kompose vendor directory"
echo " Please run 'glide update --strip-vendor'"
return 1
else
echo "OK"
return 0
fi
}
# Check if Kompose vendor directory was cleaned by glide-vc
function check_glide-vc() {
echo "Checking if vendor was cleaned using glide-vc."
# dry run glide-vc and count how many could be deleted.
NO_DELETED_FILES=$($GOPATH/bin/glide-vc --only-code --no-tests --dryrun | wc -l)
if [ $NO_DELETED_FILES -ne 0 ]; then
echo "ERROR"
echo " There are $NO_DELETED_FILES files that can be deleted by glide-vc."
echo " Please run 'glide-vc --only-code --no-tests'"
return 1
else
echo "OK"
return 0
fi
}
# Run both checks and exit report fail exit code if one of them failed.
check_nested_vendor
VENDOR_CHECK=$?
check_glide-vc
VC_CHECK=$?
if [ $VENDOR_CHECK -eq 0 ] && [ $VC_CHECK -eq 0 ]; then
exit 0
else
exit 1
fi
-44
View File
@@ -1,44 +0,0 @@
#!/bin/bash
# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# inspired by: https://github.com/openshift/origin/blob/master/hack/godep-restore.sh
# Sometimes godep needs 'other' remotes. So add those remotes
preload-remote() {
local orig_org="$1"
local orig_project="$2"
local alt_org="$3"
local alt_project="$4"
# Go get stinks, which is why we have the || true...
go get -d "${orig_org}/${orig_project}" &>/dev/null || true
repo_dir="${GOPATH}/src/${orig_org}/${orig_project}"
pushd "${repo_dir}" > /dev/null
git remote add "${alt_org}-remote" "https://${alt_org}/${alt_project}.git" > /dev/null || true
git remote update > /dev/null
popd > /dev/null
}
echo "Preloading some dependencies"
# OpenShift requires its own Kubernets fork :-(
preload-remote "k8s.io" "kubernetes" "github.com/openshift" "kubernetes"
# OpenShift requires its own glog fork
preload-remote "github.com/golang" "glog" "github.com/openshift" "glog"
echo "Starting to download all godeps. This takes a while"
godep restore
echo "Download finished into ${GOPATH}"