1 Commits
Author SHA1 Message Date
Joshua Bussdieker 36f89d570e Placeholder for import command 2012-03-18 01:32:29 -07:00
9 changed files with 51 additions and 95 deletions
+1 -1
View File
@@ -1 +1 @@
1.0.13
1.0.10
+14 -7
View File
@@ -20,7 +20,7 @@ fi
$GVM_ROOT/scripts/gvm-check
if [[ "$?" != "0" ]]; then
display_error "Missing requirements."
display_error "Missing requirements. Please see messages above"
fi
if [[ $command == "version" ]]; then
@@ -32,12 +32,20 @@ else
elif [[ -n $command ]]; then
display_error "Unrecognized command line argument: '$command'"
else
echo "Usage: gvm [command]
echo "= gvm
Description:
GVM is the Go Version Manager
* http://github.com/moovweb/gvm
== DESCRIPTION:
GVM is the Go Version Manager
== Usage
gvm Command
== Command
Commands:
version - print the gvm version number
get - gets the latest code (for debugging)
use - select a go version to use
@@ -47,7 +55,6 @@ Commands:
uninstall - uninstall go versions
list - list installed go versions
listall - list available versions
pkgset - manage go packages sets
"
pkgset - manage go packages sets"
fi
fi
-26
View File
@@ -16,26 +16,6 @@ update_profile() {
fi
}
check_existing_go() {
if [ "$GOROOT" == "" ]; then
echo "No existing Go versions detected"
return
fi
echo "Created profile for existing install of Go at $GOROOT"
mkdir -p $GVM_DEST/$GVM_NAME/environments &> /dev/null || display_error "Failed to create environment directory"
mkdir -p $GVM_DEST/$GVM_NAME/pkgsets/system/global &> /dev/null || display_error "Failed to create new package set"
mkdir -p $GVM_DEST/$GVM_NAME/gos/system &> /dev/null || display_error "Failed to create new Go folder"
cat << EOF > $GVM_DEST/$GVM_NAME/environments/system
# Automatically generated file. DO NOT EDIT!
export GVM_ROOT; GVM_ROOT="$GVM_DEST/$GVM_NAME"
export gvm_go_name; gvm_go_name="system"
export gvm_pkgset_name; gvm_pkgset_name="global"
export GOROOT; GOROOT="$GOROOT"
export GOPATH; GOPATH="$GVM_DEST/$GVM_NAME/pkgsets/system/global"
export PATH; PATH="$GVM_DEST/$GVM_NAME/pkgsets/system/global:$GOROOT/bin:$GVM_ROOT/bin:\$PATH"
EOF
}
BRANCH=$1
GVM_DEST=$2
if [ "$GVM_DEST" == "" ]; then
@@ -50,11 +30,6 @@ SRC_REPO=https://github.com/moovweb/gvm.git
[ "$GVM_DEST" == "" ] && display_error "No destination specified!"
[ -d $GVM_DEST/$GVM_NAME ] && display_error "Already installed!"
[ -d $GVM_DEST ] || mkdir -p $GVM_DEST > /dev/null 2>&1 || display_error "Failed to create $GVM_DEST"
[ -z `which git` ] && display_error "Could not find git
linux: apt-get install git
mac: brew install git
"
cd $GVM_DEST && git clone $SRC_REPO $GVM_NAME > /dev/null 2>&1 ||
display_error "Failed to clone from $SRC_REPO into $GVM_DEST/$GVM_NAME"
@@ -90,7 +65,6 @@ if [ "$?" != "0" ]; then
fi
echo "export GVM_ROOT=$GVM_DEST/$GVM_NAME" > $GVM_DEST/$GVM_NAME/scripts/gvm
echo ". \$GVM_ROOT/scripts/gvm-default" >> $GVM_DEST/$GVM_NAME/scripts/gvm
check_existing_go
[[ -s "$GVM_DEST/$GVM_NAME/scripts/gvm" ]] && source "$GVM_DEST/$GVM_NAME/scripts/gvm"
echo "Installed GVM v${GVM_VERSION}"
echo
-1
View File
@@ -1 +0,0 @@
git://github.com/moovweb
-1
View File
@@ -24,7 +24,6 @@ function gvm_pkgset_use() {
fuzzy_match=`ls $GVM_ROOT/environments | sort | grep "$gvm_go_name@" | grep "$1" | head -n 1` ||
display_error "Invalid package set" || return 1
export PATH=$GVM_PATH_BACKUP
. "$GVM_ROOT/environments/$fuzzy_match" ||
display_error "Failed to source the package set environment" || return 1
+5 -27
View File
@@ -1,37 +1,15 @@
#!/bin/bash
. $GVM_ROOT/scripts/functions
# Check for hg
[ -z `which hg` ] &&
display_warning "Could not find mercurial
linux: apt-get install mercurial
mac: brew install mercurial
" && exit 1
# Check for ar
display_error '* Could not find mercurial (try `sudo apt-get install mercurial`)'
[ -z `which ar` ] &&
display_warning "Could not find binutils
linux: apt-get install binutils
" && exit 1
# Check for bison
display_error '* Could not find binutils (try `sudo apt-get install binutils (or binutils-multiarch)`)'
[ -z `which bison` ] &&
display_warning "Could not find bison
linux: apt-get install bison
" && exit 1
# Check for gcc
display_error '* Could not find bison (try `sudo apt-get install bison`)'
[ -z `which gcc` ] &&
display_warning "Could not find gcc
linux: apt-get install gcc
" && exit 1
# Check for make
display_error '* Could not find gcc (try `sudo apt-get install gcc`)'
[ -z `which make` ] &&
display_warning "Could not find make
display_error '* Could not find make (try `sudo apt-get install make`)'
linux: apt-get install make
" && exit 1
# All good!
exit 0
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
. $GVM_ROOT/scripts/functions
+25 -30
View File
@@ -3,35 +3,25 @@
function show_usage() {
echo "Usage: gvm install [version] [options]"
echo " -s, --source=SOURCE Install Go from specified source."
echo " -pb, --with-protobuf Install Go protocol buffers."
echo " -h, --help Display this message."
echo " -s, --source=SOURCE Install Go from specified source."
echo " -h, --help Display this message."
}
read_command_line() {
VERSION=$1
if [ "${VERSION:0:1}" != "-" ]; then
shift
else
display_warning "Invalid version: $1"
show_usage
exit 1
fi
shift
GO_SOURCE_URL=https://go.googlecode.com/hg/
for i in $*; do
case $i in
-s=*|--source=*)
GO_SOURCE_URL=$i
;;
-pb|--with-protobuf)
INSTALL_PB="true"
;;
-h|--help)
-h|--help*)
show_usage
exit 0
;;
*)
display_warning "Invalid option $i"
echo "Invalid option $i"
show_usage
exit 65 # Bad arguments
;;
@@ -48,7 +38,7 @@ download_source() {
}
check_tag() {
version=`hg tags -R $GO_CACHE_PATH | awk '{print $1}' | sort | grep "$VERSION" | head -n 1 | grep "$VERSION"`
version=`hg tags -R $GO_CACHE_PATH | awk '{print $1}' | sort | grep $VERSION | head -n 1 | grep $VERSION`
}
update_source() {
@@ -91,11 +81,11 @@ create_enviroment() {
install_go() {
GO_INSTALL_ROOT=$GVM_ROOT/gos/$version
trap 'rm -rf $GO_INSTALL_ROOT; display_error "Canceled!"' INT
#trap 'rm -rf $GO_INSTALL_ROOT; display_error "Canceled!"' INT
# Check for existing install
if [ -d "$GO_INSTALL_ROOT" ]; then
[ -f "$GO_INSTALL_ROOT/manifest" ] &&
if [ -d $GO_INSTALL_ROOT ]; then
[ -f $GO_INSTALL_ROOT/manifest ] &&
display_error "Already installed!"
display_warning "Removing corrupt install..."
gvm uninstall $version
@@ -114,26 +104,34 @@ install_go() {
install_gpkg() {
display_message " * Installing gpkg..."
$GVM_GOINSTALL github.com/moovweb/gpkg > $GVM_ROOT/logs/$version-gpkg.log 2>&1 || return 1
$GVM_GOINSTALL github.com/moovweb/gpkg > $GVM_ROOT/logs/$version-gpkg.log 2>&1
if [[ $? -ne 0 ]]; then
echo "Failed to install gpkg"
return 1
fi
}
install_gb() {
display_message " * Installing gb..."
$GVM_GOINSTALL github.com/jbussdieker/go-gb/gb > $GVM_ROOT/logs/$version-gb.log 2>&1 || return 1
$GVM_GOINSTALL github.com/jbussdieker/go-gb/gb > $GVM_ROOT/logs/$version-gb.log 2>&1
if [[ $? -ne 0 ]]; then
echo "Failed to install gb"
return 1
fi
}
install_goprotobuf() {
display_message " * Installing goprotobuf..."
$GVM_GOINSTALL goprotobuf.googlecode.com/hg/proto > $GVM_ROOT/logs/$version-pb-compiler.log 2>&1
if [[ $? -ne 0 ]]; then
display_warning "Failed to install goprotobuf"
echo "Failed to install goprotobuf"
return 1
fi
#if [[ $version == "release.r60.3" ]]; then
cd $GVM_ROOT/gos/$version/src/pkg/goprotobuf.googlecode.com/hg/compiler
make install >> $GVM_ROOT/logs/$version-pb-compiler.log 2>&1
if [[ $? -ne 0 ]]; then
display_warning "Failed to install goprotobuf compiler"
echo "Failed to install goprotobuf compiler"
return 1
fi
#fi
@@ -142,21 +140,18 @@ install_goprotobuf() {
main() {
trap 'display_error "Canceled!"' INT
read_command_line $@
[ "$VERSION" == "" ] && display_error "No version specified"
[ -z $VERSION ] && display_error "No version specified"
download_source
check_tag || (update_source && check_tag) || display_error "Unrecognized Go version"
install_go
GVM_GOINSTALL="goinstall"
which goinstall &> /dev/null ||
GVM_GOINSTALL="go get"
x="`hg tags -R ~/.gvm/archive/go`"; echo ${x#*b0819469a6df} | grep "$version " &> /dev/null
if [[ "$?" == "1" ]]; then
install_gb || display_warning "Failed to install gb"
install_gpkg || display_warning "Failed to install gpkg"
if [ "$INSTALL_PB" == "true" ]; then
install_goprotobuf
fi
install_gpkg
install_gb
install_goprotobuf
fi
cd $GO_INSTALL_ROOT && find . > manifest
}
+2 -2
View File
@@ -13,8 +13,8 @@ cp $GVM_ROOT/environments/$gvm_go_name $GVM_ROOT/environments/$gvm_go_name@$1 ||
display_error "Could copy environment"
echo "export gvm_pkgset_name=\"$1\"" >> $GVM_ROOT/environments/$gvm_go_name@$1 ||
display_error "Could not extend environment"
echo "export GOPATH; GOPATH=\"$GVM_ROOT/pkgsets/$gvm_go_name/$1:\$GOPATH\"" >> $GVM_ROOT/environments/$gvm_go_name@$1 ||
echo "export GOPATH; GOPATH=\"$GVM_ROOT/pkgsets/release.r60.3/$1:\$GOPATH\"" >> $GVM_ROOT/environments/$gvm_go_name@$1 ||
display_error "Could not extend environment"
echo "export PATH; PATH=\"$GVM_ROOT/pkgsets/$gvm_go_name/$1/bin:\$PATH\"" >> $GVM_ROOT/environments/$gvm_go_name@$1 ||
echo "export PATH; PATH=\"$GVM_ROOT/pkgsets/release.r60.3/$1/bin:\$PATH\"" >> $GVM_ROOT/environments/$gvm_go_name@$1 ||
display_error "Could not extend environment"