Skip to content

Commit

Permalink
Merge pull request JuliaLang#4665 from ivarne/no_branch_tag
Browse files Browse the repository at this point in the history
Removed branch info from splash screen on tagged commits
  • Loading branch information
StefanKarpinski committed Nov 6, 2013
2 parents 5ed41e4 + 1955073 commit b48cccc
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 26 deletions.
8 changes: 8 additions & 0 deletions DISTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ GPL licensed, as various dependent libraries such as `FFTW`, `Rmath`,
`SuiteSparse`, and `git` are GPL licensed. We do hope to have a
non-GPL distribution of Julia in the future.

When compiling a tagged release in the git repository, we don't display the
branch/commit hash info in the splash screen. This line can therefore, in less
than 45 characters, be used to describe the release. To set this line you have
to create a Make.user file containing:

override TAGGED_RELEASE_BANNER = "my-package-repository build"


Linux
-----

Expand Down
52 changes: 34 additions & 18 deletions base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,36 @@ include ../Make.inc

PCRE_CONST = 0x[0-9a-fA-F]+|[-+]?\s*[0-9]+

# These are all the values needed for the RawVersionInfo struct
# These are all the values needed for the BUILD_INFO struct in build_h.jl
version_string = $(shell cat ../VERSION)
commit = $(shell git rev-parse HEAD 2>/dev/null)
commit_short = $(shell git rev-parse --short HEAD 2>/dev/null)
build_number = $(shell echo $$(git describe --tags --long 2>/dev/null) | awk -F- '{ if( NF > 1 ) print $$(NF-1); else print 0; }')
git_tag = $(shell git describe --tags --abbrev=0 2>/dev/null)
prerelease = $(shell [ -z "$(git_tag)" -o "$(git_tag)" = "v$(version_string)" ] && echo false || echo true)

git_branch = $(shell git branch 2>/dev/null | sed -n '/\* /s///p')

last_tag = $(shell git describe --tags --abbrev=0 2>/dev/null)
tagged_commit = $(shell [ $$(git describe --tags --exact-match 2>/dev/null) ] && echo true || echo false)
prerelease = $(shell [ -z "$(last_tag)" -o "$(last_tag)" = "v$(version_string)" ] && echo false || echo true)

origin = $(shell [ -d ../.git/refs/remotes/origin ] && echo "origin/")

build_number = $(shell git rev-list --count HEAD ^"$(last_tag)" 2>/dev/null || echo 0)
fork_master_distance = $(shell git rev-list --count HEAD ^"$(origin)master" 2>/dev/null || echo 0)
fork_master_timestamp = $(shell git show -s $$(git merge-base HEAD $(origin)master 2>/dev/null) --format=format:"%ct" 2>/dev/null || echo 0)

git_time = $(shell git log -1 --pretty=format:%ct 2>/dev/null)
ifneq ($(git_time), )
ifneq (,$(filter $(OS), Darwin FreeBSD))
date_string = "$(shell /bin/date -jr $(git_time) -u '+%Y-%m-%d %H:%M:%S %Z')"
date_string = "$(shell /bin/date -jr $(git_time) -u '+%Y-%m-%d %H:%M %Z')"
else
date_string = "$(shell /bin/date --date=@$(git_time) -u '+%Y-%m-%d %H:%M:%S %Z')"
date_string = "$(shell /bin/date --date=@$(git_time) -u '+%Y-%m-%d %H:%M %Z')"
endif
else
date_string = ""
endif
dirty = $(shell [ -z "$(shell git status --porcelain 2>/dev/null)" ] && echo "false" || echo "true" )

dirty = $(shell [ -z "$(shell git status --porcelain 2>/dev/null)" ] && echo "" || echo "*" )

TAGGED_RELEASE_BANNER = ""


all: pcre_h.jl errno_h.jl build_h.jl.phony fenv_constants.jl file_constants.jl uv_constants.jl
Expand All @@ -44,7 +53,8 @@ uv_constants.jl: ../src/uv_constants.h ../usr/include/uv-errno.h
@$(call PRINT_PERL, $(CPP) -P "-I$(LIBUV_INC)" -DJULIA ../src/uv_constants.h | tail -n 16 > $@)

build_h.jl.phony:
@$(CC) -E -P build.h -I../src/support | grep . > $@
@echo "# This file is automatically generated in base/Makefile" > $@
@$(CC) -E -P build.h -I../src/support | grep . >> $@
@echo "const ARCH = :$(ARCH)" >> $@
ifeq ($(OS),$(BUILD_OS))
@echo "const MACHINE = \"$(BUILD_MACHINE)\"" >> $@
Expand All @@ -62,26 +72,32 @@ endif
@echo "const SYSCONFDIR = \"$(SYSCONFDIR)\"" >> $@

