mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-10 05:16:13 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a294b34e57 | ||
|
|
57c4a9eea7 | ||
|
|
4e117a3ab8 | ||
|
|
b0ffc5c3c5 | ||
|
|
71774a44ba | ||
|
|
5c78e3b5c5 | ||
|
|
d6c46161ee | ||
|
|
2dbe743a6f | ||
|
|
07211ed306 | ||
|
|
99579e9ada | ||
|
|
0eb9feb2aa | ||
|
|
292e24e1ea | ||
|
|
42f23a42db | ||
|
|
96fae148f2 | ||
|
|
2743e8a8a3 | ||
|
|
b050317920 | ||
|
|
e3d8ab9342 | ||
|
|
cb40ec511a | ||
|
|
004a4be87a | ||
|
|
4429234d51 | ||
|
|
ee8f6bd7c8 | ||
|
|
718f239a6c | ||
|
|
8db8d28e03 | ||
|
|
4ffe88c552 | ||
|
|
5b4da7cd20 | ||
|
|
225515360d | ||
|
|
96702949d7 | ||
|
|
ba20d967e0 | ||
|
|
b44a14bb35 | ||
|
|
06d266197d | ||
|
|
0cc983dec8 | ||
|
|
5b7c7d708b | ||
|
|
611925e4e7 | ||
|
|
33c8fb5a38 | ||
|
|
f57677b96a | ||
|
|
86af98f0af | ||
|
|
54df5d9ccd | ||
|
|
37e9eef1f0 | ||
|
|
252fcee6bd | ||
|
|
895f00603b | ||
|
|
d1b5a1721b | ||
|
|
a3bd04c4c9 | ||
|
|
aece4141b7 | ||
|
|
0f111283cc | ||
|
|
00ca5e9ce1 | ||
|
|
42b539cadb | ||
|
|
30e0fc52df | ||
|
|
e5d5641e31 | ||
|
|
52a6e4afc9 | ||
|
|
3a5813784e | ||
|
|
12b1d1a254 |
@@ -1,3 +1,7 @@
|
||||
Fri Apr 6 04:06:29 PDT 2012 Joshua Bussdieker <jbussdieker@gmail.com>
|
||||
|
||||
* Created automake template
|
||||
|
||||
Version: 1.0.x
|
||||
State: LTR
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
Copyright (C) 2012 Moov Corp.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
EXTRA_INSTALL = scripts/
|
||||
|
||||
gvmdir = $(bindir)/
|
||||
gvm_SCRIPTS = bin/gvm
|
||||
install_dir = $(prefix)/gvm
|
||||
|
||||
install-exec-hook:
|
||||
(mkdir -p $(install_dir) ; \
|
||||
cp -rf . $(install_dir))
|
||||
|
||||
#install-data-hook:
|
||||
# (mkdir -p $(help_dir) ; \
|
||||
# cp -f *_help.txt $(help_dir))
|
||||
@@ -0,0 +1,72 @@
|
||||
# gvm
|
||||
by Josh Bussdieker (jbuss, jaja, jbussdieker)
|
||||
|
||||
GVM provides an interface to manage Go versions.
|
||||
|
||||
Features
|
||||
========
|
||||
* Install/Uninstall Go versions with `gvm install [tag]` where tag is "60.3", "go1", "weekly.2011-11-08", or "tip"
|
||||
* List added/removed files in GOROOT with `gvm diff`
|
||||
* Manage GOPATHs with `gvm pkgset [create/use/delete] [name]`
|
||||
* List latest release tags with `gvm listall`. Use `--all` to list weekly as well.
|
||||
* Cache a clean copy of the latest Go source for multiple version installs.
|
||||
|
||||
Background
|
||||
==========
|
||||
When we started developing in Go mismatched dependencies and API changes plauged our build process and made it extremely difficult to merge with other peoples changes.
|
||||
|
||||
After nuking my entire GOROOT several times and rebuilding I decided to come up with a tool to oversee the process. It eventually evolved into what gvm is today.
|
||||
|
||||
Installing
|
||||
==========
|
||||
|
||||
To install:
|
||||
|
||||
bash < <(curl -s https://raw.github.com/moovweb/gvm/master/binscripts/gvm-installer)
|
||||
|
||||
Installing Go
|
||||
=============
|
||||
gvm install go1
|
||||
gvm use go1 [--default]
|
||||
Once this is done Go will be in the path and ready to use. $GOROOT and $GOPATH are set automatically.
|
||||
|
||||
You are now ready to create and use packages built using gpkg. Instructions can be found at http://github.com/moovweb/gpkg
|
||||
|
||||
List Go Versions
|
||||
================
|
||||
To list all installed Go versions (The current version is prefixed with "=>"):
|
||||
|
||||
gvm list
|
||||
|
||||
Uninstalling
|
||||
============
|
||||
To completely remove gvm and all installed Go versions and packages:
|
||||
|
||||
gvm implode
|
||||
|
||||
If that doesn't work see the troubleshooting steps at the bottom of this page.
|
||||
|
||||
Mac OS X Requirements
|
||||
====================
|
||||
Install mercurial from http://mercurial.berkwood.com/
|
||||
|
||||
Linux Requirements
|
||||
==================
|
||||
sudo apt-get install curl
|
||||
sudo apt-get install git
|
||||
sudo apt-get install mercurial
|
||||
sudo apt-get install make
|
||||
sudo apt-get install binutils
|
||||
sudo apt-get install bison
|
||||
sudo apt-get install gcc
|
||||
|
||||
FreeBSD Requirements
|
||||
====================
|
||||
|
||||
sudo pkg_add -r bash
|
||||
sudo pkg_add -r git
|
||||
sudo pkg_add -r mercurial
|
||||
|
||||
Troubleshooting
|
||||
===============
|
||||
Sometimes especially during upgrades the state of gvm's files can get mixed up. This is mostly true for upgrade from older version than 0.0.8. Changes are slowing down and a LTR is imminent. But for now `rm -rf ~/.gvm` will always remove gvm. Stay tuned!
|
||||
@@ -1,10 +1,11 @@
|
||||
# gvm
|
||||
by Josh Bussdieker (jbuss, jaja, jbussdieker)
|
||||
|
||||
GVM provides an interface to manage Go versions.
|
||||
|
||||
Features
|
||||
========
|
||||
* Install/Uninstall Go versions with `gvm install [tag]` where tag is "60.3", "weekly.2011-11-08", or "tip"
|
||||
* Install/Uninstall Go versions with `gvm install [tag]` where tag is "60.3", "go1", "weekly.2011-11-08", or "tip"
|
||||
* List added/removed files in GOROOT with `gvm diff`
|
||||
* Manage GOPATHs with `gvm pkgset [create/use/delete] [name]`
|
||||
* List latest release tags with `gvm listall`. Use `--all` to list weekly as well.
|
||||
@@ -25,12 +26,10 @@ To install:
|
||||
|
||||
Installing Go
|
||||
=============
|
||||
gvm install 60.3
|
||||
gvm use 60.3
|
||||
gvm install go1
|
||||
gvm use go1 [--default]
|
||||
Once this is done Go will be in the path and ready to use. $GOROOT and $GOPATH are set automatically.
|
||||
|
||||
You are now ready to create and use packages built using gpkg. Instructions can be found at http://github.com/moovweb/gpkg
|
||||
|
||||
List Go Versions
|
||||
================
|
||||
To list all installed Go versions (The current version is prefixed with "=>"):
|
||||
@@ -43,9 +42,7 @@ To completely remove gvm and all installed Go versions and packages:
|
||||
|
||||
gvm implode
|
||||
|
||||
If that doesn't work see the troubleshooting steps at the bottom of this page.
|
||||
|
||||
Mac OSX Requirements
|
||||
Mac OS X Requirements
|
||||
====================
|
||||
Install mercurial from http://mercurial.berkwood.com/
|
||||
|
||||
@@ -59,6 +56,10 @@ Linux Requirements
|
||||
sudo apt-get install bison
|
||||
sudo apt-get install gcc
|
||||
|
||||
Troubleshooting
|
||||
===============
|
||||
Sometimes especially during upgrades the state of gvm's files can get mixed up. This is mostly true for upgrade from older version than 0.0.8. Changes are slowing down and a LTR is imminent. But for now `rm -rf ~/.gvm` will always remove gvm. Stay tuned!
|
||||
FreeBSD Requirements
|
||||
====================
|
||||
|
||||
sudo pkg_add -r bash
|
||||
sudo pkg_add -r git
|
||||
sudo pkg_add -r mercurial
|
||||
|
||||
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
aclocal && automake --add-missing && autoconf && ./configure $@
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
if [ -z "$GVM_ROOT" ]; then
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
@@ -10,7 +10,7 @@ if [ -z "$GVM_ROOT" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. $GVM_ROOT/scripts/functions
|
||||
. $GVM_ROOT/scripts/functions || exit 1
|
||||
|
||||
command=$1
|
||||
if [[ $command == "implode" ]]; then
|
||||
@@ -20,7 +20,7 @@ fi
|
||||
|
||||
$GVM_ROOT/scripts/gvm-check
|
||||
if [[ "$?" != "0" ]]; then
|
||||
display_error "Missing requirements."
|
||||
display_fatal "Missing requirements."
|
||||
fi
|
||||
|
||||
if [[ $command == "version" ]]; then
|
||||
@@ -30,7 +30,7 @@ else
|
||||
shift
|
||||
$GVM_ROOT/scripts/$command $@
|
||||
elif [[ -n $command ]]; then
|
||||
display_error "Unrecognized command line argument: '$command'"
|
||||
display_fatal "Unrecognized command line argument: '$command'"
|
||||
else
|
||||
echo "Usage: gvm [command]
|
||||
|
||||
@@ -45,8 +45,10 @@ Commands:
|
||||
implode - completely remove gvm
|
||||
install - install go versions
|
||||
uninstall - uninstall go versions
|
||||
cross - install go cross compilers
|
||||
list - list installed go versions
|
||||
listall - list available versions
|
||||
alias - manage go version aliases
|
||||
pkgset - manage go packages sets
|
||||
"
|
||||
fi
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
function gvm_prompt() {
|
||||
if [[ "$1" == "g" ]]; then
|
||||
echo $gvm_go_name
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
display_error() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
@@ -45,7 +45,9 @@ else
|
||||
GVM_NAME="gvm"
|
||||
fi
|
||||
|
||||
SRC_REPO=https://github.com/moovweb/gvm.git
|
||||
if [ "$SRC_REPO" == "" ]; then
|
||||
SRC_REPO=https://github.com/moovweb/gvm.git
|
||||
fi
|
||||
|
||||
[ "$GVM_DEST" == "" ] && display_error "No destination specified!"
|
||||
[ -d $GVM_DEST/$GVM_NAME ] && display_error "Already installed!"
|
||||
@@ -56,7 +58,7 @@ SRC_REPO=https://github.com/moovweb/gvm.git
|
||||
mac: brew install git
|
||||
"
|
||||
|
||||
cd $GVM_DEST && git clone $SRC_REPO $GVM_NAME > /dev/null 2>&1 ||
|
||||
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"
|
||||
|
||||
if [ "$BRANCH" != "" ]; then
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
AC_INIT(gvm, m4_esyscmd([tr -d '\n' <VERSION]))
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_CONFIG_FILES([Makefile scripts/gvm])
|
||||
AC_OUTPUT
|
||||
@@ -0,0 +1,5 @@
|
||||
Package: gvm
|
||||
Version: 1.0.15
|
||||
Architecture: all
|
||||
Maintainer: Joshua Bussdieker <josh.bussdieker@moovweb.com>
|
||||
Description: Go Version Manager
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
command=$1
|
||||
if [[ -f $GVM_ROOT/scripts/alias-$command ]]; then
|
||||
shift
|
||||
$GVM_ROOT/scripts/alias-$command $@
|
||||
elif [[ -n $command ]]; then
|
||||
display_fatal "Unrecognized command line argument: '$command'"
|
||||
else
|
||||
echo "= gvm alias
|
||||
|
||||
* http://github.com/moovweb/gvm
|
||||
|
||||
== DESCRIPTION:
|
||||
|
||||
GVM alias is used to manage go version aliases
|
||||
|
||||
== Usage
|
||||
|
||||
gvm alias Command
|
||||
|
||||
== Command
|
||||
|
||||
create - create a new alias
|
||||
delete - delete an alias
|
||||
list - list aliases"
|
||||
fi
|
||||
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[[ $1 != "" ]] ||
|
||||
display_fatal "Please specifiy the alias name"
|
||||
|
||||
[[ $2 != "" ]] ||
|
||||
display_fatal "Please specifiy the go version name"
|
||||
|
||||
[[ ! -f "$GVM_ROOT/environments/$1" ]] ||
|
||||
display_fatal "Alias already exists!"
|
||||
[[ -f "$GVM_ROOT/environments/$2" ]] ||
|
||||
display_fatal "Target doesn't exist!"
|
||||
|
||||
mkdir -p $GVM_ROOT/environments ||
|
||||
display_fatal "Could not create folder"
|
||||
mkdir -p $GVM_ROOT/gos/$1 ||
|
||||
display_fatal "Could not create folder"
|
||||
cp $GVM_ROOT/environments/$2 $GVM_ROOT/environments/$1 ||
|
||||
display_fatal "Could copy environment"
|
||||
echo "export gvm_alias_name=\"$1\"" >> $GVM_ROOT/environments/$1 ||
|
||||
display_fatal "Could not extend environment"
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[[ $1 != "" ]] ||
|
||||
display_fatal "Please specifiy the name"
|
||||
|
||||
[[ -f $GVM_ROOT/environments/$1 ]] ||
|
||||
display_fatal "Alias doesn't exist!"
|
||||
|
||||
cat $GVM_ROOT/environments/$1 | $GREP_PATH "gvm_alias_name" > /dev/null ||
|
||||
display_fatal "$1 is not an alias!"
|
||||
|
||||
rm -rf $GVM_ROOT/environments/$1 ||
|
||||
display_fatal "Could not delete alias"
|
||||
|
||||
rm -rf $GVM_ROOT/gos/$1 ||
|
||||
display_fatal "Could not delete alias"
|
||||
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
echo
|
||||
display_message "gvm go aliases"
|
||||
echo
|
||||
|
||||
for a in $(cd $GVM_ROOT/environments ; grep -l "gvm_alias_name" *); do
|
||||
t=$(sh -c ". $GVM_ROOT/environments/$a ; echo \$gvm_go_name")
|
||||
echo " $a ($t)"
|
||||
done
|
||||
echo
|
||||
|
||||
+7
-5
@@ -1,3 +1,5 @@
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
_gvm()
|
||||
{
|
||||
local cur prev opts base
|
||||
@@ -13,7 +15,7 @@ _gvm()
|
||||
use|delete|empty)
|
||||
[[ "$gvm_go_name" == "" ]] && return 1
|
||||
[[ $COMP_CWORD > 3 ]] && return 1
|
||||
local version=$(for x in `ls $GVM_ROOT/pkgsets/$gvm_go_name`; do echo ${x} ; done )
|
||||
local version=$(for x in `$LS_PATH $GVM_ROOT/pkgsets/$gvm_go_name`; do echo ${x} ; done )
|
||||
COMPREPLY=( $(compgen -W "${version}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
@@ -33,11 +35,11 @@ _gvm()
|
||||
[[ "$gvm_go_name" == "" ]] && return 1
|
||||
[[ "$gvm_pkgset_name" == "" ]] && return 1
|
||||
if [[ "$COMP_CWORD" == "3" ]]; then
|
||||
local version=$(for x in `ls $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm`; do echo ${x} ; done )
|
||||
local version=$(for x in `$LS_PATH $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm`; do echo ${x} ; done )
|
||||
COMPREPLY=( $(compgen -W "${version}" -- ${cur}) )
|
||||
return 0
|
||||
elif [[ "$COMP_CWORD" == "4" ]]; then
|
||||
local version=$(for x in `ls $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/${COMP_WORDS[3]}`; do echo ${x} ; done )
|
||||
local version=$(for x in `$LS_PATH $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/${COMP_WORDS[3]}`; do echo ${x} ; done )
|
||||
COMPREPLY=( $(compgen -W "${version}" -- ${cur}) )
|
||||
return 0
|
||||
fi
|
||||
@@ -56,14 +58,14 @@ _gvm()
|
||||
install)
|
||||
[ ! -d $GVM_ROOT/archive/go ] && return 1
|
||||
[[ $COMP_CWORD > 2 ]] && return 1
|
||||
local version=$(for x in `hg tags -R $GVM_ROOT/archive/go | awk '{print $1}' | grep -E "release|tip"`; do echo ${x} ; done )
|
||||
local version=$(for x in `hg tags -R $GVM_ROOT/archive/go | awk '{print $1}' | $GREP_PATH -E "release|tip"`; do echo ${x} ; done )
|
||||
COMPREPLY=( $(compgen -W "${version}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
use|uninstall)
|
||||
[ ! -d $GVM_ROOT/gos ] && return 1
|
||||
[[ $COMP_CWORD > 2 ]] && return 1
|
||||
local installed_versions=$(for x in `ls $GVM_ROOT/gos`; do echo ${x} ; done )
|
||||
local installed_versions=$(for x in `$LS_PATH $GVM_ROOT/gos`; do echo ${x} ; done )
|
||||
COMPREPLY=( $(compgen -W "${installed_versions}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
display_usage() {
|
||||
display_message "Usage: gvm cross [os] [arch]"
|
||||
display_message " os = linux/darwin/windows"
|
||||
display_message " arch = amd64/386 (arm unsupported)"
|
||||
}
|
||||
|
||||
display_list() {
|
||||
echo
|
||||
display_usage
|
||||
echo
|
||||
display_message "Installed platforms:"
|
||||
echo
|
||||
$LS_PATH $GOROOT/pkg | $GREP_PATH windows_ | sed 's/^/ /g'
|
||||
$LS_PATH $GOROOT/pkg | $GREP_PATH darwin_ | sed 's/^/ /g'
|
||||
$LS_PATH $GOROOT/pkg | $GREP_PATH linux_ | sed 's/^/ /g'
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
which go &> /dev/null || display_fatal "Only available in versions after Go 1"
|
||||
|
||||
[ -z "$1" ] && display_list
|
||||
|
||||
if [ ! -f "$GOROOT/pkg/tool/cross" ]; then
|
||||
display_message "Installing x86 and x86-64 commands"
|
||||
set -e
|
||||
for arch in 8 6; do
|
||||
for cmd in a c g l; do
|
||||
go tool dist install -v cmd/$arch$cmd ||
|
||||
display_fatal "Couldn't compile tool: $arch$cmd"
|
||||
done
|
||||
done
|
||||
touch $GOROOT/pkg/tool/cross
|
||||
fi
|
||||
|
||||
export GOOS=$1
|
||||
shift
|
||||
[ -z "$1" ] && display_usage && display_fatal "arch is not specified"
|
||||
export GOARCH=$1
|
||||
|
||||
if [ ! -d "$GOROOT/pkg/${GOOS}_${GOARCH}" ]; then
|
||||
display_message "Installing $GOOS $GOARCH runtime library"
|
||||
if [ "$GOOS" = "windows" ]; then
|
||||
export CGO_ENABLED=0
|
||||
fi
|
||||
|
||||
cd $GOROOT/src
|
||||
go tool dist install -v pkg/runtime ||
|
||||
display_fatal "Couldn't compile runtime library for $GOOS $GOARCH"
|
||||
go install -v -a std ||
|
||||
display_fatal "Install runtime library for $GOOS $GOARCH"
|
||||
else
|
||||
display_message "Runtime library already installed for $GOOS $GOARCH"
|
||||
fi
|
||||
|
||||
+8
-8
@@ -1,30 +1,30 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
version=$1
|
||||
|
||||
if [ "$version" != "" ]; then
|
||||
fuzzy_match=`ls $GVM_ROOT/gos | sort | grep "$version" | head -n 1 | grep "$version"` ||
|
||||
display_error "Invalid version $version"
|
||||
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$version" | $HEAD_PATH -n 1 | $GREP_PATH "$version"` ||
|
||||
display_fatal "Invalid version $version"
|
||||
|
||||
foldername=$GVM_ROOT/gos/$fuzzy_match
|
||||
else
|
||||
if [ "$gvm_go_name" != "" ]; then
|
||||
if [[ "$gvm_go_name" != "" ]]; then
|
||||
foldername=$GVM_ROOT/gos/$gvm_go_name
|
||||
else
|
||||
display_error "No version selected"
|
||||
display_fatal "No version selected"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d $foldername ]; then
|
||||
if [[ -d $foldername ]]; then
|
||||
cd $foldername
|
||||
find . > /tmp/manifest.test
|
||||
diff manifest /tmp/manifest.test
|
||||
if [ "$?" == "0" ]; then
|
||||
if [[ "$?" == "0" ]]; then
|
||||
display_message "Clean $foldername"
|
||||
else
|
||||
display_message "*Dirty* $foldername"
|
||||
fi
|
||||
else
|
||||
display_error "Invalid version"
|
||||
display_fatal "Invalid version"
|
||||
fi
|
||||
|
||||
Vendored
+5
-11
@@ -1,11 +1,5 @@
|
||||
#!/bin/bash
|
||||
function display_error() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
return 1
|
||||
}
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions || return 1
|
||||
|
||||
function gvm() {
|
||||
if [[ "$GVM_ROOT" == "" ]]; then
|
||||
@@ -27,13 +21,13 @@ function gvm() {
|
||||
mkdir -p $GVM_ROOT/archive/package > /dev/null 2>&1
|
||||
mkdir -p $GVM_ROOT/environments > /dev/null 2>&1
|
||||
|
||||
if [ "$1" == "use" ]; then
|
||||
if [[ "$1" == "use" ]]; then
|
||||
. $GVM_ROOT/scripts/env/use
|
||||
shift
|
||||
gvm_use $@
|
||||
elif [ "$1" == "implode" ]; then
|
||||
elif [[ "$1" == "implode" ]]; then
|
||||
rm -rf $GVM_ROOT
|
||||
elif [ "$1" == "pkgset" ] && [ "$2" == "use" ]; then
|
||||
elif [[ "$1" == "pkgset" ]] && [[ "$2" == "use" ]]; then
|
||||
. $GVM_ROOT/scripts/env/pkgset-use
|
||||
shift
|
||||
shift
|
||||
|
||||
Vendored
+2
-17
@@ -1,19 +1,4 @@
|
||||
function display_error() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
return 1
|
||||
}
|
||||
|
||||
function display_message() {
|
||||
# GREEN!
|
||||
tput sgr0
|
||||
tput setaf 2
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
}
|
||||
|
||||
#!/usr/bin/env bash
|
||||
function gvm_pkgset_use() {
|
||||
[[ "$1" != "" ]] ||
|
||||
display_error "Please specify a package set" || return 1
|
||||
@@ -21,7 +6,7 @@ function gvm_pkgset_use() {
|
||||
[[ "$gvm_go_name" != "" ]] ||
|
||||
display_error "No Go version selected" || return 1
|
||||
|
||||
fuzzy_match=`ls $GVM_ROOT/environments | sort | grep "$gvm_go_name@" | grep "$1" | head -n 1` ||
|
||||
fuzzy_match=`$LS_PATH $GVM_ROOT/environments | $SORT_PATH | $GREP_PATH "$gvm_go_name@" | $GREP_PATH "$1" | $HEAD_PATH -n 1` ||
|
||||
display_error "Invalid package set" || return 1
|
||||
|
||||
export PATH=$GVM_PATH_BACKUP
|
||||
|
||||
Vendored
+15
-21
@@ -1,29 +1,23 @@
|
||||
function display_error() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
return 1
|
||||
}
|
||||
|
||||
function display_message() {
|
||||
# GREEN!
|
||||
tput sgr0
|
||||
tput setaf 2
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
}
|
||||
|
||||
#!/usr/bin/env bash
|
||||
function gvm_use() {
|
||||
[[ "$1" != "" ]] ||
|
||||
[[ "$1" != "" ]] ||
|
||||
display_error "Please specifiy the version" || return 1
|
||||
fuzzy_match=`ls $GVM_ROOT/gos | sort | grep "$1" | head -n 1 | grep "$1"` ||
|
||||
display_error "Invalid version $1" || return 1
|
||||
local VERSION=$1
|
||||
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1"`
|
||||
if [[ "$?" != "0" ]]; then
|
||||
GO_CACHE_PATH=$GVM_ROOT/archive/go
|
||||
version=`hg tags -R $GO_CACHE_PATH | awk '{print $1}' | $SORT_PATH | $GREP_PATH "$VERSION" | $HEAD_PATH -n 1 | $GREP_PATH "$VERSION"`
|
||||
if [[ "x$version" == "x" ]]; then
|
||||
display_error "Version not found locally. Try 'gvm install $1'" || return 1
|
||||
else
|
||||
display_warning "$version is not installed. Install it by running 'gvm install $version'" || return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
export PATH=$GVM_PATH_BACKUP
|
||||
. $GVM_ROOT/environments/$fuzzy_match
|
||||
. $GVM_ROOT/environments/$fuzzy_match &> /dev/null || display_error "Couldn't source environment" || return 1
|
||||
if [[ "$2" == "--default" ]]; then
|
||||
cp $GVM_ROOT/environments/$fuzzy_match $GVM_ROOT/environments/default
|
||||
cp $GVM_ROOT/environments/$fuzzy_match $GVM_ROOT/environments/default || display_error "Couldn't make $fuzzy_match default"
|
||||
fi
|
||||
|
||||
display_message "Now using version $fuzzy_match"
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
display_error() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
exit 1
|
||||
which tput &> /dev/null
|
||||
if [[ "$?" == "0" ]] && [[ "$TERM" == "xterm" ]]; then
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
else
|
||||
echo "ERROR: $1" >&2
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
display_fatal() {
|
||||
which tput &> /dev/null
|
||||
if [[ "$?" == "0" ]] && [[ "$TERM" == "xterm" ]]; then
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
else
|
||||
echo "ERROR: $1" >&2
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
display_message() {
|
||||
# GREEN!
|
||||
tput sgr0
|
||||
tput setaf 2
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
which tput &> /dev/null
|
||||
if [[ "$?" == "0" ]] && [[ "$TERM" == "xterm" ]]; then
|
||||
# GREEN!
|
||||
tput sgr0
|
||||
tput setaf 2
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
else
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
display_warning() {
|
||||
# YELLOW!
|
||||
tput sgr0
|
||||
tput setaf 3
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
which tput &> /dev/null
|
||||
if [[ "$?" == "0" ]] && [[ "$TERM" == "xterm" ]]; then
|
||||
# YELLOW!
|
||||
tput sgr0
|
||||
tput setaf 3
|
||||
echo "WARNING: $1"
|
||||
tput sgr0
|
||||
else
|
||||
echo "$1"
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
LS_ERROR="GVM couldn't find ls"
|
||||
GREP_ERROR="GVM couldn't find grep"
|
||||
SORT_ERROR="GVM couldn't find sort"
|
||||
HEAD_ERROR="GVM couldn't find head"
|
||||
|
||||
LS_PATH=`unalias ls &> /dev/null; which ls` || display_error "$LS_ERROR" || return 1
|
||||
GREP_PATH=`unalias grep &> /dev/null; which grep` || display_error "$GREP_ERROR" || return 1
|
||||
SORT_PATH=`unalias sort &> /dev/null; which sort` || display_error "$SORT_ERROR" || return 1
|
||||
HEAD_PATH=`unalias head &> /dev/null; which head` || display_error "$HEAD_ERROR" || return 1
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
for function in $GVM_ROOT/scripts/function/*; do
|
||||
. $function
|
||||
done
|
||||
|
||||
+6
-6
@@ -1,20 +1,20 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[[ -d $GVM_ROOT/.git ]] || mv $GVM_ROOT/git.bak $GVM_ROOT/.git &> /dev/null ||
|
||||
display_error "Couldn't find git info"
|
||||
display_fatal "Couldn't find git info"
|
||||
|
||||
cd $GVM_ROOT && git checkout -f ||
|
||||
display_error "Failed to clean install"
|
||||
display_fatal "Failed to clean install"
|
||||
|
||||
if [[ -n $1 ]]; then
|
||||
cd $GVM_ROOT && git checkout $1 -f ||
|
||||
display_error "Failed to checkout $1 branch"
|
||||
display_fatal "Failed to checkout $1 branch"
|
||||
fi
|
||||
|
||||
cd $GVM_ROOT && git pull ||
|
||||
display_error "Failed to update"
|
||||
display_fatal "Failed to update"
|
||||
|
||||
mv $GVM_ROOT/.git $GVM_ROOT/git.bak ||
|
||||
display_error "Couldn't backup git info"
|
||||
display_fatal "Couldn't backup git info"
|
||||
|
||||
|
||||
+11
-11
@@ -1,37 +1,37 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
# Check for hg
|
||||
[ -z `which hg` ] &&
|
||||
which hg &> /dev/null ||
|
||||
display_warning "Could not find mercurial
|
||||
|
||||
linux: apt-get install mercurial
|
||||
mac: brew install mercurial
|
||||
" && exit 1
|
||||
" || exit 1
|
||||
# Check for ar
|
||||
[ -z `which ar` ] &&
|
||||
which ar &> /dev/null ||
|
||||
display_warning "Could not find binutils
|
||||
|
||||
linux: apt-get install binutils
|
||||
" && exit 1
|
||||
" || exit 1
|
||||
# Check for bison
|
||||
[ -z `which bison` ] &&
|
||||
which bison &> /dev/null ||
|
||||
display_warning "Could not find bison
|
||||
|
||||
linux: apt-get install bison
|
||||
" && exit 1
|
||||
" || exit 1
|
||||
# Check for gcc
|
||||
[ -z `which gcc` ] &&
|
||||
which gcc &> /dev/null ||
|
||||
display_warning "Could not find gcc
|
||||
|
||||
linux: apt-get install gcc
|
||||
" && exit 1
|
||||
" || exit 1
|
||||
# Check for make
|
||||
[ -z `which make` ] &&
|
||||
which make &> /dev/null ||
|
||||
display_warning "Could not find make
|
||||
|
||||
linux: apt-get install make
|
||||
" && exit 1
|
||||
" || exit 1
|
||||
|
||||
# All good!
|
||||
exit 0
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
export GVM_ROOT=@prefix@/gvm
|
||||
. $GVM_ROOT/scripts/gvm-default
|
||||
|
||||
+81
-46
@@ -1,16 +1,18 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
function show_usage() {
|
||||
echo "Usage: gvm install [version] [options]"
|
||||
echo " -s, --source=SOURCE Install Go from specified source."
|
||||
echo " -n, --name=NAME Override the default name for this version."
|
||||
echo " -pb, --with-protobuf Install Go protocol buffers."
|
||||
echo " -b, --with-build-tools Install package build tools."
|
||||
echo " -h, --help Display this message."
|
||||
}
|
||||
|
||||
read_command_line() {
|
||||
VERSION=$1
|
||||
if [ "${VERSION:0:1}" != "-" ]; then
|
||||
if [[ "${VERSION:0:1}" != "-" ]]; then
|
||||
shift
|
||||
else
|
||||
display_warning "Invalid version: $1"
|
||||
@@ -21,11 +23,17 @@ read_command_line() {
|
||||
for i in $*; do
|
||||
case $i in
|
||||
-s=*|--source=*)
|
||||
GO_SOURCE_URL=$i
|
||||
GO_SOURCE_URL=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
|
||||
;;
|
||||
-n=*|--name=*)
|
||||
GO_NAME=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
|
||||
;;
|
||||
-pb|--with-protobuf)
|
||||
INSTALL_PB="true"
|
||||
;;
|
||||
-b|--with-build-tools)
|
||||
INSTALL_BUILD_TOOLS="true"
|
||||
;;
|
||||
-h|--help)
|
||||
show_usage
|
||||
exit 0
|
||||
@@ -41,25 +49,25 @@ read_command_line() {
|
||||
|
||||
download_source() {
|
||||
GO_CACHE_PATH=$GVM_ROOT/archive/go
|
||||
[ -d $GO_CACHE_PATH ] && return
|
||||
[[ -d $GO_CACHE_PATH ]] && return
|
||||
display_message "Downloading Go source..."
|
||||
hg clone $GO_SOURCE_URL $GO_CACHE_PATH >> $GVM_ROOT/logs/go-download.log 2>&1 ||
|
||||
display_error "Couldn't download Go source"
|
||||
display_fatal "Couldn't download Go 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_PATH | $GREP_PATH "$VERSION" | $HEAD_PATH -n 1 | $GREP_PATH "$VERSION"`
|
||||
}
|
||||
|
||||
update_source() {
|
||||
display_message "Updating Go source..."
|
||||
hg pull -R $GO_CACHE_PATH >> $GVM_ROOT/logs/go-download.log 2>&1 ||
|
||||
display_error "Couldn't get latest Go version info"
|
||||
display_fatal "Couldn't get latest Go version info"
|
||||
}
|
||||
|
||||
copy_source() {
|
||||
hg clone -u $version $GO_CACHE_PATH $GO_INSTALL_ROOT >> $GVM_ROOT/logs/go-$version-install.log 2>&1 ||
|
||||
display_error "Couldn't copy source to target folder"
|
||||
hg clone -u $version $GO_CACHE_PATH $GO_INSTALL_ROOT >> $GVM_ROOT/logs/go-$GO_NAME-install.log 2>&1 ||
|
||||
display_fatal "Couldn't copy source to target folder"
|
||||
}
|
||||
|
||||
|
||||
@@ -69,43 +77,47 @@ compile_go() {
|
||||
export GOBIN=$GO_INSTALL_ROOT/bin &&
|
||||
export PATH=$GOBIN:$PATH &&
|
||||
export GOROOT=$GO_INSTALL_ROOT &&
|
||||
#cd $GO_INSTALL_ROOT/src && ./all.bash &> $GVM_ROOT/logs/go-$version-compile.log ||
|
||||
cd $GO_INSTALL_ROOT/src && ./make.bash &> $GVM_ROOT/logs/go-$version-compile.log ||
|
||||
(rm -rf $GO_INSTALL_ROOT && display_error "Failed to compile")
|
||||
#cd $GO_INSTALL_ROOT/src && ./all.bash &> $GVM_ROOT/logs/go-$GO_NAME-compile.log ||
|
||||
cd $GO_INSTALL_ROOT/src && ./make.bash &> $GVM_ROOT/logs/go-$GO_NAME-compile.log ||
|
||||
(rm -rf $GO_INSTALL_ROOT && display_fatal "Failed to compile")
|
||||
}
|
||||
|
||||
create_enviroment() {
|
||||
new_env_file=$GVM_ROOT/environments/$version
|
||||
new_env_file=$GVM_ROOT/environments/$GO_NAME
|
||||
echo "export GVM_ROOT; GVM_ROOT=\"$GVM_ROOT\"" > $new_env_file
|
||||
echo "export gvm_go_name; gvm_go_name=\"$version\"" >> $new_env_file
|
||||
echo "export gvm_go_name; gvm_go_name=\"$GO_NAME\"" >> $new_env_file
|
||||
echo "export gvm_pkgset_name; gvm_pkgset_name=\"global\"" >> $new_env_file
|
||||
echo "export GOROOT; GOROOT=\"\$GVM_ROOT/gos/$version\"" >> $new_env_file
|
||||
echo "export GOPATH; GOPATH=\"\$GVM_ROOT/pkgsets/$version/global\"" >> $new_env_file
|
||||
echo "export PATH; PATH=\"\$GVM_ROOT/pkgsets/$version/global/bin:\$GVM_ROOT/gos/$version/bin:\$GVM_ROOT/bin:\$PATH\"" >> $new_env_file
|
||||
echo "export GOROOT; GOROOT=\"\$GVM_ROOT/gos/$GO_NAME\"" >> $new_env_file
|
||||
echo "export GOPATH; GOPATH=\"\$GVM_ROOT/pkgsets/$GO_NAME/global\"" >> $new_env_file
|
||||
echo "export PATH; PATH=\"\$GVM_ROOT/pkgsets/$GO_NAME/global/bin:\$GVM_ROOT/gos/$GO_NAME/bin:\$GVM_ROOT/bin:\$PATH\"" >> $new_env_file
|
||||
. $GVM_ROOT/scripts/env/use
|
||||
gvm_use $version &> /dev/null ||
|
||||
display_error "Failed to use installed version"
|
||||
gvm_use $GO_NAME &> /dev/null ||
|
||||
display_fatal "Failed to use installed version"
|
||||
gvm pkgset create global
|
||||
unset GOPATH
|
||||
}
|
||||
|
||||
install_go() {
|
||||
GO_INSTALL_ROOT=$GVM_ROOT/gos/$version
|
||||
trap 'rm -rf $GO_INSTALL_ROOT; display_error "Canceled!"' INT
|
||||
GO_INSTALL_ROOT=$GVM_ROOT/gos/$GO_NAME
|
||||
trap 'rm -rf $GO_INSTALL_ROOT; display_fatal "Canceled!"' INT
|
||||
|
||||
# Check for existing install
|
||||
if [ -d "$GO_INSTALL_ROOT" ]; then
|
||||
[ -f "$GO_INSTALL_ROOT/manifest" ] &&
|
||||
display_error "Already installed!"
|
||||
if [[ -d "$GO_INSTALL_ROOT" ]]; then
|
||||
[[ -f "$GO_INSTALL_ROOT/manifest" ]] &&
|
||||
display_fatal "Already installed!"
|
||||
display_warning "Removing corrupt install..."
|
||||
gvm uninstall $version
|
||||
gvm uninstall $GO_NAME
|
||||
fi
|
||||
|
||||
display_message "Installing $version..."
|
||||
if [[ "$version" != "$GO_NAME" ]]; then
|
||||
display_message "Installing $version as $GO_NAME..."
|
||||
else
|
||||
display_message "Installing $version..."
|
||||
fi
|
||||
|
||||
# Create the global package set folder
|
||||
mkdir -p $GVM_ROOT/pkgsets/$version >> $GVM_ROOT/logs/go-$version-install.log 2>&1 ||
|
||||
display_error "Couldn't create global package set folder"
|
||||
mkdir -p $GVM_ROOT/pkgsets/$GO_NAME >> $GVM_ROOT/logs/go-$GO_NAME-install.log 2>&1 ||
|
||||
display_fatal "Couldn't create global package set folder"
|
||||
|
||||
copy_source
|
||||
compile_go
|
||||
@@ -114,50 +126,73 @@ 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/$GO_NAME-gpkg.log 2>&1 || return 1
|
||||
}
|
||||
|
||||
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/$GO_NAME-gb.log 2>&1 || return 1
|
||||
}
|
||||
|
||||
install_goprotobuf() {
|
||||
which protoc &> /dev/null || display_warning "Could not find protocol buffer compiler
|
||||
|
||||
linux: apt-get install protobuf-compiler
|
||||
mac: brew install protobuf
|
||||
"
|
||||
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"
|
||||
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 [[ "$GVM_GOINSTALL" == "goinstall" ]]; then
|
||||
$GVM_GOINSTALL goprotobuf.googlecode.com/hg/proto > $GVM_ROOT/logs/$GO_NAME-pb-compiler.log 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
display_warning "Failed to install goprotobuf"
|
||||
return 1
|
||||
fi
|
||||
cd $GVM_ROOT/gos/$GO_NAME/src/pkg/goprotobuf.googlecode.com/hg/compiler
|
||||
make install >> $GVM_ROOT/logs/$GO_NAME-pb-compiler.log 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
display_warning "Failed to install goprotobuf compiler"
|
||||
return 1
|
||||
fi
|
||||
#fi
|
||||
else
|
||||
$GVM_GOINSTALL code.google.com/p/goprotobuf/proto > $GVM_ROOT/logs/$GO_NAME-pb-compiler.log 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
display_warning "Failed to install goprotobuf"
|
||||
return 1
|
||||
fi
|
||||
$GVM_GOINSTALL code.google.com/p/goprotobuf/protoc-gen-go > $GVM_ROOT/logs/$GO_NAME-pb-compiler.log 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
display_warning "Failed to install goprotobuf compiler"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
trap 'display_error "Canceled!"' INT
|
||||
trap 'display_fatal "Canceled!"' INT
|
||||
read_command_line $@
|
||||
[ "$VERSION" == "" ] && display_error "No version specified"
|
||||
[[ "$VERSION" == "" ]] && display_fatal "No version specified"
|
||||
download_source
|
||||
check_tag || (update_source && check_tag) || display_error "Unrecognized Go version"
|
||||
check_tag || (update_source && check_tag) || display_fatal "Unrecognized Go version"
|
||||
if [[ "$GO_NAME" == "" ]]; then
|
||||
GO_NAME=$version
|
||||
fi
|
||||
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
|
||||
|
||||
x="`hg tags -R ~/.gvm/archive/go`"; echo ${x#*b0819469a6df} | $GREP_PATH "$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
|
||||
if [[ "$INSTALL_BUILD_TOOLS" == "true" ]]; then
|
||||
install_gb || display_warning "Failed to install gb"
|
||||
install_gpkg || display_warning "Failed to install gpkg"
|
||||
fi
|
||||
if [[ "$INSTALL_PB" == "true" ]]; then
|
||||
install_goprotobuf
|
||||
fi
|
||||
fi
|
||||
|
||||
cd $GO_INSTALL_ROOT && find . > manifest
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -1,14 +1,14 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
echo
|
||||
display_message "gvm gos (installed)"
|
||||
echo
|
||||
if [ -d $GVM_ROOT/gos ]; then
|
||||
if [[ -d $GVM_ROOT/gos ]]; then
|
||||
if [[ "$gvm_go_name" != "" ]]; then
|
||||
ls -1 $GVM_ROOT/gos | sed 's/^/ /g' | sed 's/^ '$gvm_go_name'/=> '$gvm_go_name'/g'
|
||||
$LS_PATH -1 $GVM_ROOT/gos | sed 's/^/ /g' | sed 's/^ '$gvm_go_name\$'/=> '$gvm_go_name'/g'
|
||||
else
|
||||
ls -1 $GVM_ROOT/gos | sed 's/^/ /g'
|
||||
$LS_PATH -1 $GVM_ROOT/gos | sed 's/^/ /g'
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
|
||||
+12
-4
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
function show_usage() {
|
||||
@@ -32,12 +32,20 @@ read_command_line $@
|
||||
echo
|
||||
display_message "gvm gos (available)"
|
||||
echo
|
||||
versions=`curl -s https://go.googlecode.com/hg/.hgtags | awk '{ print $2 }' | grep "$tag_filter" | sort`
|
||||
versions=`curl -s https://go.googlecode.com/hg/.hgtags | awk '{ print $2 }' | $SORT_PATH`
|
||||
if [[ $? -ne 0 ]]; then
|
||||
display_error "Failed to get version list from Google"
|
||||
display_fatal "Failed to get version list from Google"
|
||||
fi
|
||||
for version in $versions; do
|
||||
echo " $version"
|
||||
if [[ "$tag_filter" == "release" ]]; then
|
||||
if [[ "${version:0:7}" == "release" ]]; then
|
||||
echo " $version"
|
||||
elif [[ "${version:0:3}" == "go1" ]]; then
|
||||
echo " $version"
|
||||
fi
|
||||
else
|
||||
echo " $version"
|
||||
fi
|
||||
done
|
||||
echo
|
||||
|
||||
|
||||
+6
-6
@@ -1,19 +1,19 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[[ $gvm_go_name != "" ]] ||
|
||||
display_error "No Go version selected"
|
||||
display_fatal "No Go version selected"
|
||||
[[ -d $GVM_ROOT/gos/$gvm_go_name ]] ||
|
||||
display_error "Invalid or corrupt Go version"
|
||||
display_fatal "Invalid or corrupt Go version"
|
||||
[[ -d $GVM_ROOT/pkgsets/$gvm_go_name ]] ||
|
||||
display_error "Missing package set folder for this Go version"
|
||||
display_fatal "Missing package set folder for this Go version"
|
||||
|
||||
command=$1
|
||||
if [ -f $GVM_ROOT/scripts/pkgset-$command ]; then
|
||||
if [[ -f $GVM_ROOT/scripts/pkgset-$command ]]; then
|
||||
shift
|
||||
$GVM_ROOT/scripts/pkgset-$command $@
|
||||
elif [[ -n $command ]]; then
|
||||
display_error "Unrecognized command line argument: '$command'"
|
||||
display_fatal "Unrecognized command line argument: '$command'"
|
||||
else
|
||||
echo "= gvm pkgset
|
||||
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[[ $1 != "" ]] ||
|
||||
display_error "Please specifiy the name"
|
||||
display_fatal "Please specifiy the name"
|
||||
|
||||
[[ ! -f "$GVM_ROOT/environments/$gvm_go_name@$1" ]] ||
|
||||
display_error "Packageset already exists!"
|
||||
display_fatal "Packageset already exists!"
|
||||
|
||||
mkdir -p $GVM_ROOT/pkgsets/$gvm_go_name/$1 ||
|
||||
display_error "Could not create folder"
|
||||
display_fatal "Could not create folder"
|
||||
cp $GVM_ROOT/environments/$gvm_go_name $GVM_ROOT/environments/$gvm_go_name@$1 ||
|
||||
display_error "Could copy environment"
|
||||
display_fatal "Could copy environment"
|
||||
echo "export gvm_pkgset_name=\"$1\"" >> $GVM_ROOT/environments/$gvm_go_name@$1 ||
|
||||
display_error "Could not extend environment"
|
||||
display_fatal "Could not extend environment"
|
||||
echo "export GOPATH; GOPATH=\"$GVM_ROOT/pkgsets/$gvm_go_name/$1:\$GOPATH\"" >> $GVM_ROOT/environments/$gvm_go_name@$1 ||
|
||||
display_error "Could not extend environment"
|
||||
display_fatal "Could not extend environment"
|
||||
echo "export PATH; PATH=\"$GVM_ROOT/pkgsets/$gvm_go_name/$1/bin:\$PATH\"" >> $GVM_ROOT/environments/$gvm_go_name@$1 ||
|
||||
display_error "Could not extend environment"
|
||||
display_fatal "Could not extend environment"
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[[ $gvm_go_name != "" ]] ||
|
||||
display_error "No Go version selected"
|
||||
display_fatal "No Go version selected"
|
||||
|
||||
[[ $1 != "" ]] ||
|
||||
display_error "Please specifiy the name"
|
||||
display_fatal "Please specifiy the name"
|
||||
|
||||
[[ -d $GVM_ROOT/pkgsets/$gvm_go_name/$1 ]] ||
|
||||
display_error "Packageset doesn't exist!"
|
||||
display_fatal "Packageset doesn't exist!"
|
||||
|
||||
rm -rf $GVM_ROOT/pkgsets/$gvm_go_name/$1 ||
|
||||
display_error "Could not delete package set"
|
||||
display_fatal "Could not delete package set"
|
||||
|
||||
rm -rf $GVM_ROOT/environments/$gvm_go_name@$1 ||
|
||||
display_error "Could not delete package set"
|
||||
display_fatal "Could not delete package set"
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[[ $gvm_pkgset_name != "" ]] ||
|
||||
display_error "No Package set selected"
|
||||
display_fatal "No Package set selected"
|
||||
rm -rf $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/* ||
|
||||
display_error "Could not delete package set files"
|
||||
display_fatal "Could not delete package set files"
|
||||
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
echo
|
||||
display_message "gvm go package sets ($gvm_go_name)"
|
||||
echo
|
||||
|
||||
if [ -d $GVM_ROOT/pkgsets/$gvm_go_name ]; then
|
||||
if [[ -d $GVM_ROOT/pkgsets/$gvm_go_name ]]; then
|
||||
for cur_dir in $GVM_ROOT/pkgsets/$gvm_go_name/*; do
|
||||
[[ "$cur_dir" == "$GVM_ROOT/pkgsets/$gvm_go_name/*" ]] && exit
|
||||
pkgset=`basename $cur_dir`
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#!/bin/bash
|
||||
echo $1 | sed -n -e '/_.*_/ p' | grep "_" &> /dev/null
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions/tools
|
||||
echo $1 | sed -n -e '/_.*_/ p' | $GREP_PATH "_" &> /dev/null
|
||||
if [ "$?" == "0" ]; then
|
||||
version=`echo $1 | sed 's/_\(.*\)_/\1/'`
|
||||
if [ ! -f $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/{{package_name}}/$version/bin/{{binary_name}} ]; then
|
||||
if [[ ! -f $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/{{package_name}}/$version/bin/{{binary_name}} ]]; then
|
||||
echo "GVM: Invalid version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
+10
-10
@@ -1,22 +1,22 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[[ "$1" == "" ]] &&
|
||||
display_error "Please specifiy the version"
|
||||
display_fatal "Please specifiy the version"
|
||||
|
||||
fuzzy_match=`ls $GVM_ROOT/gos | sort | grep "$1" | head -n 1 | grep "$1"` ||
|
||||
display_error "Invalid version $1"
|
||||
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1"` ||
|
||||
display_fatal "Invalid version $1"
|
||||
|
||||
if [ -d $GVM_ROOT/gos/$fuzzy_match ]; then
|
||||
if [[ -d $GVM_ROOT/gos/$fuzzy_match ]]; then
|
||||
rm -rf $GVM_ROOT/pkgsets/$fuzzy_match &> /dev/null ||
|
||||
display_error "Couldn't remove pkgsets"
|
||||
display_fatal "Couldn't remove pkgsets"
|
||||
rm -f $GVM_ROOT/environments/$fuzzy_match &> /dev/null ||
|
||||
display_error "Couldn't remove environment files"
|
||||
display_fatal "Couldn't remove environment files"
|
||||
rm -f "$GVM_ROOT/environments/$fuzzy_match@"* &> /dev/null ||
|
||||
display_error "Couldn't remove pkgset environment files"
|
||||
display_fatal "Couldn't remove pkgset environment files"
|
||||
rm -rf $GVM_ROOT/gos/$fuzzy_match &> /dev/null ||
|
||||
display_error "Couldn't remove Go folder"
|
||||
display_fatal "Couldn't remove Go folder"
|
||||
display_message "Uninstalled version $fuzzy_match"
|
||||
else
|
||||
display_error "Invalid version"
|
||||
display_fatal "Invalid version"
|
||||
fi
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
cd $GVM_ROOT/archive/go &> /dev/null ||
|
||||
display_error "Failed to find local Go source"
|
||||
display_fatal "Failed to find local Go source"
|
||||
|
||||
cd $GVM_ROOT/archive/go && hg pull ||
|
||||
display_error "Failed to update"
|
||||
display_fatal "Failed to update"
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash -ex
|
||||
#!/usr/bin/env bash -ex
|
||||
TEST_OUTPUT=`gvm version`
|
||||
[ "$TEST_OUTPUT" != "" ]
|
||||
echo "Success!"
|
||||
|
||||
Reference in New Issue
Block a user