mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-10 05:16:13 +10:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3fe1e1804a | ||
|
|
b64d5b3fd9 | ||
|
|
98d72f6705 | ||
|
|
922f5c7201 | ||
|
|
3e89f78cca | ||
|
|
eb1124d897 | ||
|
|
5e202a67ff |
@@ -4,7 +4,6 @@ gos/
|
||||
pkgs
|
||||
pkgsets/
|
||||
archive/
|
||||
environments/
|
||||
tmp/
|
||||
*.log
|
||||
scripts/gvm
|
||||
|
||||
@@ -1,23 +1,3 @@
|
||||
Version: 0.0.8
|
||||
State: Development
|
||||
|
||||
CHANGES:
|
||||
|
||||
Version: 0.0.7
|
||||
State: Stable
|
||||
|
||||
CHANGES:
|
||||
* Fixed issue with gvm use where multiple versions matched.
|
||||
* Added gvm diff for checking the state of a GOROOT.
|
||||
* Install now uses hg clone to copy source.
|
||||
* Fixed remaining error handling. Error now output to stderr.
|
||||
* Fixed error/state checking in `gvm pkg list` and `gvm pkgset list`
|
||||
* Removed all command's gvm- prefix
|
||||
* Revamped the folder structure for scripts so they don't show up in the path
|
||||
* Added gvm prompt for including Go version and/or package set info in the bash prompt
|
||||
* Added ability to build from source when running `gvm pkg install <name>` in a folder
|
||||
named <name>.
|
||||
|
||||
Version: 0.0.6
|
||||
State: Stable
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ To install the stable release run:
|
||||
|
||||
bash -s stable < <(curl -s https://raw.github.com/moovweb/gvm/master/binscripts/gvm-installer)
|
||||
|
||||
To install the development branch (NOT USUALLY RECOMMENDED!) run:
|
||||
To install the development branch run:
|
||||
|
||||
bash < <(curl -s https://raw.github.com/moovweb/gvm/master/binscripts/gvm-installer)
|
||||
|
||||
@@ -18,8 +18,8 @@ This will keep libraries from accidentally installing into the main Go soure tre
|
||||
|
||||
Installing Go
|
||||
=============
|
||||
gvm install 60.3
|
||||
gvm use 60.3
|
||||
gvm install release.r60.3
|
||||
gvm use release.r60.3
|
||||
Once this is done Go will be in the path and ready to use. $GOROOT is set automatically.
|
||||
|
||||
List Go Versions
|
||||
|
||||
@@ -1,38 +1,33 @@
|
||||
#!/bin/bash
|
||||
if [ -z "$GVM_ROOT" ]; then
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo 'ERROR: $GVM_ROOT is not set! Please add the following line to your .bashrc or .profile
|
||||
echo 'ERROR: $GVM_ROOT is not set! Please update your .bashrc or .profile to $
|
||||
|
||||
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
|
||||
' >&2
|
||||
tput sgr0
|
||||
exit 1
|
||||
[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"
|
||||
|
||||
'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
command=$1
|
||||
if [[ $command == "implode" ]]; then
|
||||
rm -rf $GVM_ROOT
|
||||
exit 0
|
||||
if [[ $1 == "implode" ]]; then
|
||||
rm -rf $GVM_ROOT
|
||||
exit 0
|
||||
fi
|
||||
|
||||
$GVM_ROOT/scripts/gvm-check
|
||||
$GVM_ROOT/bin/gvm-check
|
||||
if [[ "$?" != "0" ]]; then
|
||||
display_error "Missing requirements. Please see messages above"
|
||||
echo "ERROR: Missing requirements. Please see messages above"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $command == "version" ]]; then
|
||||
display_message "Go Version Manager v$GVM_VERSION"
|
||||
if [[ $1 == "version" ]]; then
|
||||
echo "Go Version Manager v$GVM_VERSION"
|
||||
else
|
||||
if [ -f $GVM_ROOT/scripts/$command ]; then
|
||||
shift
|
||||
$GVM_ROOT/scripts/$command $@
|
||||
elif [[ -n $command ]]; then
|
||||
display_error "Unrecognized command line argument: '$command'"
|
||||
else
|
||||
echo "= gvm
|
||||
if [ -f $GVM_ROOT/bin/gvm-$1 ]; then
|
||||
$GVM_ROOT/bin/gvm-$1 $@
|
||||
elif [[ -n $1 ]]; then
|
||||
echo "ERROR: Unrecognized command line argument: '$1'"
|
||||
else
|
||||
echo "= gvm
|
||||
|
||||
* http://github.com/moovweb/gvm
|
||||
|
||||
@@ -55,5 +50,5 @@ GVM is the Go Version Manager
|
||||
list - list installed go versions
|
||||
pkgset - manage go packages sets
|
||||
pkg - manage go packages"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
mkdir -p $GVM_ROOT/logs > /dev/null 2>&1
|
||||
mkdir -p $GVM_ROOT/gos > /dev/null 2>&1
|
||||
mkdir -p $GVM_ROOT/archive > /dev/null 2>&1
|
||||
mkdir -p $GVM_ROOT/archive/package > /dev/null 2>&1
|
||||
|
||||
if [ -z `which hg` ]; then
|
||||
echo '* Could not find mercurial (try `sudo apt-get install mercurial`)'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z `which ar` ]; then
|
||||
echo '* Could not find binutils (try `sudo apt-get install binutils (or binutils-multiarch)`)'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z `which bison` ]; then
|
||||
echo '* Could not find bison (try `sudo apt-get install bison`)'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z `which gcc` ]; then
|
||||
echo '* Could not find gcc (try `sudo apt-get install gcc`)'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z `which make` ]; then
|
||||
echo '* Could not find make (try `sudo apt-get install make`)'
|
||||
exit 1
|
||||
fi
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 == "commit" ]]; then
|
||||
mv $GVM_ROOT/git.bak $GVM_ROOT/.git
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Couldn't find git info"
|
||||
exit 1
|
||||
fi
|
||||
if [[ -n $2 ]]; then
|
||||
cd $GVM_ROOT && git add . && git commit -m "$2"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to commit"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
cd $GVM_ROOT && git push
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to push"
|
||||
exit 1
|
||||
fi
|
||||
mv $GVM_ROOT/.git $GVM_ROOT/git.bak
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Couldn't backup git info"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Please use gvm [action] to call this file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 == "get" ]]; then
|
||||
mv $GVM_ROOT/git.bak $GVM_ROOT/.git
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Couldn't find git info"
|
||||
exit 1
|
||||
fi
|
||||
cd $GVM_ROOT && git checkout -f
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to clean install"
|
||||
exit 1
|
||||
fi
|
||||
if [[ -n $2 ]]; then
|
||||
cd $GVM_ROOT && git checkout $2 -f
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to checkout $2 branch"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
cd $GVM_ROOT && git pull
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to update"
|
||||
exit 1
|
||||
fi
|
||||
mv $GVM_ROOT/.git $GVM_ROOT/git.bak
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Couldn't backup git info"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Please use gvm [action] to call this file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Executable
+150
@@ -0,0 +1,150 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 != "install" ]]; then
|
||||
echo "Please use gvm [action] to call this file"
|
||||
exit 1
|
||||
fi
|
||||
if [[ "$2" == "" ]]; then
|
||||
echo "ERROR: Please specifiy the version"
|
||||
exit 1
|
||||
else
|
||||
REVISION=$2
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# Implementation
|
||||
################################################################################
|
||||
|
||||
# find_revision(version)
|
||||
get_source_tag() {
|
||||
curl -s https://go.googlecode.com/hg/.hgtags | awk '{print $2;}' | grep "$1" > /dev/null 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
return 1
|
||||
fi
|
||||
SOURCE_TAG=`curl -s https://go.googlecode.com/hg/.hgtags | awk '{print $2;}' | grep "$1" | tail -n 1`
|
||||
}
|
||||
|
||||
# download_revision(revision, destination)
|
||||
download_revision() {
|
||||
hg clone -u $1 https://go.googlecode.com/hg/ $2
|
||||
if [[ $? -ne 0 ]]; then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# compile_go(source)
|
||||
compile_go() {
|
||||
unset GOARCH
|
||||
unset GOOS
|
||||
unset GOPATH
|
||||
export GOBIN=$1/bin
|
||||
export PATH=$GOBIN:$PATH
|
||||
export GOROOT=$1
|
||||
cd $1/src && ./all.bash
|
||||
if [[ $? -ne 0 ]]; then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Interface
|
||||
################################################################################
|
||||
|
||||
download() {
|
||||
echo " * Downloading..."
|
||||
download_revision $SOURCE_TAG $SOURCE_ROOT > $GVM_ROOT/logs/$SOURCE_TAG-download.log 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to download version $SOURCE_TAG. See logs in $GVM_ROOT/logs/$SOURCE_TAG-download.log for details"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
copy_source() {
|
||||
cp -r $SOURCE_ROOT $INSTALL_ROOT
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to copy from cache"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
setup_install_env() {
|
||||
get_source_tag $REVISION
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to find go release version: '$1'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SOURCE_ROOT=$GVM_ROOT/archive/$SOURCE_TAG
|
||||
INSTALL_ROOT=$GVM_ROOT/gos/$SOURCE_TAG
|
||||
|
||||
if [[ -d $INSTALL_ROOT ]]; then
|
||||
echo "Already installed!"
|
||||
exit 1
|
||||
else
|
||||
echo "Installing version $SOURCE_TAG"
|
||||
fi
|
||||
|
||||
if [[ ! -d $SOURCE_ROOT ]]; then
|
||||
download
|
||||
fi
|
||||
|
||||
trap 'rm -rf $INSTALL_ROOT' INT
|
||||
copy_source
|
||||
}
|
||||
|
||||
compile() {
|
||||
echo " * Compiling..."
|
||||
compile_go $INSTALL_ROOT > $GVM_ROOT/logs/$SOURCE_TAG-compile.log 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to install version $SOURCE_TAG. See logs in $GVM_ROOT/logs/$SOURCE_TAG-compile.log for details"
|
||||
rm -rf $INSTALL_ROOT
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
create_default_pkgset() {
|
||||
#gvm pkgset create default
|
||||
mkdir -p $GVM_ROOT/pkgsets/$SOURCE_TAG/default
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to create default pkgset folder"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
install_gb() {
|
||||
echo " * Installing gb..."
|
||||
goinstall github.com/skelterjohn/go-gb/gb
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to install gb"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
install_goprotobuf() {
|
||||
echo " * Installing goprotobuf..."
|
||||
if [[ "$SOURCE_TAG" == "release.r60.3" ]]; then
|
||||
goinstall goprotobuf.googlecode.com/hg/proto
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to install goprotobuf"
|
||||
exit 1
|
||||
fi
|
||||
cd $GOROOT/src/pkg/goprotobuf.googlecode.com/hg/compiler
|
||||
make install > $GVM_ROOT/logs/$SOURCE_TAG-pb-compiler.log 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to install goprotobuf compiler"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo " Don't know how to install goprotobuf for $SOURCE_TAG"
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
setup_install_env
|
||||
compile
|
||||
install_gb
|
||||
install_goprotobuf
|
||||
create_default_pkgset
|
||||
}
|
||||
|
||||
main
|
||||
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 == "list" ]]; then
|
||||
echo "
|
||||
gvm gos
|
||||
"
|
||||
if [ -d $GVM_ROOT/gos ]; then
|
||||
if [ -e $GVM_ROOT/go ]; then
|
||||
CUR_VER=`readlink $GVM_ROOT/go | awk '{ n=split($1,path,"/"); print path[n] }'`
|
||||
ls -1 $GVM_ROOT/gos | sed 's/^/ /g' | sed 's/^ '$CUR_VER'/=> '$CUR_VER'/g'
|
||||
else
|
||||
ls -1 $GVM_ROOT/gos | sed 's/^/ /g'
|
||||
fi
|
||||
else
|
||||
echo "No installed Go versions. \`gvm install [version]\` to install Go."
|
||||
fi
|
||||
echo
|
||||
else
|
||||
echo "Please use gvm [action] to call this file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 == "listall" ]]; then
|
||||
echo "
|
||||
gvm gos (available)
|
||||
"
|
||||
curl -s https://go.googlecode.com/hg/.hgtags | awk '{ print $2 }'
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to get list from Google"
|
||||
exit 1
|
||||
fi
|
||||
echo
|
||||
else
|
||||
echo "Please use gvm [action] to call this file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 == "pkg" ]]; then
|
||||
if [ -f $GVM_ROOT/bin/gvm-$1-$2 ]; then
|
||||
$GVM_ROOT/bin/gvm-$1-$2 $@
|
||||
elif [[ -n $2 ]]; then
|
||||
echo "ERROR: Unrecognized command line argument: '$2'"
|
||||
else
|
||||
echo "= gvm pkg
|
||||
|
||||
* http://github.com/moovweb/gvm
|
||||
|
||||
== DESCRIPTION:
|
||||
|
||||
GVM Package is used to manage various Go packages
|
||||
|
||||
== Usage
|
||||
|
||||
gvm pkg Command
|
||||
|
||||
== Command
|
||||
|
||||
install - install go packages
|
||||
uninstall - uninstall go packages
|
||||
list - list installed go packages"
|
||||
fi
|
||||
else
|
||||
echo "Please use gvm [action] to call this file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Executable
+123
@@ -0,0 +1,123 @@
|
||||
#!/bin/bash
|
||||
cache_dir=$GVM_ROOT/archive/package/$3
|
||||
source_dir=$GVM_ROOT/tmp/$3/src
|
||||
build_dir=$GVM_ROOT/tmp/$3/build
|
||||
package_name=$3
|
||||
version=$4
|
||||
mode=$5
|
||||
|
||||
function download_package() {
|
||||
if [ ! -d "$cache_dir" ]; then
|
||||
echo "Downloading $package_name..."
|
||||
mkdir -p $cache_dir
|
||||
git clone git@github.com:moovweb/$package_name $cache_dir > /dev/null 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "ERROR: Could not find $package_name in any sources"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function select_version() {
|
||||
if [ "$version" != "" ]; then
|
||||
cd $source_dir && git pull &> /dev/null &&
|
||||
git checkout $version &> /dev/null
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Invalid version $version"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function setup_build_env() {
|
||||
rm -rf $build_dir && mkdir -p $build_dir
|
||||
rm -rf $source_dir
|
||||
cp -r $cache_dir/ $source_dir/
|
||||
select_version
|
||||
}
|
||||
|
||||
function check_deps() {
|
||||
export GOPATH=$build_dir
|
||||
echo "build package in ${build_dir}"
|
||||
if [ -f "$source_dir/Package.gvm" ]; then
|
||||
mkdir -p $build_dir/deps
|
||||
echo "loading dependent packages into ${build_dir}/deps"
|
||||
for line in `cat $source_dir/Package.gvm | grep ^pkg | awk '{ print $2 }'`; do
|
||||
CUR_PKG=$GVM_ROOT/pkgs/pkg.gvm/$line/current
|
||||
if [ -e "$CUR_PKG/BUILD_VERSION" ]; then
|
||||
echo "$line: `cat $CUR_PKG/BUILD_VERSION`" >> $build_dir/manifest
|
||||
else
|
||||
if [[ "$mode" == "strict" ]]; then
|
||||
echo "ERROR: Couldnt find package: $line please build it first"
|
||||
exit 1
|
||||
else
|
||||
gvm pkg install $line
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to install dependency $line"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
#go linker complains and quits building when GOPATH has more than 14 paths
|
||||
#export GOPATH=$GOPATH:$CUR_PKG
|
||||
cp -rf ${CUR_PKG}/pkg ${build_dir}/deps
|
||||
done
|
||||
export GOPATH=$GOPATH:${build_dir}/deps
|
||||
fi
|
||||
echo ":complete" >> $build_dir/manifest
|
||||
}
|
||||
|
||||
function build_package() {
|
||||
echo "Installing $package_name..."
|
||||
if [[ -n $BUILD_NUMBER ]]; then
|
||||
export BUILD_NUMBER="`cat VERSION`.$BUILD_NUMBER"
|
||||
else
|
||||
export BUILD_NUMBER="`cat $source_dir/VERSION`.dev"
|
||||
fi
|
||||
echo "$BUILD_NUMBER" > $build_dir/BUILD_VERSION
|
||||
cd $source_dir && gvmake > $build_dir/build.log 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: Failed to build"
|
||||
cat "$build_dir/build.log"
|
||||
exit 1
|
||||
fi
|
||||
echo "Running tests..."
|
||||
cd $source_dir && gvmake test >> $build_dir/build.log 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: Failed tests"
|
||||
cat "$build_dir/build.log"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function install_package() {
|
||||
mkdir -p $GVM_ROOT/pkgs/pkg.gvm/$package_name/$BUILD_NUMBER &&
|
||||
if [ -f "$source_dir/Package.gvm" ]; then
|
||||
rm -rf $build_dir/deps
|
||||
fi
|
||||
cp -r $build_dir/* $GVM_ROOT/pkgs/pkg.gvm/$package_name/$BUILD_NUMBER &&
|
||||
rm -f $GVM_ROOT/pkgs/pkg.gvm/$package_name/current &&
|
||||
ln -s $GVM_ROOT/pkgs/pkg.gvm/$package_name/$BUILD_NUMBER $GVM_ROOT/pkgs/pkg.gvm/$package_name/current &&
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: Failed to install"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d $build_dir/bin ]; then
|
||||
mkdir -p $GVM_ROOT/pkgs/bin &&
|
||||
cp -f $build_dir/bin/* $GVM_ROOT/pkgs/bin/
|
||||
fi
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
rm -rf $build_dir
|
||||
rm -rf $source_dir
|
||||
}
|
||||
|
||||
download_package
|
||||
setup_build_env
|
||||
check_deps
|
||||
build_package
|
||||
install_package
|
||||
cleanup
|
||||
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 == "pkg" ]] && [[ $2 == "list" ]]; then
|
||||
CUR_VER=`readlink $GVM_ROOT/go | awk '{ n=split($1,path,"/"); print path[n] }'`
|
||||
CUR_PKGSET=`readlink $GVM_ROOT/pkgs | awk '{ n=split($1,path,"/"); print path[n] }'`
|
||||
echo "
|
||||
gvm packages $CUR_PKGSET@$CUR_VER"
|
||||
echo
|
||||
for package in $GVM_ROOT/pkgs/pkg.gvm/*; do
|
||||
if [ $package == "$GVM_ROOT/pkgs/pkg.gvm/*" ]; then
|
||||
break
|
||||
fi
|
||||
package_name=`echo $package | awk '{ n=split($1,path,"/"); print path[n] }'`
|
||||
output=$package_name" ("
|
||||
first=true
|
||||
for version in $package/*; do
|
||||
version=`echo $version | awk '{ n=split($1,path,"/"); print path[n] }'`
|
||||
if [ "$version" != "current" ]; then
|
||||
if [ $first == true ]; then
|
||||
first=false
|
||||
else
|
||||
output=$output", "
|
||||
fi
|
||||
version=`echo $version | awk '{ n=split($1,path,"/"); print path[n] }'`
|
||||
output=$output$version
|
||||
fi
|
||||
done
|
||||
output=$output")"
|
||||
|
||||
echo $output
|
||||
done
|
||||
echo
|
||||
else
|
||||
echo "Please use gvm [action] to call this file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 == "pkg" ]] && [[ $2 == "uninstall" ]]; then
|
||||
if [[ "$3" == "" ]]; then
|
||||
echo "ERROR: Please specify the package name"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
UNINSTALL_ROOT=$GVM_ROOT/pkgs/pkg.gvm/$3
|
||||
if [[ ! -d $UNINSTALL_ROOT ]]; then
|
||||
echo "ERROR: Invalid package name"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$4" != "" ]]; then
|
||||
UNINSTALL_ROOT=$UNINSTALL_ROOT/$4
|
||||
fi
|
||||
|
||||
if [[ -d $UNINSTALL_ROOT ]]; then
|
||||
rm -rf $UNINSTALL_ROOT
|
||||
else
|
||||
echo "ERROR: Invalid package version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$4" != "" ]]; then
|
||||
echo "Uninstalled $3 version $4"
|
||||
else
|
||||
echo "Uninstalled $3"
|
||||
fi
|
||||
else
|
||||
echo "Please use gvm [action] to call this file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 == "pkgset" ]]; then
|
||||
if [ -f $GVM_ROOT/bin/gvm-$1-$2 ]; then
|
||||
$GVM_ROOT/bin/gvm-$1-$2 $@
|
||||
elif [[ -n $2 ]]; then
|
||||
echo "ERROR: Unrecognized command line argument: '$2'"
|
||||
else
|
||||
echo "= gvm pkgset
|
||||
|
||||
* http://github.com/moovweb/gvm
|
||||
|
||||
== DESCRIPTION:
|
||||
|
||||
GVM pkgset is used to manage various Go packages
|
||||
|
||||
== Usage
|
||||
|
||||
gvm pkgset Command
|
||||
|
||||
== Command
|
||||
|
||||
create - create a new package set
|
||||
delete - delete a package set
|
||||
use - select where gb and goinstall target and link
|
||||
empty - remove all code and compiled binaries from package set
|
||||
list - list installed go packages"
|
||||
fi
|
||||
else
|
||||
echo "Please use gvm [action] to call this file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 == "pkgset" ]] && [[ $2 == "create" ]]; then
|
||||
if [[ -n $3 ]]; then
|
||||
CUR_VER=`readlink $GVM_ROOT/go | awk '{ n=split($1,path,"/"); print path[n] }'`
|
||||
if [[ $CUR_VER == "" ]]; then
|
||||
echo "ERROR: No Go version selected"
|
||||
exit 1
|
||||
else
|
||||
mkdir -p $GVM_ROOT/pkgsets/$CUR_VER/$3
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "ERROR: Could not create folder"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "ERROR: Please specifiy the name"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Please use gvm [action] to call this file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 == "pkgset" ]] && [[ $2 == "delete" ]]; then
|
||||
if [[ -n $3 ]]; then
|
||||
CUR_VER=`readlink $GVM_ROOT/go | awk '{ n=split($1,path,"/"); print path[n] }'`
|
||||
if [[ $CUR_VER == "" ]]; then
|
||||
echo "ERROR: No Go version selected"
|
||||
exit 1
|
||||
else
|
||||
rm -rf $GVM_ROOT/pkgsets/$CUR_VER/$3
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "ERROR: Could not delete package set"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "ERROR: Please specifiy the name"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Please use gvm [action] to call this file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 == "pkgset" ]] && [[ $2 == "empty" ]]; then
|
||||
CUR_VER=`readlink $GVM_ROOT/go | awk '{ n=split($1,path,"/"); print path[n] }'`
|
||||
if [[ $CUR_VER == "" ]]; then
|
||||
echo "ERROR: No Go version selected"
|
||||
exit 1
|
||||
else
|
||||
rm -rf $GVM_ROOT/pkgs/*
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "ERROR: Could not delete package set files"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Please use gvm [action] to call this file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 == "pkgset" ]] && [[ $2 == "list" ]]; then
|
||||
CUR_VER=`readlink $GVM_ROOT/go | awk '{ n=split($1,path,"/"); print path[n] }'`
|
||||
if [[ $CUR_VER == "" ]]; then
|
||||
echo "ERROR: No Go version selected"
|
||||
exit 1
|
||||
else
|
||||
echo "
|
||||
gvm go package sets ($CUR_VER)
|
||||
"
|
||||
if [ -d $GVM_ROOT/pkgsets ]; then
|
||||
if [ -e $GVM_ROOT/pkgs ]; then
|
||||
CUR_PKGSET=`readlink $GVM_ROOT/pkgs | awk '{ n=split($1,path,"/"); print path[n] }'`
|
||||
ls -1 $GVM_ROOT/pkgsets/$CUR_VER | sed 's/^/ /g' | sed 's/^ '$CUR_PKGSET'/=> '$CUR_PKGSET'/g'
|
||||
else
|
||||
ls -1 $GVM_ROOT/pkgsets/$CUR_VER | sed 's/^/ /g'
|
||||
fi
|
||||
else
|
||||
echo "No installed Go versions. \`gvm install [version]\` to install Go."
|
||||
fi
|
||||
echo
|
||||
fi
|
||||
else
|
||||
echo "Please use gvm [action] to call this file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 == "pkgset" ]] && [[ $2 == "use" ]]; then
|
||||
CUR_VER=`readlink $GVM_ROOT/go | awk '{ n=split($1,path,"/"); print path[n] }'`
|
||||
if [[ $CUR_VER == "" ]]; then
|
||||
echo "ERROR: No Go version selected"
|
||||
exit 1
|
||||
else
|
||||
if [ -e $GVM_ROOT/pkgsets/$CUR_VER/$3 ]; then
|
||||
rm -f $GVM_ROOT/pkgs
|
||||
ln -s $GVM_ROOT/pkgsets/$CUR_VER/$3 $GVM_ROOT/pkgs
|
||||
else
|
||||
echo "ERROR: Invalid package set name"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "Please use gvm [action] to call this file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
function gvm_prompt() {
|
||||
if [[ "$1" == "g" ]]; then
|
||||
echo $gvm_go_name
|
||||
elif [[ "$1" == "ps" ]]; then
|
||||
echo $gvm_pkgset_name
|
||||
else
|
||||
if [[ $gvm_pkgset_name != "" ]]; then
|
||||
if [[ $gvm_pkgset_name != "global" ]]; then
|
||||
echo "$gvm_go_name@$gvm_pkgset_name"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
echo $gvm_go_name
|
||||
fi
|
||||
}
|
||||
|
||||
gvm_prompt $@
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 == "uninstall" ]]; then
|
||||
if [[ -n $2 ]]; then
|
||||
fuzzy_match=`ls $GVM_ROOT/gos | grep "$2"`
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Invalid version $2"
|
||||
exit 1
|
||||
fi
|
||||
if [ -d $GVM_ROOT/gos/$fuzzy_match ]; then
|
||||
rm -rf $GVM_ROOT/gos/$fuzzy_match
|
||||
rm -rf $GVM_ROOT/pkgsets/$fuzzy_match
|
||||
echo "Uninstalled version $fuzzy_match"
|
||||
else
|
||||
echo "Invalid version"
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
else
|
||||
echo "ERROR: Please specifiy the version"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Please use gvm [action] to call this file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
if [[ $1 == "use" ]]; then
|
||||
if [[ -n $2 ]]; then
|
||||
fuzzy_match=`ls $GVM_ROOT/gos | grep "$2"`
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Invalid version $2"
|
||||
exit 1
|
||||
fi
|
||||
if [ -d $GVM_ROOT/gos/$fuzzy_match ]; then
|
||||
rm -f $GVM_ROOT/go
|
||||
ln -s $GVM_ROOT/gos/$fuzzy_match $GVM_ROOT/go
|
||||
rm -f $GVM_ROOT/pkgs
|
||||
ln -s $GVM_ROOT/pkgsets/$fuzzy_match/default $GVM_ROOT/pkgs
|
||||
else
|
||||
echo "Invalid version $2"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "ERROR: Please specifiy the version"
|
||||
exit 1
|
||||
fi
|
||||
echo "Now using version $fuzzy_match"
|
||||
exit 0
|
||||
else
|
||||
echo "Please use gvm [action] to call this file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
+1
-6
@@ -1,6 +1 @@
|
||||
if [[ -f Makefile.gvm ]]; then
|
||||
make -f Makefile.gvm $@
|
||||
else
|
||||
gb -bi
|
||||
fi
|
||||
|
||||
make -f Makefile.gvm $@
|
||||
|
||||
Executable → Regular
+35
-45
@@ -1,12 +1,4 @@
|
||||
#!/bin/bash
|
||||
display_error() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1"
|
||||
tput sgr0
|
||||
exit 1
|
||||
}
|
||||
|
||||
BRANCH=$1
|
||||
if [ "$(whoami)" != "root" ]; then
|
||||
GVM_DEST=~
|
||||
@@ -18,44 +10,42 @@ fi
|
||||
|
||||
ENV_FILE=~/.bashrc
|
||||
SRC_REPO=git://github.com/moovweb/gvm.git
|
||||
#SRC_REPO=~/install.gvm
|
||||
|
||||
[ -d $GVM_DEST/$GVM_NAME ] && display_error "Already installed!"
|
||||
|
||||
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" == "stable" ]; then
|
||||
cd $GVM_DEST/$GVM_NAME && git checkout $BRANCH > /dev/null 2>&1 ||
|
||||
display_error "Failed to checkout $BRANCH branch"
|
||||
fi
|
||||
|
||||
mv $GVM_DEST/$GVM_NAME/.git $GVM_DEST/$GVM_NAME/git.bak
|
||||
|
||||
if [ "$(whoami)" != "root" ]; then
|
||||
if [ -e ~/.bashrc ]; then
|
||||
cat ~/.bashrc | grep "\[\[ -s \"\$HOME/.gvm/scripts/gvm\" ]] && source \"\$HOME/.gvm/scripts/gvm\"" > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo '[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"' >> $ENV_FILE
|
||||
fi
|
||||
elif [ -e ~/.profile ]; then
|
||||
cat ~/.bashrc | grep "\[\[ -s \"\$HOME/.gvm/scripts/gvm\" ]] && source \"\$HOME/.gvm/scripts/gvm\"" > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo '[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"' >> $ENV_FILE
|
||||
fi
|
||||
else
|
||||
echo 'Unable to location profile settings file'
|
||||
echo
|
||||
echo " You will have to manually add the following line:"
|
||||
echo " [[ -s \"\$HOME/.gvm/scripts/gvm\" ]] && source \"\$HOME/.gvm/scripts/gvm\""
|
||||
echo
|
||||
echo "To get started right away run \`source ~/.gvm/scripts/gvm\`"
|
||||
echo
|
||||
if [ -d $GVM_DEST/$GVM_NAME ]; then
|
||||
echo "Already installed!"
|
||||
else
|
||||
cd $GVM_DEST && git clone $SRC_REPO $GVM_NAME > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to clone from $SRC_REPO into $GVM_DEST/$GVM_NAME"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$BRANCH" == "stable" ]; then
|
||||
cd $GVM_DEST/$GVM_NAME && git checkout $BRANCH > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to checkout $BRANCH branch"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
mv $GVM_DEST/$GVM_NAME/.git $GVM_DEST/$GVM_NAME/git.bak
|
||||
if [ "$(whoami)" != "root" ]; then
|
||||
if [ -e ~/.bashrc ]; then
|
||||
cat ~/.bashrc | grep "\[\[ -s \"\$HOME/.gvm/scripts/gvm\" ]] && source \"\$HOME/.gvm/scripts/gvm\"" > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo '[[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"' >> $ENV_FILE
|
||||
fi
|
||||
else
|
||||
echo 'This must be a Mac... put this line in you profile and source it!'
|
||||
echo
|
||||
echo ' [[ -s "$HOME/.gvm/scripts/gvm" ]] && source "$HOME/.gvm/scripts/gvm"'
|
||||
echo
|
||||
echo "Maybe send me the file name and I'll look for it next time :)"
|
||||
echo
|
||||
fi
|
||||
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
|
||||
[[ -s "$GVM_DEST/$GVM_NAME/scripts/gvm" ]] && source "$GVM_DEST/$GVM_NAME/scripts/gvm"
|
||||
echo "Installed GVM v$GVM_VERSION"
|
||||
echo "Please restart your terminal session"
|
||||
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
|
||||
[[ -s "$GVM_DEST/$GVM_NAME/scripts/gvm" ]] && source "$GVM_DEST/$GVM_NAME/scripts/gvm"
|
||||
echo "Installed GVM v$GVM_VERSION"
|
||||
echo "Please restart your terminal session"
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
git@github.com:moovweb
|
||||
@@ -1,12 +0,0 @@
|
||||
package main
|
||||
|
||||
import "os"
|
||||
|
||||
func main() {
|
||||
gvm_root := os.Getenv("GVM_ROOT")
|
||||
if gvm_root == "" {
|
||||
println("ERROR: gpkg requires gvm to run (http://github.com/moovweb/gvm)")
|
||||
} else {
|
||||
println("GVM Package Manager for release.r60.3!")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
gvm:
|
||||
echo `cat PackageFile`
|
||||
|
||||
#gvm: all
|
||||
# echo $(pkgdir)
|
||||
# echo _obj/$(TARG).a
|
||||
|
||||
|
||||
# make $(GVM_ROOT)/scripts/Make.pkg all
|
||||
#
|
||||
#all: $(INSTALLFILES)
|
||||
# echo $(INSTALLFILES)
|
||||
#gvminstall: $(INSTALLFILES)
|
||||
# ifdef GVM_PACKAGE_INSTALL
|
||||
# include $(GOROOT)/src/Makeaaa.pkg
|
||||
# endif
|
||||
@@ -1,81 +0,0 @@
|
||||
_gvm()
|
||||
{
|
||||
local cur prev opts base
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
base="${COMP_WORDS[0]}"
|
||||
cmd="${COMP_WORDS[1]}"
|
||||
subcmd="${COMP_WORDS[2]}"
|
||||
|
||||
case "${cmd}" in
|
||||
pkgset)
|
||||
case "${subcmd}" in
|
||||
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 )
|
||||
COMPREPLY=( $(compgen -W "${version}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
create|list)
|
||||
return 1
|
||||
;;
|
||||
*)
|
||||
opts="create delete empty list use"
|
||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
pkg)
|
||||
case "${subcmd}" in
|
||||
uninstall)
|
||||
[[ "$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 )
|
||||
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 )
|
||||
COMPREPLY=( $(compgen -W "${version}" -- ${cur}) )
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
;;
|
||||
install|list)
|
||||
return 1
|
||||
;;
|
||||
*)
|
||||
opts="install list uninstall"
|
||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
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 )
|
||||
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 )
|
||||
COMPREPLY=( $(compgen -W "${installed_versions}" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
[[ $COMP_CWORD > 1 ]] && return 1
|
||||
opts="get install list listall uninstall use version"
|
||||
[[ "$gvm_go_name" != "" ]] && opts="get install list listall pkgset uninstall use version"
|
||||
[[ "$gvm_pkgset_name" != "" ]] && opts="get install list listall pkg pkgset uninstall use version"
|
||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
complete -F _gvm gvm
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/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"
|
||||
|
||||
foldername=$GVM_ROOT/gos/$fuzzy_match
|
||||
else
|
||||
if [ "$gvm_go_name" != "" ]; then
|
||||
foldername=$GVM_ROOT/gos/$gvm_go_name
|
||||
else
|
||||
display_error "No version selected"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d $foldername ]; then
|
||||
cd $foldername
|
||||
find . > /tmp/manifest.test
|
||||
diff manifest /tmp/manifest.test
|
||||
if [ "$?" == "0" ]; then
|
||||
display_message "Clean $foldername"
|
||||
else
|
||||
display_message "*Dirty* $foldername"
|
||||
fi
|
||||
else
|
||||
display_error "Invalid version"
|
||||
fi
|
||||
Vendored
-41
@@ -1,41 +0,0 @@
|
||||
#!/bin/bash
|
||||
function display_error() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
return 1
|
||||
}
|
||||
|
||||
function gvm() {
|
||||
if [[ "$GVM_ROOT" == "" ]]; then
|
||||
display_error "GVM_ROOT not set. Please source GVM_ROOT/scripts/gvm"
|
||||
return $?
|
||||
fi
|
||||
if [[ ! -d $GVM_ROOT ]]; then
|
||||
display_error "GVM_ROOT does not exist. Please reinstall GVM"
|
||||
return $?
|
||||
fi
|
||||
|
||||
mkdir -p $GVM_ROOT/logs > /dev/null 2>&1
|
||||
mkdir -p $GVM_ROOT/gos > /dev/null 2>&1
|
||||
mkdir -p $GVM_ROOT/archive > /dev/null 2>&1
|
||||
mkdir -p $GVM_ROOT/archive/package > /dev/null 2>&1
|
||||
mkdir -p $GVM_ROOT/environments > /dev/null 2>&1
|
||||
|
||||
if [ "$1" == "use" ]; then
|
||||
. $GVM_ROOT/scripts/env/use
|
||||
shift
|
||||
gvm_use $@
|
||||
elif [ "$1" == "implode" ]; then
|
||||
rm -rf $GVM_ROOT
|
||||
elif [ "$1" == "pkgset" ] && [ "$2" == "use" ]; then
|
||||
. $GVM_ROOT/scripts/env/pkgset-use
|
||||
shift
|
||||
shift
|
||||
gvm_pkgset_use $@
|
||||
else
|
||||
$GVM_ROOT/bin/gvm $@
|
||||
fi
|
||||
}
|
||||
|
||||
Vendored
-24
@@ -1,24 +0,0 @@
|
||||
display_error() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
return 1
|
||||
}
|
||||
|
||||
function gvm_pkgset_use() {
|
||||
[[ "$1" != "" ]] ||
|
||||
display_error "Please specify a package set" || return 1
|
||||
|
||||
[[ "$gvm_go_name" != "" ]] ||
|
||||
display_error "No Go version selected" || return 1
|
||||
|
||||
fuzzy_match=`ls $GVM_ROOT/environments | sort | grep "$gvm_go_name@" | head -n 1 | grep "$1"` ||
|
||||
display_error "Invalid package set" || return 1
|
||||
|
||||
. "$GVM_ROOT/environments/$gvm_go_name@$1" ||
|
||||
display_error "Failed to source the package set environment" || return 1
|
||||
|
||||
echo "Now using version $fuzzy_match"
|
||||
}
|
||||
|
||||
Vendored
-30
@@ -1,30 +0,0 @@
|
||||
function display_error() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
return 1
|
||||
}
|
||||
|
||||
display_message() {
|
||||
# GREEN!
|
||||
tput sgr0
|
||||
tput setaf 2
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
}
|
||||
|
||||
function gvm_use() {
|
||||
[[ "$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
|
||||
|
||||
. $GVM_ROOT/environments/$fuzzy_match
|
||||
if [[ "$2" == "--default" ]]; then
|
||||
cp $GVM_ROOT/environments/$fuzzy_match $GVM_ROOT/environments/default
|
||||
fi
|
||||
|
||||
display_message "Now using version $fuzzy_match"
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
display_error() {
|
||||
tput sgr0
|
||||
tput setaf 1
|
||||
echo "ERROR: $1" >&2
|
||||
tput sgr0
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
display_message() {
|
||||
# GREEN!
|
||||
tput sgr0
|
||||
tput setaf 2
|
||||
echo "$1"
|
||||
tput sgr0
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
for function in $GVM_ROOT/scripts/function/*; do
|
||||
. $function
|
||||
done
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
#!/bin/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"
|
||||
|
||||
cd $GVM_ROOT && git checkout -f ||
|
||||
display_error "Failed to clean install"
|
||||
|
||||
if [[ -n $1 ]]; then
|
||||
cd $GVM_ROOT && git checkout $1 -f ||
|
||||
display_error "Failed to checkout $1 branch"
|
||||
fi
|
||||
|
||||
cd $GVM_ROOT && git pull ||
|
||||
display_error "Failed to update"
|
||||
|
||||
mv $GVM_ROOT/.git $GVM_ROOT/git.bak ||
|
||||
display_error "Couldn't backup git info"
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[ -z `which hg` ] &&
|
||||
display_error '* Could not find mercurial (try `sudo apt-get install mercurial`)'
|
||||
[ -z `which ar` ] &&
|
||||
display_error '* Could not find binutils (try `sudo apt-get install binutils (or binutils-multiarch)`)'
|
||||
[ -z `which bison` ] &&
|
||||
display_error '* Could not find bison (try `sudo apt-get install bison`)'
|
||||
[ -z `which gcc` ] &&
|
||||
display_error '* Could not find gcc (try `sudo apt-get install gcc`)'
|
||||
[ -z `which make` ] &&
|
||||
display_error '* Could not find make (try `sudo apt-get install make`)'
|
||||
|
||||
exit 0
|
||||
+3
-13
@@ -3,18 +3,8 @@ unset GOARCH
|
||||
unset GOOS
|
||||
unset GOPATH
|
||||
unset GOBIN
|
||||
|
||||
unset gvm_go_name
|
||||
unset gvm_pkgset_name
|
||||
|
||||
mkdir -p $GVM_ROOT/logs > /dev/null 2>&1
|
||||
mkdir -p $GVM_ROOT/gos > /dev/null 2>&1
|
||||
mkdir -p $GVM_ROOT/archive > /dev/null 2>&1
|
||||
mkdir -p $GVM_ROOT/archive/package > /dev/null 2>&1
|
||||
mkdir -p $GVM_ROOT/environments > /dev/null 2>&1
|
||||
|
||||
export GVM_VERSION=`cat $GVM_ROOT/VERSION`
|
||||
export PATH=$GVM_ROOT/bin:$PATH
|
||||
[ -f $GVM_ROOT/environments/default ] && . $GVM_ROOT/environments/default
|
||||
. $GVM_ROOT/scripts/env/gvm
|
||||
export GOROOT=$GVM_ROOT/go
|
||||
export GOPATH=$GVM_ROOT/pkgs
|
||||
export PATH=$GVM_ROOT/bin:$GVM_ROOT/pkgs/bin:$GVM_ROOT/go/bin:$PATH
|
||||
|
||||
|
||||
-129
@@ -1,129 +0,0 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
download_source() {
|
||||
GO_CACHE_PATH=$GVM_ROOT/archive/go
|
||||
GO_SOURCE_URL=https://go.googlecode.com/hg/
|
||||
[ -d $GO_CACHE_PATH ] && return
|
||||
echo "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"
|
||||
}
|
||||
|
||||
check_tag() {
|
||||
version=`hg tags -R $GO_CACHE_PATH | awk '{print $1}' | sort | grep $VERSION | head -n 1 | grep $VERSION`
|
||||
}
|
||||
|
||||
update_source() {
|
||||
echo "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"
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
|
||||
|
||||
compile_go() {
|
||||
echo " * Compiling..."
|
||||
unset GOARCH && unset GOOS && unset GOPATH && unset GOBIN && unset GOROOT &&
|
||||
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 ||
|
||||
(rm -rf $GO_INSTALL_ROOT && display_error "Failed to compile")
|
||||
}
|
||||
|
||||
create_enviroment() {
|
||||
new_env_file=$GVM_ROOT/environments/$version
|
||||
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_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
|
||||
. $GVM_ROOT/scripts/env/use
|
||||
gvm_use $version &> /dev/null
|
||||
gvm pkgset create global
|
||||
. $GVM_ROOT/scripts/env/pkgset-use
|
||||
gvm_pkgset_use global &> /dev/null
|
||||
unset GOPATH
|
||||
}
|
||||
|
||||
install_go() {
|
||||
GO_INSTALL_ROOT=$GVM_ROOT/gos/$version
|
||||
trap 'rm -rf $GO_INSTALL_ROOT; display_error "Canceled!"' INT
|
||||
|
||||
# Check for existing install
|
||||
[ -d $GO_INSTALL_ROOT ] &&
|
||||
display_error "Already installed!"
|
||||
|
||||
echo "Installing $version..."
|
||||
|
||||
# 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"
|
||||
|
||||
copy_source
|
||||
compile_go
|
||||
create_enviroment
|
||||
}
|
||||
|
||||
install_gpkg() {
|
||||
echo " * Installing gpkg..."
|
||||
goinstall github.com/moovweb/gvm/gpkg > /dev/null 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to install gpkg"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
install_gb() {
|
||||
if [[ "$version" == "release.r60.3" ]]; then
|
||||
echo " * Installing gb..."
|
||||
goinstall github.com/skelterjohn/go-gb/gb > /dev/null 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to install gb"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
install_goprotobuf() {
|
||||
if [[ "$version" == "release.r60.3" ]]; then
|
||||
echo " * Installing goprotobuf..."
|
||||
goinstall goprotobuf.googlecode.com/hg/proto > /dev/null 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Failed to install goprotobuf"
|
||||
return 1
|
||||
fi
|
||||
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
|
||||
echo "Failed to install goprotobuf compiler"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
main() {
|
||||
VERSION=$1
|
||||
trap 'display_error "Canceled!"' INT
|
||||
# GREEN!
|
||||
tput sgr0
|
||||
tput setaf 2
|
||||
[ -z $VERSION ] && display_error "No version specified"
|
||||
download_source
|
||||
check_tag || (update_source && check_tag) || display_error "Unrecognized Go version"
|
||||
install_go
|
||||
install_gpkg
|
||||
install_gb
|
||||
install_goprotobuf
|
||||
cd $GO_INSTALL_ROOT && find . > manifest
|
||||
tput sgr0
|
||||
}
|
||||
|
||||
main $@
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
echo
|
||||
display_message "gvm gos (installed)"
|
||||
echo
|
||||
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'
|
||||
else
|
||||
ls -1 $GVM_ROOT/gos | sed 's/^/ /g'
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
function show_usage() {
|
||||
echo "Usage: gvm listall [options]"
|
||||
echo " -a, --all List all tags."
|
||||
echo " -h, --help Display this message."
|
||||
}
|
||||
|
||||
function read_command_line() {
|
||||
tag_filter="release"
|
||||
for i in $*; do
|
||||
case $i in
|
||||
-a|--all)
|
||||
tag_filter=""
|
||||
;;
|
||||
-h|--help*)
|
||||
show_usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option $i"
|
||||
show_usage
|
||||
exit 65 # Bad arguments
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
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`
|
||||
if [[ $? -ne 0 ]]; then
|
||||
display_error "Failed to get version list from Google"
|
||||
fi
|
||||
for version in $versions; do
|
||||
echo " $version"
|
||||
done
|
||||
echo
|
||||
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[[ $gvm_go_name != "" ]] ||
|
||||
display_error "No Go version selected"
|
||||
[[ -d $GVM_ROOT/gos/$gvm_go_name ]] ||
|
||||
display_error "Invalid or corrupt Go version"
|
||||
[[ -d $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name ]] ||
|
||||
display_error "Missing package set folder"
|
||||
|
||||
command=$1
|
||||
if [ -f $GVM_ROOT/scripts/pkg-$command ]; then
|
||||
shift
|
||||
$GVM_ROOT/scripts/pkg-$command $@
|
||||
elif [[ -n $command ]]; then
|
||||
display_error "Unrecognized command line argument: '$command'"
|
||||
else
|
||||
echo "= gvm pkg
|
||||
|
||||
* http://github.com/moovweb/gvm
|
||||
|
||||
== DESCRIPTION:
|
||||
|
||||
GVM Package is used to manage various Go packages
|
||||
|
||||
== Usage
|
||||
|
||||
gvm pkg Command
|
||||
|
||||
== Command
|
||||
|
||||
install - install go packages
|
||||
uninstall - uninstall go packages
|
||||
list - list installed go packages"
|
||||
fi
|
||||
|
||||
@@ -1,195 +0,0 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
show_usage() {
|
||||
echo "Usage: gvm pkg install Package [options]"
|
||||
echo " -v, --version=VERSION Set the package version to install."
|
||||
echo " -s, --source=SORUCE Specify the source for this package."
|
||||
echo " --strict Only use installed packages."
|
||||
echo " -a, --all Update all dependencies."
|
||||
echo " -h, --help Display this message."
|
||||
}
|
||||
|
||||
function read_command_line() {
|
||||
[[ "$1" == "" ]] &&
|
||||
display_error "Please specify package name"
|
||||
|
||||
# Get package name
|
||||
package_name=$1
|
||||
sources=`cat $GVM_ROOT/config/sources`
|
||||
shift
|
||||
|
||||
for i in $*; do
|
||||
case $i in
|
||||
-v=*|--version=*)
|
||||
version=`echo $i | sed 's/[-a-zA-Z0-9]*=//'`
|
||||
;;
|
||||
-s=*|--source=*)
|
||||
sources=`echo $i | sed 's/[-a-zA-Z0-9]*=//' && echo $sources`
|
||||
;;
|
||||
-a|--all)
|
||||
all_deps="true"
|
||||
;;
|
||||
-h|--help*)
|
||||
show_usage
|
||||
exit 0
|
||||
;;
|
||||
--strict)
|
||||
strict="true"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid option $i"
|
||||
show_usage
|
||||
exit 65 # Bad arguments
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
gvm_go_path=$GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name
|
||||
cache_dir=$GVM_ROOT/archive/package/$package_name
|
||||
tmp_dir=$GVM_ROOT/tmp/$$
|
||||
source_dir=$tmp_dir/$package_name/src/$package_name
|
||||
build_dir=$tmp_dir/$package_name/build
|
||||
}
|
||||
|
||||
function download_package() {
|
||||
[ -d $cache_dir ] && return
|
||||
#echo "Downloading $package_name..."
|
||||
for source in $sources; do
|
||||
git clone $source/$package_name $cache_dir > /dev/null 2>&1
|
||||
if [ "$?" == "0" ]; then
|
||||
echo $source > $cache_dir/GVM_SOURCE
|
||||
return
|
||||
fi
|
||||
done
|
||||
display_error "Could not find $package_name in any sources"
|
||||
}
|
||||
|
||||
function update_package_cache() {
|
||||
cd $cache_dir && git pull > /dev/null 2>&1 ||
|
||||
display_error "Failed to update source"
|
||||
}
|
||||
|
||||
function copy_tmp_source() {
|
||||
rm -rf $source_dir
|
||||
if [ "$version" != "" ]; then
|
||||
git clone $cache_dir $source_dir > /dev/null 2>&1
|
||||
cd $source_dir && git checkout $version > /dev/null 2>&1 ||
|
||||
return 1
|
||||
else
|
||||
git clone $cache_dir $source_dir > /dev/null 2>&1
|
||||
cd $source_dir
|
||||
git describe --exact-match > /dev/null 2>&1
|
||||
if [ "$?" == "0" ]; then
|
||||
git_tag=`git describe --exact-match`
|
||||
git_version=`echo $git_tag | awk '{ n=split($1,path,"_"); print path[n] }'`
|
||||
if [ "$BUILD_NUMBER" == "" ]; then
|
||||
BUILD_NUMBER=$git_version
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function setup_build_env() {
|
||||
rm -rf $build_dir && mkdir -p $build_dir
|
||||
copy_tmp_source
|
||||
if [ "$?" != "0" ]; then
|
||||
update_package_cache
|
||||
copy_tmp_source ||
|
||||
display_error "Invalid version"
|
||||
fi
|
||||
if [[ -f $source_dir/VERSION ]]; then
|
||||
SOURCE_VERSION=`cat $source_dir/VERSION`
|
||||
fi
|
||||
|
||||
if [[ -n $BUILD_NUMBER ]]; then
|
||||
BUILD_NUMBER="$SOURCE_VERSION.$BUILD_NUMBER"
|
||||
else
|
||||
if [[ "$SOURCE_VERSION" != "" ]]; then
|
||||
BUILD_NUMBER="$SOURCE_VERSION.src"
|
||||
else
|
||||
BUILD_NUMBER="src"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function install_dep() {
|
||||
[[ "$strict" == "true" ]] && display_error "Missing dependancy ($1) and strict mode is set"
|
||||
[[ "$source" == "." ]] && passthrough_options="--source=. "$passthrough_options
|
||||
[[ "$all_deps" == "true" ]] && passthrough_options="--all "$passthrough_options
|
||||
|
||||
gvm pkg install $1 $passthrough_options ||
|
||||
display_error "Failed to install dependency $1"
|
||||
}
|
||||
|
||||
function load_dep() {
|
||||
if [[ "$all_deps" == "true" ]]; then
|
||||
install_dep $1
|
||||
fi
|
||||
|
||||
CUR_PKG=$gvm_go_path/pkg.gvm/$1/current
|
||||
if [ -e "$CUR_PKG/BUILD_VERSION" ]; then
|
||||
echo "pkg $1 `cat $CUR_PKG/BUILD_VERSION`" >> $build_dir/manifest
|
||||
else
|
||||
install_dep $1
|
||||
fi
|
||||
cp -rf $CUR_PKG/pkg $build_dir
|
||||
}
|
||||
|
||||
function check_deps() {
|
||||
export GOPATH=$build_dir
|
||||
echo ":source `cat $cache_dir/GVM_SOURCE`" >> $build_dir/manifest
|
||||
if [ -f "$source_dir/Package.gvm" ]; then
|
||||
for line in `cat $source_dir/Package.gvm | grep ^pkg | awk '{ print $2 }'`; do
|
||||
load_dep $line
|
||||
done
|
||||
fi
|
||||
echo ":complete" >> $build_dir/manifest
|
||||
}
|
||||
|
||||
function copy_source() {
|
||||
mkdir -p $gvm_go_path/pkg.gvm/$package_name/$BUILD_NUMBER
|
||||
cp -rf $source_dir $gvm_go_path/pkg.gvm/$package_name/$BUILD_NUMBER/
|
||||
}
|
||||
|
||||
function build_package() {
|
||||
echo "Installing $package_name-$BUILD_NUMBER..."
|
||||
echo "$BUILD_NUMBER" > $build_dir/BUILD_VERSION
|
||||
cd $source_dir && gvmake > $build_dir/build.log 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: Failed to build"
|
||||
cat "$build_dir/build.log"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function install_package() {
|
||||
mkdir -p $gvm_go_path/pkg.gvm/$package_name/$BUILD_NUMBER &&
|
||||
cp -r $build_dir/* $gvm_go_path/pkg.gvm/$package_name/$BUILD_NUMBER &&
|
||||
rm -f $gvm_go_path/pkg.gvm/$package_name/current &&
|
||||
ln -s $gvm_go_path/pkg.gvm/$package_name/$BUILD_NUMBER $gvm_go_path/pkg.gvm/$package_name/current &&
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: Failed to install"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d $build_dir/bin ]; then
|
||||
echo " * Installing binaries"
|
||||
mkdir -p $gvm_go_path/bin &&
|
||||
cp -f $build_dir/bin/* $gvm_go_path/bin/
|
||||
fi
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
rm -rf $tmp_dir
|
||||
}
|
||||
|
||||
read_command_line $@
|
||||
download_package
|
||||
setup_build_env
|
||||
check_deps
|
||||
copy_source
|
||||
build_package
|
||||
install_package
|
||||
cleanup
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
echo "
|
||||
gvm packages $gvm_go_name@$gvm_pkgset_name"
|
||||
echo
|
||||
|
||||
package_folder=$GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name
|
||||
for package in $package_folder/pkg.gvm/*; do
|
||||
if [ $package == "$package_folder/pkg.gvm/*" ]; then
|
||||
break
|
||||
fi
|
||||
package_name=`echo $package | awk '{ n=split($1,path,"/"); print path[n] }'`
|
||||
output=$package_name" ("
|
||||
first=true
|
||||
for version in $package/*; do
|
||||
version=`echo $version | awk '{ n=split($1,path,"/"); print path[n] }'`
|
||||
if [ "$version" != "current" ]; then
|
||||
if [ $first == true ]; then
|
||||
first=false
|
||||
else
|
||||
output=$output", "
|
||||
fi
|
||||
version=`echo $version | awk '{ n=split($1,path,"/"); print path[n] }'`
|
||||
output=$output$version
|
||||
fi
|
||||
done
|
||||
output=$output")"
|
||||
|
||||
echo $output
|
||||
done
|
||||
if [ -f $package_folder/goinstall.log ]; then
|
||||
echo
|
||||
echo "Installing via goinstall"
|
||||
echo
|
||||
cat $package_folder/goinstall.log
|
||||
fi
|
||||
echo
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[[ "$1" == "" ]] &&
|
||||
display_error "Please specify package name"
|
||||
|
||||
gvm_go_path=$GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name
|
||||
|
||||
UNINSTALL_ROOT=$gvm_go_path/pkg.gvm/$1
|
||||
if [[ ! -d $UNINSTALL_ROOT ]]; then
|
||||
echo "ERROR: Invalid package name"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$2" != "" ]]; then
|
||||
UNINSTALL_ROOT=$UNINSTALL_ROOT/$2
|
||||
fi
|
||||
|
||||
if [[ -d $UNINSTALL_ROOT ]]; then
|
||||
rm -rf $UNINSTALL_ROOT
|
||||
else
|
||||
echo "ERROR: Invalid package version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$4" != "" ]]; then
|
||||
echo "Uninstalled $1 version $2"
|
||||
else
|
||||
echo "Uninstalled $1"
|
||||
fi
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[[ "$1" == "" ]] &&
|
||||
display_error "Please specify package name"
|
||||
|
||||
[[ ! -d $GVM_ROOT/archive/package/$1 ]] &&
|
||||
display_error "Invalid package"
|
||||
|
||||
cd $GVM_ROOT/archive/package/$1
|
||||
git pull &> /dev/null
|
||||
if [ "$?" == "1" ]; then
|
||||
echo "Changes!"
|
||||
else
|
||||
echo "No changes"
|
||||
fi
|
||||
|
||||
#cd git pull
|
||||
#gvm_go_path=$GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[[ $gvm_go_name != "" ]] ||
|
||||
display_error "No Go version selected"
|
||||
[[ -d $GVM_ROOT/gos/$gvm_go_name ]] ||
|
||||
display_error "Invalid or corrupt Go version"
|
||||
[[ -d $GVM_ROOT/pkgsets/$gvm_go_name ]] ||
|
||||
display_error "Missing package set folder for this Go version"
|
||||
|
||||
command=$1
|
||||
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'"
|
||||
else
|
||||
echo "= gvm pkgset
|
||||
|
||||
* http://github.com/moovweb/gvm
|
||||
|
||||
== DESCRIPTION:
|
||||
|
||||
GVM pkgset is used to manage various Go packages
|
||||
|
||||
== Usage
|
||||
|
||||
gvm pkgset Command
|
||||
|
||||
== Command
|
||||
|
||||
create - create a new package set
|
||||
delete - delete a package set
|
||||
use - select where gb and goinstall target and link
|
||||
empty - remove all code and compiled binaries from package set
|
||||
list - list installed go packages"
|
||||
fi
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[[ $1 != "" ]] ||
|
||||
display_error "Please specifiy the name"
|
||||
|
||||
[[ ! -f "$GVM_ROOT/environments/$gvm_go_name@$1" ]] ||
|
||||
display_error "Packageset already exists!"
|
||||
|
||||
mkdir -p $GVM_ROOT/pkgsets/$gvm_go_name/$1 ||
|
||||
display_error "Could not create folder"
|
||||
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/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/release.r60.3/$1/bin:\$PATH\"" >> $GVM_ROOT/environments/$gvm_go_name@$1 ||
|
||||
display_error "Could not extend environment"
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[[ $gvm_go_name != "" ]] ||
|
||||
display_error "No Go version selected"
|
||||
|
||||
[[ $1 != "" ]] ||
|
||||
display_error "Please specifiy the name"
|
||||
|
||||
[[ -d $GVM_ROOT/pkgsets/$gvm_go_name/$1 ]] ||
|
||||
display_error "Packageset doesn't exist!"
|
||||
|
||||
rm -rf $GVM_ROOT/pkgsets/$gvm_go_name/$1 ||
|
||||
display_error "Could not delete package set"
|
||||
|
||||
rm -rf $GVM_ROOT/environments/$gvm_go_name@$1 ||
|
||||
display_error "Could not delete package set"
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[[ $gvm_pkgset_name != "" ]] ||
|
||||
display_error "No Package set selected"
|
||||
rm -rf $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/* ||
|
||||
display_error "Could not delete package set files"
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo "
|
||||
gvm go package sets ($gvm_go_name)
|
||||
"
|
||||
if [ -d $GVM_ROOT/pkgsets ]; then
|
||||
if [[ $gvm_pkgset_name == "" ]]; then
|
||||
ls -1 $GVM_ROOT/pkgsets/$gvm_go_name | sed 's/^/ /g'
|
||||
else
|
||||
ls -1 $GVM_ROOT/pkgsets/$gvm_go_name | sed 's/^/ /g' | sed 's/^ '$gvm_pkgset_name'/=> '$gvm_pkgset_name'/g'
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
display_message "*** CURRENT SOURCES ***"
|
||||
echo
|
||||
cat $GVM_ROOT/config/sources
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
|
||||
[[ "$1" == "" ]] &&
|
||||
display_error "Please specifiy the version"
|
||||
|
||||
fuzzy_match=`ls $GVM_ROOT/gos | sort | grep "$1" | head -n 1 | grep "$1"` ||
|
||||
display_error "Invalid version $1"
|
||||
|
||||
if [ -d $GVM_ROOT/gos/$fuzzy_match ]; then
|
||||
rm -rf $GVM_ROOT/gos/$fuzzy_match
|
||||
rm -rf $GVM_ROOT/pkgsets/$fuzzy_match
|
||||
rm -f $GVM_ROOT/environments/$fuzzy_match
|
||||
rm -f "$GVM_ROOT/environments/$fuzzy_match@"*
|
||||
echo "Uninstalled version $fuzzy_match"
|
||||
else
|
||||
display_error "Invalid version"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user