File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434EOF
3535}
3636
37+ is_in_use () {
38+ [[ -e " $1 /.git/index.lock" || -e " $1 /.hg/store/lock" || -e " $1 /.bzr/checkout/lock" ]]
39+ }
40+
3741# Iterates over Godep file dependencies and sets
3842# the specified version on each of them.
3943set_dependencies () {
@@ -42,16 +46,20 @@ set_dependencies() {
4246 while read package version; do
4347 (
4448 local install_path=" ${GOPATH%%:* } /src/${package%%/ ...} "
45- [[ -e " $install_path /.git/index.lock" ||
46- -e " $install_path /.hg/store/lock" ||
47- -e " $install_path /.bzr/checkout/lock" ]] && wait
48-
4949 echo " >> Getting package " $package " "
50- go get -u -d " $package "
50+
51+ # Retries in case of possible race conditions when installing a package
52+ # dependency
53+ for (( i= 0 ; i< 5 ; i++ )) ; do
54+ out=$( go get -u -d " $package " 2>&1 > /dev/null) && break
55+ done
56+ [[ $? != 0 ]] && echo " -- Failed to get " $package " , error: " && echo " $out " && exit 1
5157
5258 echo " >> Setting $package to version $version "
5359 cd $install_path
54- [ -d .hg ] && hg update -q " $version "
60+ is_in_use $install_path && wait
61+
62+ [ -d .hg ] && hg update -q " $version "
5563 [ -d .git ] && git checkout -q " $version "
5664 [ -d .bzr ] && bzr revert -q -r " $version "
5765 [ -d .svn ] && svn update -r " $version "
You can’t perform that action at this time.
0 commit comments