zrepl/lazy.sh
Christian Schwarz 2716c75ad5 build: target for go library dependencies
Didn't notice it because vendor/ was already populated on my dev
machine, but did notice it in Docker build.

Docker build now consumes devsetup like regular user, so this should
catch future problems.

Remove remaining curl|shit functionality from lazy.sh (no checkout logic
needed anymore).

refs #35
2017-11-19 12:34:01 +01:00

81 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
set -e
if tty -s; then
bold=$(tput bold)
normal=$(tput sgr0)
else
bold=""
normal=""
fi
step() {
echo "${bold}$1${normal}"
}
if ! type go >/dev/null; then
step "go binary not installed or not in \$PATH" 1>&2
exit 1
fi
if [ -z "$GOPATH" ]; then
step "Make sure you have your GOPATH configured correctly" 1>&2
exit 1
fi
CHECKOUTPATH="${GOPATH}/src/github.com/zrepl/zrepl"
builddep() {
step "Install build depdencies using 'go get' to \$GOPATH/bin"
go get -u golang.org/x/tools/cmd/stringer
go get -u github.com/golang/dep/cmd/dep
if ! type stringer || ! type dep; then
echo "Installed dependencies but can't find them in \$PATH, adjust it to contain \$GOPATH/bin" 1>&2
exit 1
fi
}
godep() {
step "Fetching dependencies using 'dep ensure'"
dep ensure
}
docdep() {
if ! type pip3; then
step "pip3 binary not installed or not in \$PATH" 1>&2
exit 1
fi
step "Installing doc build dependencies"
local reqpath="${CHECKOUTPATH}/docs/requirements.txt"
if [ ! -z "$ZREPL_LAZY_DOCS_REQPATH" ]; then
reqpath="$ZREPL_LAZY_DOCS_REQPATH"
fi
pip3 install -r "$reqpath"
}
release() {
step "Making release"
make release
}
for cmd in "$@"; do
case "$cmd" in
builddep|godep|docdep|release_bins|docs)
eval $cmd
continue
;;
devsetup)
step "Installing development dependencies"
builddep
docdep
step "Development dependencies installed"
continue
;;
*)
step "Invalid command ${cmd}, exiting"
exit 1
;;
esac
done