Skip to content
This repository has been archived by the owner on Oct 29, 2023. It is now read-only.

Commit

Permalink
Fixes issue #6 : address dependencies in build.sh
Browse files Browse the repository at this point in the history
Also fixes OS detection bug in functional-test.sh
  • Loading branch information
datacharmer committed Apr 11, 2018
1 parent b239bc0 commit a24c701
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 3 deletions.
51 changes: 51 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,56 @@
target=$1
version=$2

build_dir=$(dirname $0)
cd $build_dir

if [ -z "$GOPATH" ]
then
GOPATH=$HOME/go
fi
if [ ! -d "$GOPATH" ]
then
echo "\$GOPATH directory ($GOPATH) not found"
exit 1
fi

in_go_path=$(echo $PWD | grep "^$GOPATH")
if [ -z "$in_go_path" ]
then
echo "This directory ($PWD) is not in \$GOPATH ($GOPATH)"
exit 1
fi
dependencies=(github.com/spf13/cobra github.com/spf13/pflag)
local_items=(cmd defaults main.go common unpack abbreviations concurrent pflag sandbox)

all_ok=yes
for dep in ${dependencies[*]}
do
if [ ! -d $GOPATH/src/$dep ]
then
echo "Needed package $dep not installed"
unset all_ok
fi
done

for item in ${local_items[*]}
do
if [ ! -e ./$item ]
then
echo "item $item not found"
unset all_ok
fi
done

if [ -z "$all_ok" ]
then
echo "Missing dependencies or essential code"
echo "Use this command to gather the needed dependencies:"
echo " go get github.com/datacharmer/dbdeployer"
echo "Also be sure to read pflag/README.md"
exit 1
fi

docs_flags=""
docs_tag=""
if [ -n "$DBDEPLOYER_DOCS" -o -n "$MKDOCS" ]
Expand All @@ -13,6 +63,7 @@ if [ -z "$version" ]
then
echo "Syntax: target version"
echo " target: (linux | OSX) "
echo "Set the variable MKDOCS to build the docs-enabled dbdeployer (see README.md)"
exit 1
fi

Expand Down
6 changes: 3 additions & 3 deletions test/functional-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ all_versions=()
group_versions=()
semisync_versions=()

OS=$(uname)
OS=$(uname | tr '[A-Z]' '[a-z]')
if [ -x "sort_versions.$OS" ]
then
cp "sort_versions.$OS" sort_versions
Expand All @@ -501,8 +501,8 @@ if [ ! -x ./sort_versions ]
then
if [ -f ./sort_versions.go ]
then
ENV GOOS=linux GOARCH=386 go build -o sort_versions.linux sort_versions.go
ENV GOOS=darwin GOARCH=386 go build -o sort_versions.Darwin sort_versions.go
env GOOS=linux GOARCH=386 go build -o sort_versions.linux sort_versions.go
env GOOS=darwin GOARCH=386 go build -o sort_versions.Darwin sort_versions.go
ls -l sort_versions*
cp "sort_versions.$OS" sort_versions
fi
Expand Down

0 comments on commit a24c701

Please sign in to comment.