From b4187d6be49b93784c11ed177a5169d66c49cfff Mon Sep 17 00:00:00 2001 From: ivarne Date: Mon, 4 Nov 2013 15:13:43 +0100 Subject: [PATCH 1/3] Updated splash screen to show more relevant information Theese changes are made to the splash screen * Branch name was hidden when if name == "master", now it is hidden if the current commit is in the history of (origin/)master * Latest commit datetime is shown on the same line as the version string. * The age of last commit in (origin/)master is calculated at runtime startup and shown to the user as # days old master. This is to encurage users that compile and follow master to stay current. * If julia was compiled from a fork the number of commits not in master is shown on startup. * For tagged releases all git info is hidden in the splash screen. --- base/Makefile | 48 ++++++++++++++++++++++++++++++------------------ base/version.jl | 21 +++++++++++++-------- 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/base/Makefile b/base/Makefile index 029c8a511a927..0bbc1b96caaf0 100644 --- a/base/Makefile +++ b/base/Makefile @@ -3,27 +3,34 @@ 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) +fork_master_distance = $(shell git rev-list --count HEAD ^"$(origin)master" 2>/dev/null) +fork_master_timestamp = $(shell git show -s $$(git merge-base HEAD $(origin)master 2>/dev/null) --format=format:"%ct" 2>/dev/null) + 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 "*" ) all: pcre_h.jl errno_h.jl build_h.jl.phony fenv_constants.jl file_constants.jl uv_constants.jl @@ -44,7 +51,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)\"" >> $@ @@ -62,26 +70,30 @@ 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 "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), \ )" | xargs >> $@ @# This to ensure that we always rebuild this file, but only when it is modified do we touch build_h.jl, diff --git a/base/version.jl b/base/version.jl index 61f6367765743..29912e9deed11 100644 --- a/base/version.jl +++ b/base/version.jl @@ -190,19 +190,24 @@ 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 + 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 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 ($(BUILD_INFO.date_string)) + _/ |\\__'_|_|_|\\__'_| | $(commit_string) |__/ | $(Sys.MACHINE) """ @@ -218,8 +223,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 ($(BUILD_INFO.date_string)) + $(jl)_/ |\\__'_|_|_|\\__'_|$(tx) | $(commit_string) $(jl)|__/$(tx) | $(Sys.MACHINE) \033[0m" From cca45a409d23e79e35502c21d8570a0ebdd9d9bc Mon Sep 17 00:00:00 2001 From: ivarne Date: Mon, 4 Nov 2013 15:46:44 +0100 Subject: [PATCH 2/3] Added a make flag TAGGED_RELEASE_BANNER As the commit information line is hidden when compilling a taged release, this adds a make flag so that distributes can cusomize 45 characters of the splash screen. --- DISTRIBUTING.md | 8 ++++++++ base/Makefile | 4 ++++ base/version.jl | 5 ++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/DISTRIBUTING.md b/DISTRIBUTING.md index ea5e3a6d1ce89..cf242fccc75fa 100644 --- a/DISTRIBUTING.md +++ b/DISTRIBUTING.md @@ -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 ----- diff --git a/base/Makefile b/base/Makefile index 0bbc1b96caaf0..6d163bb92b8a2 100644 --- a/base/Makefile +++ b/base/Makefile @@ -32,6 +32,8 @@ endif 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 @@ -80,6 +82,7 @@ endif @echo " tagged_commit::Bool" >> $@ @echo " fork_master_distance::Int" >> $@ @echo " fork_master_timestamp::Int64" >> $@ + @echo " TAGGED_RELEASE_BANNER::String" >> $@ @echo "end" >> $@ @@ -94,6 +97,7 @@ endif $(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, diff --git a/base/version.jl b/base/version.jl index 29912e9deed11..7e17ee2fa32de 100644 --- a/base/version.jl +++ b/base/version.jl @@ -190,7 +190,10 @@ catch e println("while creating Base.VERSION, ignoring error $e") global const VERSION = VersionNumber(0) end -if !BUILD_INFO.tagged_commit + +if BUILD_INFO.tagged_commit + global const commit_string = BUILD_INFO.TAGGED_RELEASE_BANNER +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)" From 1955073d28b708eb348f9a56490973ed05d49621 Mon Sep 17 00:00:00 2001 From: ivarne Date: Tue, 5 Nov 2013 20:27:14 +0100 Subject: [PATCH 3/3] Fix build when git is not availible --- base/Makefile | 6 +++--- base/version.jl | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/base/Makefile b/base/Makefile index 6d163bb92b8a2..4286522d3817a 100644 --- a/base/Makefile +++ b/base/Makefile @@ -15,9 +15,9 @@ prerelease = $(shell [ -z "$(last_tag)" -o "$(last_tag)" = "v$(version_string)" origin = $(shell [ -d ../.git/refs/remotes/origin ] && echo "origin/") -build_number = $(shell git rev-list --count HEAD ^"$(last_tag)" 2>/dev/null) -fork_master_distance = $(shell git rev-list --count HEAD ^"$(origin)master" 2>/dev/null) -fork_master_timestamp = $(shell git show -s $$(git merge-base HEAD $(origin)master 2>/dev/null) --format=format:"%ct" 2>/dev/null) +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), ) diff --git a/base/version.jl b/base/version.jl index 7e17ee2fa32de..dafeef48c737f 100644 --- a/base/version.jl +++ b/base/version.jl @@ -193,6 +193,8 @@ end 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 @@ -201,6 +203,7 @@ 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 = """ @@ -209,7 +212,7 @@ const banner_plain = (_) | (_) (_) | Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type \"help()\" to list help topics | | | | | | |/ _` | | - | | |_| | | | (_| | | Version $VERSION ($(BUILD_INFO.date_string)) + | | |_| | | | (_| | | Version $(VERSION)$(commit_date) _/ |\\__'_|_|_|\\__'_| | $(commit_string) |__/ | $(Sys.MACHINE) @@ -226,7 +229,7 @@ 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 ($(BUILD_INFO.date_string)) + $(jl)| | |_| | | | (_| |$(tx) | Version $(VERSION)$(commit_date) $(jl)_/ |\\__'_|_|_|\\__'_|$(tx) | $(commit_string) $(jl)|__/$(tx) | $(Sys.MACHINE)