Version= doesnt work on go1.4.2
fixing makefile & vagrantfile & build script to reflect that
This commit is contained in:
parent
a29b39e17a
commit
9d00b5e165
2
Makefile
2
Makefile
|
@ -3,7 +3,7 @@ VERSION := $(shell sh -c 'git describe --always --tags')
|
||||||
|
|
||||||
build: prepare
|
build: prepare
|
||||||
$(GOPATH)/bin/godep go build -o telegraf -ldflags \
|
$(GOPATH)/bin/godep go build -o telegraf -ldflags \
|
||||||
"-X main.Version=$(VERSION)" \
|
"-X main.Version $(VERSION)" \
|
||||||
./cmd/telegraf/telegraf.go
|
./cmd/telegraf/telegraf.go
|
||||||
|
|
||||||
prepare:
|
prepare:
|
||||||
|
|
|
@ -22,7 +22,10 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||||
gvm install go1.4.2 --prefer-binary
|
gvm install go1.4.2 --prefer-binary
|
||||||
gvm use go1.4.2 --default
|
gvm use go1.4.2 --default
|
||||||
echo "export PATH=$PATH:$GOPATH/bin" >> "$HOME/.bashrc"
|
echo "export PATH=$PATH:$GOPATH/bin" >> "$HOME/.bashrc"
|
||||||
cd "$HOME/go/src/github.com/influxdb/telegraf" && make
|
echo 'export GOPATH=/home/vagrant/go' >> "$HOME/.bashrc"
|
||||||
|
cd "$HOME/go/src/github.com/influxdb/telegraf" &&\
|
||||||
|
rm -rf Godeps/_workspace/pkg &&\
|
||||||
|
GOPATH="$HOME/go" make
|
||||||
SHELL
|
SHELL
|
||||||
|
|
||||||
config.vm.provider "virtualbox" do |vb|
|
config.vm.provider "virtualbox" do |vb|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
# build process for InfluxDB.
|
# build process for InfluxDB.
|
||||||
|
|
||||||
BUILD_DIR=$HOME/telegraf-build
|
BUILD_DIR=$HOME/telegraf-build
|
||||||
|
VERSION=`git describe --always --tags`
|
||||||
# GO_VERSION=go1.4.2
|
# GO_VERSION=go1.4.2
|
||||||
# source $HOME/.gvm/scripts/gvm
|
# source $HOME/.gvm/scripts/gvm
|
||||||
# exit_if_fail gvm use $GO_VERSION
|
# exit_if_fail gvm use $GO_VERSION
|
||||||
|
@ -13,7 +14,7 @@ BUILD_DIR=$HOME/telegraf-build
|
||||||
function exit_if_fail {
|
function exit_if_fail {
|
||||||
command=$@
|
command=$@
|
||||||
echo "Executing '$command'"
|
echo "Executing '$command'"
|
||||||
$command
|
eval $command
|
||||||
rc=$?
|
rc=$?
|
||||||
if [ $rc -ne 0 ]; then
|
if [ $rc -ne 0 ]; then
|
||||||
echo "'$command' returned $rc."
|
echo "'$command' returned $rc."
|
||||||
|
@ -25,7 +26,7 @@ function exit_if_fail {
|
||||||
function build {
|
function build {
|
||||||
echo -n "=> $1-$2: "
|
echo -n "=> $1-$2: "
|
||||||
GOOS=$1 GOARCH=$2 godep go build -o telegraf-$1-$2 \
|
GOOS=$1 GOARCH=$2 godep go build -o telegraf-$1-$2 \
|
||||||
-ldflags "-X main.Version=$3" \
|
-ldflags "-X main.Version $3" \
|
||||||
./cmd/telegraf/telegraf.go
|
./cmd/telegraf/telegraf.go
|
||||||
du -h telegraf-$1-$2
|
du -h telegraf-$1-$2
|
||||||
}
|
}
|
||||||
|
@ -61,11 +62,14 @@ exit_if_fail godep go vet ./...
|
||||||
exit_if_fail godep go test -v -short ./...
|
exit_if_fail godep go test -v -short ./...
|
||||||
|
|
||||||
# Build binaries
|
# Build binaries
|
||||||
build "linux" "amd64" `git describe --always --tags`
|
build "linux" "amd64" $VERSION
|
||||||
build "linux" "386" `git describe --always --tags`
|
build "linux" "386" $VERSION
|
||||||
build "linux" "arm" `git describe --always --tags`
|
build "linux" "arm" $VERSION
|
||||||
|
|
||||||
# simple integration test
|
# Simple Integration Tests
|
||||||
|
# check that version was properly set
|
||||||
|
exit_if_fail "./telegraf-linux-amd64 -version | grep $VERSION"
|
||||||
|
# check that one test cpu & mem output work
|
||||||
tmpdir=$(mktemp -d)
|
tmpdir=$(mktemp -d)
|
||||||
./telegraf-linux-amd64 -sample-config > $tmpdir/config.toml
|
./telegraf-linux-amd64 -sample-config > $tmpdir/config.toml
|
||||||
exit_if_fail ./telegraf-linux-amd64 -config $tmpdir/config.toml \
|
exit_if_fail ./telegraf-linux-amd64 -config $tmpdir/config.toml \
|
||||||
|
|
|
@ -141,7 +141,7 @@ do_build() {
|
||||||
rm -f $GOPATH_INSTALL/bin/$b
|
rm -f $GOPATH_INSTALL/bin/$b
|
||||||
done
|
done
|
||||||
|
|
||||||
godep go install -a -ldflags="-X main.Version=$version" ./...
|
godep go install -a -ldflags="-X main.Version $version" ./...
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Build failed, unable to create package -- aborting"
|
echo "Build failed, unable to create package -- aborting"
|
||||||
cleanup_exit 1
|
cleanup_exit 1
|
||||||
|
|
Loading…
Reference in New Issue