mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-30 02:34:13 +08:00
mdbx: tally revision number since the last release, not from an epoch.
Change-Id: I623b2a57bfe4e1a242d1d68350001ebadef3d634
This commit is contained in:
parent
cda94ee61d
commit
4884cd2bcd
14
GNUmakefile
14
GNUmakefile
@ -140,8 +140,8 @@ reformat:
|
|||||||
|
|
||||||
MAN_SRCDIR := src/man1/
|
MAN_SRCDIR := src/man1/
|
||||||
ALLOY_DEPS := $(wildcard src/*)
|
ALLOY_DEPS := $(wildcard src/*)
|
||||||
MDBX_VERSION_GIT = ${shell set -o pipefail; git describe --tags | sed -n 's|^v*\([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\)\(.*\)|\1|p' || echo 'Please fetch tags and/or install latest git version'}
|
MDBX_GIT_VERSION = ${shell set -o pipefail; git describe --tags | sed -n 's|^v*\([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\)\(.*\)|\1|p' || echo 'Please fetch tags and/or install latest git version'}
|
||||||
MDBX_REVISION_GIT = $(shell git rev-list --count --no-merges HEAD || echo 'Please fetch tags and/or install latest git version')
|
MDBX_GIT_REVISION = $(shell git rev-list --count HEAD ^`git tag --sort=-version:refname | sed -n '/^\(v[0-9]\+\.[0-9]\+\.[0-9]\+\)*/p;q'`)
|
||||||
MDBX_GIT_TIMESTAMP = $(shell git show --no-patch --format=%cI HEAD || echo 'Please install latest get version')
|
MDBX_GIT_TIMESTAMP = $(shell git show --no-patch --format=%cI HEAD || echo 'Please install latest get version')
|
||||||
MDBX_GIT_DESCRIBE = $(shell git describe --tags --long --dirty=-dirty || echo 'Please fetch tags and/or install latest git version')
|
MDBX_GIT_DESCRIBE = $(shell git describe --tags --long --dirty=-dirty || echo 'Please fetch tags and/or install latest git version')
|
||||||
MDBX_VERSION_SUFFIX = $(shell set -o pipefail; echo -n '$(MDBX_GIT_DESCRIBE)' | tr -c -s '[a-zA-Z0-9]' _)
|
MDBX_VERSION_SUFFIX = $(shell set -o pipefail; echo -n '$(MDBX_GIT_DESCRIBE)' | tr -c -s '[a-zA-Z0-9]' _)
|
||||||
@ -220,10 +220,10 @@ src/version.c: src/version.c.in $(lastword $(MAKEFILE_LIST)) $(git_DIR)/HEAD $(g
|
|||||||
-e "s|@MDBX_GIT_TREE@|$(shell git show --no-patch --format=%T HEAD || echo 'Please install latest get version')|" \
|
-e "s|@MDBX_GIT_TREE@|$(shell git show --no-patch --format=%T HEAD || echo 'Please install latest get version')|" \
|
||||||
-e "s|@MDBX_GIT_COMMIT@|$(shell git show --no-patch --format=%H HEAD || echo 'Please install latest get version')|" \
|
-e "s|@MDBX_GIT_COMMIT@|$(shell git show --no-patch --format=%H HEAD || echo 'Please install latest get version')|" \
|
||||||
-e "s|@MDBX_GIT_DESCRIBE@|$(MDBX_GIT_DESCRIBE)|" \
|
-e "s|@MDBX_GIT_DESCRIBE@|$(MDBX_GIT_DESCRIBE)|" \
|
||||||
-e "s|\$${MDBX_VERSION_MAJOR}|$(shell echo '$(MDBX_VERSION_GIT)' | cut -d . -f 1)|" \
|
-e "s|\$${MDBX_VERSION_MAJOR}|$(shell echo '$(MDBX_GIT_VERSION)' | cut -d . -f 1)|" \
|
||||||
-e "s|\$${MDBX_VERSION_MINOR}|$(shell echo '$(MDBX_VERSION_GIT)' | cut -d . -f 2)|" \
|
-e "s|\$${MDBX_VERSION_MINOR}|$(shell echo '$(MDBX_GIT_VERSION)' | cut -d . -f 2)|" \
|
||||||
-e "s|\$${MDBX_VERSION_RELEASE}|$(shell echo '$(MDBX_VERSION_GIT)' | cut -d . -f 3)|" \
|
-e "s|\$${MDBX_VERSION_RELEASE}|$(shell echo '$(MDBX_GIT_VERSION)' | cut -d . -f 3)|" \
|
||||||
-e "s|\$${MDBX_VERSION_REVISION}|$(MDBX_REVISION_GIT)|" \
|
-e "s|\$${MDBX_VERSION_REVISION}|$(MDBX_GIT_REVISION)|" \
|
||||||
src/version.c.in > $@
|
src/version.c.in > $@
|
||||||
|
|
||||||
src/config.h: src/version.c $(lastword $(MAKEFILE_LIST))
|
src/config.h: src/version.c $(lastword $(MAKEFILE_LIST))
|
||||||
@ -290,7 +290,7 @@ endef
|
|||||||
$(foreach file,$(filter-out man1/% VERSION %.in ntdll.def,$(DIST_EXTRA)),$(eval $(call dist-extra-rule,$(file))))
|
$(foreach file,$(filter-out man1/% VERSION %.in ntdll.def,$(DIST_EXTRA)),$(eval $(call dist-extra-rule,$(file))))
|
||||||
|
|
||||||
dist/VERSION: src/version.c
|
dist/VERSION: src/version.c
|
||||||
mkdir -p dist/ && echo "$(MDBX_VERSION_GIT).$(MDBX_REVISION_GIT)" > $@
|
mkdir -p dist/ && echo "$(MDBX_GIT_VERSION).$(MDBX_GIT_REVISION)" > $@
|
||||||
|
|
||||||
dist/ntdll.def: src/ntdll.def
|
dist/ntdll.def: src/ntdll.def
|
||||||
mkdir -p dist/cmake/ && cp $< $@
|
mkdir -p dist/cmake/ && cp $< $@
|
||||||
|
@ -113,13 +113,30 @@ macro(fetch_version name source_root_directory parent_scope)
|
|||||||
message(FATAL_ERROR "Please install latest version of git ('show --no-patch --format=%H HEAD' failed)")
|
message(FATAL_ERROR "Please install latest version of git ('show --no-patch --format=%H HEAD' failed)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
execute_process(COMMAND ${GIT} rev-list --count --no-merges HEAD
|
execute_process(COMMAND ${GIT} tag --sort=-version:refname
|
||||||
|
OUTPUT_VARIABLE tag_list
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
WORKING_DIRECTORY ${source_root_directory}
|
||||||
|
RESULT_VARIABLE rc)
|
||||||
|
if(rc)
|
||||||
|
message(FATAL_ERROR "Please install latest version of git ('tag --sort=-version:refname' failed)")
|
||||||
|
endif()
|
||||||
|
string(REGEX REPLACE "\n" ";" tag_list "${tag_list}")
|
||||||
|
set(last_release_tag "")
|
||||||
|
set(git_revlist_arg "HEAD")
|
||||||
|
foreach(tag IN LISTS tag_list)
|
||||||
|
if(NOT last_release_tag)
|
||||||
|
string(REGEX MATCH "^v[0-9]+(\.[0-9]+)+" last_release_tag "${tag}")
|
||||||
|
set(git_revlist_arg "${tag}..HEAD")
|
||||||
|
endif()
|
||||||
|
endforeach(tag)
|
||||||
|
execute_process(COMMAND ${GIT} rev-list --count "${git_revlist_arg}"
|
||||||
OUTPUT_VARIABLE ${name}_GIT_REVISION
|
OUTPUT_VARIABLE ${name}_GIT_REVISION
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
WORKING_DIRECTORY ${source_root_directory}
|
WORKING_DIRECTORY ${source_root_directory}
|
||||||
RESULT_VARIABLE rc)
|
RESULT_VARIABLE rc)
|
||||||
if(rc OR "${name}_GIT_REVISION" STREQUAL "")
|
if(rc OR "${name}_GIT_REVISION" STREQUAL "")
|
||||||
message(FATAL_ERROR "Please install latest version of git ('rev-list --count --no-merges HEAD' failed)")
|
message(FATAL_ERROR "Please install latest version of git ('rev-list --count ${git_revlist_arg}' failed)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
string(REGEX MATCH "^(v)?([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)?" git_version_valid "${${name}_GIT_DESCRIBE}")
|
string(REGEX MATCH "^(v)?([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)?" git_version_valid "${${name}_GIT_DESCRIBE}")
|
||||||
@ -136,7 +153,7 @@ macro(fetch_version name source_root_directory parent_scope)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT ${name}_GIT_VERSION OR NOT ${name}_GIT_TIMESTAMP OR NOT ${name}_GIT_REVISION)
|
if(NOT ${name}_GIT_VERSION OR NOT ${name}_GIT_TIMESTAMP OR ${name}_GIT_REVISION STREQUAL "")
|
||||||
if(GIT AND EXISTS "${source_root_directory}/.git")
|
if(GIT AND EXISTS "${source_root_directory}/.git")
|
||||||
message(WARNING "Unable to retrive ${name} version from git.")
|
message(WARNING "Unable to retrive ${name} version from git.")
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user