github.com/soulinfo/etcd@v0.1.2-0.20130922053317-3a0a8c89e859/third_party/update (about)

     1  #!/bin/sh
     2  
     3  . ./deps
     4  
     5  export GOPATH=${PWD}
     6  
     7  for p in $packages; do
     8  	# this is the target directory
     9  	mkdir -p $p
    10  
    11  	# This will checkout the project into src
    12  	go get -u -d $p
    13  
    14  	# The go get path
    15  	gp=src/$p
    16  
    17  	# Attempt to find the commit hash of the repo
    18  	HEAD=
    19  	if [ -d $gp/.git ]; then
    20  		# Grab the head if it is git
    21  		HEAD=$(git --git-dir=$gp/.git rev-parse HEAD)
    22  	fi
    23  
    24  	# Grab the head if it is mercurial
    25  	if [ -d $gp/.hg ]; then
    26  		cd $gp
    27  		HEAD=$(hg id -i)
    28  		cd -
    29  	fi
    30  
    31  	# Copy the code into the final directory
    32  	rsync -a -z -r --exclude '.git/' --exclude '.hg/' src/$p/ $p
    33  
    34  	# Make a nice commit about what everything bumped to
    35  	git add $p
    36  	git commit -m "bump($p): $HEAD"
    37  done