mirror of
https://github.com/wahyd4/gvm.git
synced 2026-08-09 04:46:19 +10:00
Get the clean path to common posix tools used by GVM
This commit is contained in:
+3
-3
@@ -1,7 +1,7 @@
|
||||
. $GVM_ROOT/scripts/functions/tools
|
||||
|
||||
_gvm()
|
||||
{
|
||||
LS_PATH=`which ls` || return 1
|
||||
|
||||
local cur prev opts base
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
@@ -58,7 +58,7 @@ _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
|
||||
;;
|
||||
|
||||
+1
-2
@@ -1,11 +1,10 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
LS_PATH=`which ls` || display_error "$LS_ERROR" || return 1
|
||||
|
||||
version=$1
|
||||
|
||||
if [ "$version" != "" ]; then
|
||||
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | sort | grep "$version" | head -n 1 | grep "$version"` ||
|
||||
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$version" | $HEAD_PATH -n 1 | $GREP_PATH "$version"` ||
|
||||
display_error "Invalid version $version"
|
||||
|
||||
foldername=$GVM_ROOT/gos/$fuzzy_match
|
||||
|
||||
Vendored
+1
-3
@@ -18,15 +18,13 @@ function display_message() {
|
||||
}
|
||||
|
||||
function gvm_pkgset_use() {
|
||||
LS_PATH=`which ls` || display_error "$LS_ERROR" || return 1
|
||||
|
||||
[[ "$1" != "" ]] ||
|
||||
display_error "Please specify a package set" || return 1
|
||||
|
||||
[[ "$gvm_go_name" != "" ]] ||
|
||||
display_error "No Go version selected" || return 1
|
||||
|
||||
fuzzy_match=`$LS_PATH $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
+2
-4
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/function/errors
|
||||
. $GVM_ROOT/scripts/function/tools
|
||||
|
||||
function display_error() {
|
||||
tput sgr0
|
||||
@@ -18,11 +18,9 @@ function display_message() {
|
||||
}
|
||||
|
||||
function gvm_use() {
|
||||
LS_PATH=`which ls` || display_error "$LS_ERROR" || return 1
|
||||
|
||||
[[ "$1" != "" ]] ||
|
||||
display_error "Please specifiy the version" || return 1
|
||||
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | sort | grep "$1" | head -n 1 | grep "$1"` ||
|
||||
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1"` ||
|
||||
display_error "Invalid version $1" || return 1
|
||||
|
||||
export PATH=$GVM_PATH_BACKUP
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
LS_ERROR="Couldn't find ls"
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
LS_ERROR="Couldn't find ls"
|
||||
GREP_ERROR="Couldn't find grep"
|
||||
SORT_ERROR="Couldn't find sort"
|
||||
HEAD_ERROR="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
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@ download_source() {
|
||||
}
|
||||
|
||||
check_tag() {
|
||||
version=`hg tags -R $GO_CACHE_PATH | awk '{print $1}' | sort | grep "$VERSION" | head -n 1 | grep "$VERSION"`
|
||||
version=`hg tags -R $GO_CACHE_PATH | awk '{print $1}' | $SORT_PATH | $GREP_PATH "$VERSION" | $HEAD_PATH -n 1 | $GREP_PATH "$VERSION"`
|
||||
}
|
||||
|
||||
update_source() {
|
||||
@@ -150,7 +150,7 @@ main() {
|
||||
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"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
LS_PATH=`which ls` || display_error "$LS_ERROR" || return 1
|
||||
|
||||
echo
|
||||
display_message "gvm gos (installed)"
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ 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 }' | $GREP_PATH "$tag_filter" | $SORT_PATH`
|
||||
if [[ $? -ne 0 ]]; then
|
||||
display_error "Failed to get version list from Google"
|
||||
fi
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
echo $1 | sed -n -e '/_.*_/ p' | grep "_" &> /dev/null
|
||||
. $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
|
||||
|
||||
+1
-2
@@ -1,11 +1,10 @@
|
||||
#!/bin/bash
|
||||
. $GVM_ROOT/scripts/functions
|
||||
LS_PATH=`which ls` || display_error "$LS_ERROR" || return 1
|
||||
|
||||
[[ "$1" == "" ]] &&
|
||||
display_error "Please specifiy the version"
|
||||
|
||||
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | sort | grep "$1" | head -n 1 | grep "$1"` ||
|
||||
fuzzy_match=`$LS_PATH $GVM_ROOT/gos | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1"` ||
|
||||
display_error "Invalid version $1"
|
||||
|
||||
if [ -d $GVM_ROOT/gos/$fuzzy_match ]; then
|
||||
|
||||
Reference in New Issue
Block a user