Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version info to binaries #435

Merged
merged 4 commits into from Nov 13, 2014

Conversation

Projects
None yet
2 participants
@titanous
Copy link
Member

commented Nov 12, 2014

This adds the git tag or commit/branch to all Go binaries. The version package can be used to generate a string from this information.

The default make target should be used instead of running tup directly.

The make dev target uses static version information to reduce build time when iterating quickly (tup will rebuild all targets otherwise).

A make clean target also exists.

Closes #308.

Makefile Outdated
GIT_COMMIT=`git rev-parse --short HEAD`
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
GIT_TAG=`git describe --tags --exact-match --match "v*" 2>/dev/null || echo "none"`
GIT_DIRTY=`test "$(git status --porcelain)" = "\n" && echo true || echo false`

This comment has been minimized.

Copy link
@lmars

lmars Nov 12, 2014

Member

Should this not just test that git status --porcelain is nonzero? i.e.:

test -n "$(git status --porcelain)" && echo true || echo false

This comment has been minimized.

Copy link
@titanous

titanous Nov 12, 2014

Author Member

I'm pretty sure it returns zero even if the tree is unclean.

This comment has been minimized.

Copy link
@lmars

lmars Nov 13, 2014

Member

With whats here:

$ dirty() { test "$(git status --porcelain)" = "\n" && echo true || echo false; }
$ git init -q
$ dirty
false
$ echo foo > foo.txt
$ dirty
false
$ git add foo.txt
$ dirty
false
$ git commit -qm "add foo.txt"
$ dirty
false
$ echo bar >> foo.txt
$ dirty
false

versus:

$ dirty() { test -n "$(git status --porcelain)" && echo true || echo false; }
$ git init -q
$ dirty
false
$ echo foo > foo.txt
$ dirty
true
$ git add foo.txt
$ dirty
true
$ git commit -qm "add foo.txt"
$ dirty
false
$ echo bar >> foo.txt
$ dirty
true

This comment has been minimized.

Copy link
@titanous

titanous Nov 13, 2014

Author Member

Okay, great. Will change.

This comment has been minimized.

Copy link
@titanous

titanous Nov 13, 2014

Author Member

Fixed.

@lmars

This comment has been minimized.

Copy link
Member

commented Nov 13, 2014

Probably worth changing / removing the clean alias.

titanous added some commits Nov 12, 2014

Makefile: Add basic targets
Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
all: Expose version information to Go binaries
The default make target should be used instead of running tup
directly.

The 'make dev' target uses static version information to reduce
build time when iterating quickly (tup will rebuild all binaries
otherwise).

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
host/cli: Add version command
Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>

@titanous titanous force-pushed the version-info branch from 6b89c49 to 8e3f573 Nov 13, 2014

@lmars

This comment has been minimized.

Copy link
Member

commented Nov 13, 2014

This closes #308

script: Remove clean alias replaced by make target
Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
@titanous

This comment has been minimized.

Copy link
Member Author

commented Nov 13, 2014

Comments addressed.

@lmars

This comment has been minimized.

Copy link
Member

commented Nov 13, 2014

LGTM

titanous added a commit that referenced this pull request Nov 13, 2014

Merge pull request #435 from flynn/version-info
Add version info to binaries

@titanous titanous merged commit ff9c63a into master Nov 13, 2014

0 of 2 checks passed

flynn The Flynn CI build failed
Details
continuous-integration/travis-ci The Travis CI build is in progress
Details

@titanous titanous deleted the version-info branch Nov 13, 2014

@titanous

This comment has been minimized.

Copy link
Member Author

commented Nov 13, 2014

Thanks for the review! Please update CI.

@lmars

This comment has been minimized.

Copy link
Member

commented Nov 13, 2014

CI updated

@titanous

This comment has been minimized.

Copy link
Member Author

commented Nov 13, 2014

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.