From 8fe98115fed9f4abe9b6a3c4a88d2614eff0bb48 Mon Sep 17 00:00:00 2001 From: Joshua Bussdieker Date: Thu, 1 Mar 2012 23:20:46 -0800 Subject: [PATCH] Revert to stable on these --- scripts/pkg-install | 78 ++++++++++++++++----------------------------- scripts/pkg-list | 46 +++++++++++++------------- 2 files changed, 50 insertions(+), 74 deletions(-) diff --git a/scripts/pkg-install b/scripts/pkg-install index 59f8a4a..7fc2235 100755 --- a/scripts/pkg-install +++ b/scripts/pkg-install @@ -16,7 +16,7 @@ function read_command_line() { # Get package name package_name=$1 - sources=`cat $GVM_ROOT/config/sources` + source="git@github.com:moovweb/$1" shift for i in $*; do @@ -25,7 +25,7 @@ function read_command_line() { version=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` ;; -s=*|--source=*) - sources=`echo $i | sed 's/[-a-zA-Z0-9]*=//' && echo $sources` + source=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` ;; -a|--all) all_deps="true" @@ -46,70 +46,45 @@ function read_command_line() { 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 + source_dir=$GVM_ROOT/tmp/$package_name/src + build_dir=$GVM_ROOT/tmp/$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 + rm -rf $source_dir && mkdir -p $source_dir + if [[ "$source" != "." ]]; then + echo "Downloading $package_name..." + git clone $source $source_dir > /dev/null 2>&1 + if [[ $? -ne 0 ]]; then + rm -rf $source_dir + display_error "Could not find $package_name in any sources" fi - done - display_error "Could not find $package_name in any sources" + fi } -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 +function select_version() { 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 + echo "Checking out $version" + cd $source_dir > /dev/null 2>&1 || + display_error "Source directory doesn't exist" + git checkout $version > /dev/null 2>&1 || + display_error "Invalid version $version" + 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 + select_version if [[ -f $source_dir/VERSION ]]; then SOURCE_VERSION=`cat $source_dir/VERSION` + else + SOURCE_VERSION="0.0" 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 + BUILD_NUMBER="$SOURCE_VERSION.dev" fi } @@ -138,7 +113,7 @@ function load_dep() { function check_deps() { export GOPATH=$build_dir - echo ":source `cat $cache_dir/GVM_SOURCE`" >> $build_dir/manifest + echo ":source $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 @@ -153,7 +128,7 @@ function copy_source() { } function build_package() { - echo "Installing $package_name-$BUILD_NUMBER..." + echo "Installing $package_name..." echo "$BUILD_NUMBER" > $build_dir/BUILD_VERSION cd $source_dir && gvmake > $build_dir/build.log 2>&1 if [ $? -ne 0 ]; then @@ -181,7 +156,8 @@ function install_package() { } function cleanup() { - rm -rf $tmp_dir + rm -rf $build_dir + rm -rf $source_dir } read_command_line $@ diff --git a/scripts/pkg-list b/scripts/pkg-list index ec3e8c5..924318a 100755 --- a/scripts/pkg-list +++ b/scripts/pkg-list @@ -1,37 +1,37 @@ #!/bin/bash . $GVM_ROOT/scripts/functions -echo -display_message "gvm packages $gvm_go_name@$gvm_pkgset_name" +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")" + 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 - display_message "Installing via goinstall" + echo "Installing via goinstall" echo cat $package_folder/goinstall.log fi