@echo "immutable BuildInfo" >> $@
@echo " version_string::ASCIIString" >> $@
@echo " commit::ASCIIString" >> $@
@echo " commit_short::ASCIIString" >> $@
@echo " branch::ASCIIString" >> $@
@echo " version_string::String" >> $@
@echo " commit::String" >> $@
@echo " commit_short::String" >> $@
@echo " branch::String" >> $@
@echo " build_number::Int" >> $@
@echo " date_string::ASCIIString" >> $@
@echo " dirty::Bool" >> $@
@echo " date_string::String" >> $@
@echo " prerelease::Bool" >> $@
@echo " tagged_commit::Bool" >> $@
@echo " fork_master_distance::Int" >> $@
@echo " fork_master_timestamp::Int64" >> $@
@echo " TAGGED_RELEASE_BANNER::String" >> $@
@echo "end" >> $@


@echo "const BUILD_INFO = BuildInfo( \
'\"$(version_string)\"', \
'\"$(commit)\"', \
'\"$(commit_short)\"', \
'\"$(commit_short)$(dirty)\"', \
'\"$(git_branch)\"', \
$(build_number), \
'\"$(date_string)\"', \
$(dirty), \
$(prerelease) \
$(prerelease), \
$(tagged_commit), \
$(fork_master_distance), \
$(fork_master_timestamp), \
'\"$(TAGGED_RELEASE_BANNER)\"' \
)" | xargs >> $@

@# This to ensure that we always rebuild this file, but only when it is modified do we touch build_h.jl,
Expand Down
27 changes: 19 additions & 8 deletions base/version.jl
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,30 @@ catch e
println("while creating Base.VERSION, ignoring error $e")
global const VERSION = VersionNumber(0)
end
branch_prefix = (BUILD_INFO.branch == "master") ? "" : "$(BUILD_INFO.branch)/"
dirty_suffix = BUILD_INFO.dirty ? "*" : ""
global const commit_string = (BUILD_INFO.commit == "") ? "" : "Commit $(branch_prefix)$(BUILD_INFO.commit_short)$(dirty_suffix) $(BUILD_INFO.date_string)"

if BUILD_INFO.tagged_commit
global const commit_string = BUILD_INFO.TAGGED_RELEASE_BANNER
elseif BUILD_INFO.commit == ""
global const commit_string = "Unknown commit"
else
local days = int(floor((ccall(:clock_now, Float64, ()) - BUILD_INFO.fork_master_timestamp) / (60 * 60 * 24)))
if BUILD_INFO.fork_master_distance == 0
global const commit_string = "Commit $(BUILD_INFO.commit_short) ($(days) days old master)"
else
global const commit_string = "$(BUILD_INFO.branch)/$(BUILD_INFO.commit_short) (fork: $(BUILD_INFO.fork_master_distance) commits, $(days) days)"
end
end
commit_date = BUILD_INFO.date_string != "" ? " ($(BUILD_INFO.date_string))": ""

const banner_plain =
"""
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" to list help topics
_ _ _| |_ __ _ | Type \"help()\" to list help topics
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version $VERSION
_/ |\\__'_|_|_|\\__'_| | "$commit_string"
| | |_| | | | (_| | | Version $(VERSION)$(commit_date)
_/ |\\__'_|_|_|\\__'_| | $(commit_string)
|__/ | $(Sys.MACHINE)
"""
Expand All @@ -218,8 +229,8 @@ const banner_color =
$(d1)(_)$(jl) | $(d2)(_)$(tx) $(d4)(_)$(tx) | Documentation: http://docs.julialang.org
$(jl)_ _ _| |_ __ _$(tx) | Type \"help()\" to list help topics
$(jl)| | | | | | |/ _` |$(tx) |
$(jl)| | |_| | | | (_| |$(tx) | Version $VERSION
$(jl)_/ |\\__'_|_|_|\\__'_|$(tx) | $commit_string
$(jl)| | |_| | | | (_| |$(tx) | Version $(VERSION)$(commit_date)
$(jl)_/ |\\__'_|_|_|\\__'_|$(tx) | $(commit_string)
$(jl)|__/$(tx) | $(Sys.MACHINE)
\033[0m"
Expand Down

0 comments on commit b48cccc

Please sign in to comment.