44 Commits
Author SHA1 Message Date
jenkins 19ae86559a Fix manifest file location 2012-03-10 22:31:47 +00:00
jenkins c6533ce424 Fix the jenkins hack 2012-03-08 20:48:55 +00:00
jenkins 018a9552df Fix to the hack :P 2012-03-07 11:51:26 +00:00
jenkins 045b88de76 Hack for Jenkins gvm_build script 2012-03-07 11:47:15 +00:00
jenkins d7179e0350 For new jenkins build system 2012-03-07 10:40:19 +00:00
jenkins 211491990c Run tests 2012-03-03 07:18:06 +00:00
jenkins b9e6b02e38 Jenkins needs this for now... 2012-03-03 05:02:04 +00:00
jenkins b1e504374a Hard code stuff for Jenkins 2012-03-03 05:00:51 +00:00
Joshua Bussdieker 3a45cde1aa Make template Mac compatible 2012-03-02 19:15:25 -08:00
Joshua Bussdieker bdc0eb2fda More pkg install improvements 2012-03-02 19:02:51 -08:00
Joshua Bussdieker 2f562e6d3c Template for installed binaries 2012-03-02 19:02:37 -08:00
Joshua Bussdieker 99f4c5035c Fix pkg install 2012-03-02 17:52:08 -08:00
Joshua Bussdieker 503ec01aaa Added gvm update to download updateds to the Go source 2012-03-02 01:31:00 -08:00
Joshua Bussdieker d4fa2d8bdb Cleanup Go install script. 2012-03-02 01:30:51 -08:00
Joshua Bussdieker 9711c445d8 Skip tests for now... 2012-03-02 01:30:43 -08:00
Joshua Bussdieker 6d5e3ec8d5 These will be replaced with gpkg 2012-03-01 23:27:41 -08:00
Joshua Bussdieker 1b5197c450 Bump again 2012-03-01 23:27:16 -08:00
Joshua Bussdieker c1e449309b New 0.0.7 stable 2012-03-01 23:23:40 -08:00
Joshua Bussdieker d46e351d9e Not in stable 2012-03-01 23:21:18 -08:00
Joshua Bussdieker 8fe98115fe Revert to stable on these 2012-03-01 23:20:46 -08:00
Joshua Bussdieker cc1715379c Remove debug line 2012-03-01 23:13:34 -08:00
Joshua Bussdieker 967104cad7 Add command line parameters 2012-03-01 23:08:51 -08:00
Joshua Bussdieker fc5db824bf Fix pkgset use bug 2012-03-01 23:08:08 -08:00
Joshua Bussdieker 562c90dee3 Remove test file 2012-03-01 22:46:24 -08:00
Joshua Bussdieker 1ad33a27b7 Fix path bug 2012-03-01 22:43:48 -08:00
Joshua Bussdieker 6cb227b098 Doh! 2012-03-01 22:18:56 -08:00
Joshua Bussdieker 6c677cf349 More detail 2012-03-01 22:17:00 -08:00
Joshua Bussdieker a846b2b613 Make executable 2012-03-01 22:14:55 -08:00
Joshua Bussdieker 8ec660e76c Add version test 2012-03-01 22:13:38 -08:00
Joshua Bussdieker d7f0b47e17 Fix test mode 2012-03-01 22:05:42 -08:00
Joshua Bussdieker 081f7ea235 Adding test mode 2012-03-01 22:00:47 -08:00
Joshua Bussdieker dd4d21df14 Moved gpkg to seperate repo 2012-03-01 21:36:27 -08:00
Joshua Bussdieker b4d148ed9a Now generates Makefiles! 2012-03-01 17:00:50 -08:00
Joshua Bussdieker 3102c3bab5 Read import info too 2012-03-01 14:23:09 -08:00
Joshua Bussdieker e80e9af547 Testing installer via goinstall 2012-03-01 00:33:55 -08:00
jbussdieker 9bdba4e258 Update README.md 2012-03-01 00:07:22 -08:00
Joshua Bussdieker c33216e4d3 Package install madness!!! 2012-02-29 23:48:19 -08:00
Joshua Bussdieker 2b731381b6 These errors are okay 2012-02-29 23:47:57 -08:00
Joshua Bussdieker 5c31a8e593 List goinstalled packages too 2012-02-29 21:46:28 -08:00
Joshua Bussdieker 62c9513954 Merge branch 'master' of github.com:moovweb/gvm 2012-02-29 21:36:35 -08:00
Joshua Bussdieker 8480e63c86 Update gitignores. Add gpkg/pkgs module. 2012-02-29 21:35:47 -08:00
Joshua Bussdieker 4f0d8e3c5e Updated gpkg main 2012-02-29 21:33:28 -08:00
Joshua Bussdieker e1c6da6bc9 Use display message for gvm pkg list 2012-02-29 21:32:15 -08:00
Joshua Bussdieker e3192d58c5 Fix tabs 2012-02-29 20:40:54 -08:00
12 changed files with 193 additions and 117 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
pkgs/
*~
go
gos/
pkgs
pkgsets/
archive/
environments/
+4
View File
@@ -1,3 +1,7 @@
# gvm
GVM provides an interface to manage Go versions.
Installing
==========
-12
View File
@@ -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!")
}
}
+2 -2
View File
@@ -13,10 +13,10 @@ 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@" | head -n 1 | grep "$1"` ||
fuzzy_match=`ls $GVM_ROOT/environments | sort | grep "$gvm_go_name@" | grep "$1" | head -n 1` ||
display_error "Invalid package set" || return 1
. "$GVM_ROOT/environments/$gvm_go_name@$1" ||
. "$GVM_ROOT/environments/$fuzzy_match" ||
display_error "Failed to source the package set environment" || return 1
echo "Now using version $fuzzy_match"
+1
View File
@@ -20,6 +20,7 @@ function gvm_use() {
fuzzy_match=`ls $GVM_ROOT/gos | sort | grep "$1" | head -n 1 | grep "$1"` ||
display_error "Invalid version $1" || return 1
export PATH=$GVM_PATH_BACKUP
. $GVM_ROOT/environments/$fuzzy_match
if [[ "$2" == "--default" ]]; then
cp $GVM_ROOT/environments/$fuzzy_match $GVM_ROOT/environments/default
+1
View File
@@ -15,6 +15,7 @@ mkdir -p $GVM_ROOT/environments > /dev/null 2>&1
export GVM_VERSION=`cat $GVM_ROOT/VERSION`
export PATH=$GVM_ROOT/bin:$PATH
export GVM_PATH_BACKUP=$PATH
[ -f $GVM_ROOT/environments/default ] && . $GVM_ROOT/environments/default
. $GVM_ROOT/scripts/env/gvm
+57 -26
View File
@@ -1,9 +1,36 @@
#!/bin/bash
. $GVM_ROOT/scripts/functions
function show_usage() {
echo "Usage: gvm install [version] [options]"
echo " -s, --source=SOURCE Install Go from specified source."
echo " -h, --help Display this message."
}
read_command_line() {
VERSION=$1
shift
GO_SOURCE_URL=https://go.googlecode.com/hg/
for i in $*; do
case $i in
-s=*|--source=*)
GO_SOURCE_URL=$i
;;
-h|--help*)
show_usage
exit 0
;;
*)
echo "Invalid option $i"
show_usage
exit 65 # Bad arguments
;;
esac
done
}
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 ||
@@ -32,7 +59,8 @@ 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 && ./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")
}
@@ -45,10 +73,9 @@ create_enviroment() {
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_use $version &> /dev/null ||
display_error "Failed to use installed version"
gvm pkgset create global
. $GVM_ROOT/scripts/env/pkgset-use
gvm_pkgset_use global &> /dev/null
unset GOPATH
}
@@ -73,7 +100,7 @@ install_go() {
install_gpkg() {
echo " * Installing gpkg..."
goinstall github.com/moovweb/gvm/gpkg > /dev/null 2>&1
$GVM_GOINSTALL github.com/moovweb/gpkg > $GVM_ROOT/logs/$version-gpkg.log 2>&1
if [[ $? -ne 0 ]]; then
echo "Failed to install gpkg"
return 1
@@ -81,36 +108,34 @@ install_gpkg() {
}
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
echo " * Installing gb..."
$GVM_GOINSTALL github.com/skelterjohn/go-gb/gb > $GVM_ROOT/logs/$version-gb.log 2>&1
if [[ $? -ne 0 ]]; then
echo "Failed to install gb"
return 1
fi
}
install_goprotobuf() {
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
echo " * Installing goprotobuf..."
$GVM_GOINSTALL goprotobuf.googlecode.com/hg/proto > $GVM_ROOT/logs/$version-pb-compiler.log 2>&1
if [[ $? -ne 0 ]]; then
echo "Failed to install goprotobuf"
return 1
fi
#if [[ $version == "release.r60.3" ]]; then
cd $GVM_ROOT/gos/$version/src/pkg/goprotobuf.googlecode.com/hg/compiler
make install > $GVM_ROOT/logs/$version-pb-compiler.log 2>&1
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
#fi
}
main() {
VERSION=$1
trap 'display_error "Canceled!"' INT
read_command_line $@
# GREEN!
tput sgr0
tput setaf 2
@@ -118,9 +143,15 @@ main() {
download_source
check_tag || (update_source && check_tag) || display_error "Unrecognized Go version"
install_go
install_gpkg
install_gb
install_goprotobuf
GVM_GOINSTALL="goinstall"
which goinstall &> /dev/null ||
GVM_GOINSTALL="go get"
x="`hg tags -R ~/.gvm/archive/go`"; echo ${x#*b0819469a6df} | grep "$version " &> /dev/null
if [[ "$?" == "1" ]]; then
install_gpkg
install_gb
install_goprotobuf
fi
cd $GO_INSTALL_ROOT && find . > manifest
tput sgr0
}
+77 -53
View File
@@ -1,4 +1,14 @@
#!/bin/bash
gpkg build $1 || exit 1
VERSION=`cat VERSION`
if [ "$VERSION" == "" ]; then
VERSION=0.0
fi
BUILD=$VERSION.$BUILD_NUMBER
mkdir -p $GVM_ROOT/pkgs/pkg.gvm/$1/current
cp $GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/$1/$BUILD/manifest $GVM_ROOT/pkgs/pkg.gvm/$1/current/manifest
exit 0
. $GVM_ROOT/scripts/functions
show_usage() {
@@ -18,44 +28,25 @@ function read_command_line() {
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
version=$1
strict="true"
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
# TODO: Remove hack after change to gvm_build
mkdir -p $GVM_ROOT/pkgs/pkg.gvm/$package_name/current
}
function download_package() {
[ -d $cache_dir ] && return
#echo "Downloading $package_name..."
if [ -d $cache_dir ]; then
cd $cache_dir && git pull &> /dev/null
return
fi
echo "Downloading $package_name..."
for source in $sources; do
echo "Trying $source"
git clone $source/$package_name $cache_dir > /dev/null 2>&1
if [ "$?" == "0" ]; then
echo $source > $cache_dir/GVM_SOURCE
@@ -73,21 +64,23 @@ function update_package_cache() {
function copy_tmp_source() {
rm -rf $source_dir
if [ "$version" != "" ]; then
echo "Checking out $version"
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
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() {
@@ -115,9 +108,9 @@ function setup_build_env() {
function install_dep() {
[[ "$strict" == "true" ]] && display_error "Missing dependancy ($1) and strict mode is set"
[[ "$source" == "." ]] && passthrough_options="--source=. "$passthrough_options
passthrough_options=""
[[ "$source" != "" ]] && passthrough_options="--source=$source "$passthrough_options
[[ "$all_deps" == "true" ]] && passthrough_options="--all "$passthrough_options
gvm pkg install $1 $passthrough_options ||
display_error "Failed to install dependency $1"
}
@@ -148,40 +141,64 @@ function check_deps() {
}
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/
git clone $source_dir $gvm_go_path/pkg.gvm/$package_name/$BUILD_NUMBER/ &> /dev/null
#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
export BUILD_NUMBER
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_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
mkdir -p $gvm_go_path/pkg.gvm/$package_name/$BUILD_NUMBER ||
display_error "Failed to create $gvm_go_path/pkg.gvm/$package_name/$BUILD_NUMBER"
cp -r $build_dir/* $gvm_go_path/pkg.gvm/$package_name/$BUILD_NUMBER ||
display_error "Failed to copy from build folder to install destination"
rm -f $gvm_go_path/pkg.gvm/$package_name/current ||
display_error "Failed to remove symlink to 'current' before recreating it"
ln -s $gvm_go_path/pkg.gvm/$package_name/$BUILD_NUMBER $gvm_go_path/pkg.gvm/$package_name/current ||
display_error "Failed to create new symlink to 'current'"
if [ -d $build_dir/bin ]; then
echo " * Installing binaries"
mkdir -p $gvm_go_path/bin &&
cp -f $build_dir/bin/* $gvm_go_path/bin/
mkdir -p $gvm_go_path/bin ||
display_error "Failed to create $gvm_go_path/bin"
for binary in $build_dir/bin/*; do
binary_name=`echo "$binary" | awk '{ n=split($1,path,"/"); print path[n] }'`
rm -f $gvm_go_path/bin/$binary_name ||
display_error "Failed to remove old binary"
IFS=$'\n'
lines=`cat $GVM_ROOT/scripts/templates/binary`
for line in $lines; do
echo "$line" | sed 's/{{package_name}}/'$package_name'/g' | sed 's/{{binary_name}}/'$binary_name'/g' >> $gvm_go_path/bin/$binary_name
done
chmod +x $gvm_go_path/bin/$binary_name ||
display_error "Failed to mark binary executable"
done
fi
}
function cleanup() {
rm -rf $tmp_dir
rm -rf $tmp_dir ||
display_error "Failed to remove $tmp_dir in cleanup()"
}
read_command_line $@
@@ -191,5 +208,12 @@ check_deps
copy_source
build_package
install_package
if [ "$GPKG_PUSH_TAG" == "true" ]; then
echo "Pushing tag $BUILD_NUMBER"
cd $WORKSPACE && git tag $BUILD_NUMBER && git push origin $BUILD_NUMBER ||
display_error "Failed to push version tag"
fi
# TODO: Remove after change to gvm_build
cp $build_dir/manifest $GVM_ROOT/pkgs/pkg.gvm/$package_name/current
cleanup
+23 -23
View File
@@ -1,37 +1,37 @@
#!/bin/bash
. $GVM_ROOT/scripts/functions
echo "
gvm packages $gvm_go_name@$gvm_pkgset_name"
echo
display_message "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")"
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
echo $output
done
if [ -f $package_folder/goinstall.log ]; then
echo
echo "Installing via goinstall"
display_message "Installing via goinstall"
echo
cat $package_folder/goinstall.log
fi
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
echo $1 | sed -n -e '/_.*_/ p' | grep "_" &> /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
echo "GVM: Invalid version"
exit 1
fi
shift
$GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/{{package_name}}/$version/bin/{{binary_name}} $@
else
$GVM_ROOT/pkgsets/$gvm_go_name/$gvm_pkgset_name/pkg.gvm/{{package_name}}/current/bin/{{binary_name}} $@
fi
Executable
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
. $GVM_ROOT/scripts/functions
cd $GVM_ROOT/archive/go ||
display_error "Failed to find local Go source"
cd $GVM_ROOT/archive/go && hg pull ||
display_error "Failed to update"
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash -ex
TEST_OUTPUT=`gvm version`
[ "$TEST_OUTPUT" != "" ]
echo "Success!"