Skip to content

Commit

Permalink
build : versioning and tainted build version
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas PLANEL <[email protected]>
  • Loading branch information
nplanel committed Nov 9, 2017
1 parent 4118b23 commit 191bc3c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
VERSION?=0.13.0
VERSION_CMD='define="";version=`git rev-parse --verify HEAD`;tagname=`git show-ref --tags | grep $$version`;if [ -n "$$tagname" ]; then define=`echo $$tagname | awk -F "/" "{print \\$$NF}"`;else define=`printf "%.12s" $$version`;fi;tainted=`git ls-files -m | wc -l`;if [ "$$tainted" -gt 0 ]; then define="$${define}-tainted";fi;echo "$$define"'
VERSION?=$(shell sh -c $(VERSION_CMD))
$(info ${VERSION})

# really Basic Makefile for Skydive
export GO15VENDOREXPERIMENT=1
Expand Down Expand Up @@ -49,12 +51,12 @@ all: install
gofmt -w -s statics/bindata.go

.compile:
${GOPATH}/bin/govendor install ${GOFLAGS} ${GOTAGS} ${VERBOSE_FLAGS} +local
${GOPATH}/bin/govendor install -ldflags="-X github.com/skydive-project/skydive/version.Version=${VERSION}" ${GOFLAGS} ${GOTAGS} ${VERBOSE_FLAGS} +local

install: govendor genlocalfiles dpdk.build contribs .compile

build: govendor genlocalfiles dpdk.build contribs
${GOPATH}/bin/govendor build ${GOFLAGS} ${GOTAGS} ${VERBOSE_FLAGS} +local
${GOPATH}/bin/govendor build -ldflags="-X github.com/skydive-project/skydive/version.Version=${VERSION}" ${GOFLAGS} ${GOTAGS} ${VERBOSE_FLAGS} +local

static: govendor genlocalfiles
rm -f $$GOPATH/bin/skydive
Expand Down
4 changes: 3 additions & 1 deletion skydive.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@

package main

import "github.com/skydive-project/skydive/cmd"
import (
"github.com/skydive-project/skydive/cmd"
)

func main() {
cmd.RootCmd.Execute()
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
var Package = "github.com/skydive-project/skydive"

// Version indicates which version of the binary is running.
var Version = "v0.13.0"
var Version = "unknown"

// FprintVersion outputs the version string to the writer, in the following
// format, followed by a newline:
Expand Down

0 comments on commit 191bc3c

Please sign in to comment.