From: Gordon Hecker Date: Tue, 26 May 2009 09:28:32 +0000 (+0200) Subject: compose version string from single variables X-Git-Tag: e2factory-2.3.1pre1~17 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=76a7f093cfb17871397d91cf4b9c0d968f703e8c;p=e2factory.git compose version string from single variables replace E2_COMMIT and E2_VERSION build time variables new make target: tag Signed-off-by: Gordon Hecker --- diff --git a/Makefile b/Makefile index 98edc38..a6e582e 100644 --- a/Makefile +++ b/Makefile @@ -31,26 +31,31 @@ TOPLEVEL = . include $(TOPLEVEL)/make.vars -CLEAN_FILES = *~ E2_COMMIT buildconfig.lua +CLEAN_FILES = *~ buildconfig.lua .PHONY: all e2commit install install-local clean local localdist uninstall \ - doc + doc buildconfig.lua help: @cat INSTALL -buildconfig.lua: Makefile - echo 'module ("buildconfig")' > $@ - echo 'PREFIX="$(PREFIX)"' >>$@ - echo 'BINDIR="$(BINDIR)"' >>$@ - echo 'LIBDIR="$(LIBDIR)"' >>$@ - echo 'TOOLDIR="$(TOOLDIR)"' >>$@ - echo 'E2="$(E2)"' >>$@ - echo 'LUA="$(LUA)"' >>$@ - echo 'E2_VERSION="$(E2_VERSION)"' >>$@ - echo 'E2_COMMIT="$(E2_COMMIT)"' >>$@ - echo 'E2_SYNTAX="$(E2_SYNTAX)"' >>$@ +buildconfig.lua: Makefile make.vars + @echo 'writing buildconfig.lua' + @echo 'module ("buildconfig")' > $@ + @echo 'PREFIX="$(PREFIX)"' >>$@ + @echo 'BINDIR="$(BINDIR)"' >>$@ + @echo 'LIBDIR="$(LIBDIR)"' >>$@ + @echo 'TOOLDIR="$(TOOLDIR)"' >>$@ + @echo 'E2="$(E2)"' >>$@ + @echo 'LUA="$(LUA)"' >>$@ + @echo 'E2_SYNTAX="$(E2_SYNTAX)"' >>$@ + @echo 'MAJOR="$(MAJOR)"' >>$@ + @echo 'MINOR="$(MINOR)"' >>$@ + @echo 'PATCHLEVEL="$(PATCHLEVEL)"' >>$@ + @echo 'EXTRAVERSION="$(EXTRAVERSION)"' >>$@ + @echo 'VERSION="$(VERSION)"' >>$@ + @echo 'VERSIONSTRING="$(VERSIONSTRING)"' >>$@ all: e2commit buildconfig.lua $(MAKE) -C lua @@ -60,17 +65,6 @@ all: e2commit buildconfig.lua $(MAKE) -C templates all $(MAKE) -C extensions all -# this target creates a file E2_COMMIT, holding the current E2_COMMIT -# string, and cleans the tree in case E2_COMMIT changed since the last -# time. That makes sure that the builtin version string is always correct. - -e2commit: - @if [ "$(E2_COMMIT)" != "$(shell cat E2_COMMIT)" ] ; then \ - echo "E2_COMMIT changed. making clean first." ; \ - $(MAKE) clean ; \ - echo "$(E2_COMMIT)" > E2_COMMIT ; \ - fi - install: all mkdir -p $(DESTDIR)$(BINDIR) mkdir -p $(DESTDIR)$(LIBDIR) @@ -157,3 +151,6 @@ dist: git archive --format=tar --prefix=$(PACKAGE)/ $(PACKAGE) \ >$(PACKAGE).tar gzip <$(PACKAGE).tar >$(PACKAGE).tar.gz + +tag: + git tag $(TAG) diff --git a/README.RELEASE_PROCESS b/README.RELEASE_PROCESS index 96dda35..957c2b5 100644 --- a/README.RELEASE_PROCESS +++ b/README.RELEASE_PROCESS @@ -1,11 +1,14 @@ 1. Including the e2 tool version into the buildid calculation -The content of the version file is available in the source in the E2_VERSION -variable. -This variable is calculated into the buildid, to catch tool changes and -be sure to rebuild results whenever the e2 tool version changes. +The version of e2factory is set in make.vars -The E2_COMMIT variable is not used, as that makes development impossible, +The buildconfig lua module provides each single part of the version string +and the full version string. + +The full version string is calculated into the buildid, to catch tool +changes and be sure to rebuild results whenever the e2 tool version changes. + +The VERSIONSTRING variable is not used, as that makes development impossible, as buildids would change with each single commit. 2. The release process diff --git a/generic/e2lib.lua b/generic/e2lib.lua index 1abce16..74b0706 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -27,7 +27,7 @@ require("buildconfig") _version = "e2factory, the emlix embedded build system, version " .. - buildconfig.E2_VERSION + buildconfig.VERSION _licence = [[ e2factory is free software: you can redistribute it and/or modify @@ -449,8 +449,8 @@ function e2lib.log_invocation(info, args) pname = info.name end local logstring = string.format( - "%s %s %s/%s %s \"%s %s\"\n", - pname, os.date(), buildconfig.E2_VERSION, buildconfig.E2_COMMIT, + "%s %s %s %s \"%s %s\"\n", + pname, os.date(), buildconfig.VERSIONSTRING, e2lib.username, arg[0], table.concat(args, " ")) -- always log to the user logfile diff --git a/generic/e2option.lua b/generic/e2option.lua index 69574f9..4361635 100644 --- a/generic/e2option.lua +++ b/generic/e2option.lua @@ -227,7 +227,7 @@ function e2option.parse(args) category) e2option.flag("version", "show version number", function() - print(_version) + print(buildconfig.VERSIONSTRING) e2lib.finish(0) end, category) diff --git a/generic/lua-version-map.lua.in b/generic/lua-version-map.lua.in index 2356682..07551a6 100644 --- a/generic/lua-version-map.lua.in +++ b/generic/lua-version-map.lua.in @@ -35,7 +35,7 @@ lua_versions = { } function lua_versions.get_version(e2_version) - local v = e2_version or buildconfig.E2_VERSION + local v = e2_version or buildconfig.VERSION local lv = lua_versions[ v ] return lv or lua_versions.latest end diff --git a/local/e2tool.lua b/local/e2tool.lua index bc9de82..b15284f 100644 --- a/local/e2tool.lua +++ b/local/e2tool.lua @@ -1066,7 +1066,7 @@ function e2tool.projid(info) end hc:hash_line(info.release_id) hc:hash_line(info.project.chroot_arch) - hc:hash_line(buildconfig.E2_VERSION) + hc:hash_line(buildconfig.VERSION) info.projid = hc:hash_finish() return info.projid end diff --git a/make.vars b/make.vars index 4548231..716907a 100644 --- a/make.vars +++ b/make.vars @@ -1,12 +1,31 @@ # make.vars -*- makefile -*- + +# version string +NAME = e2factory +MAJOR = 2 +MINOR = 3 +PATCHLEVEL = 0 +EXTRAVERSION = -wip +ifdef EXTRAVERSION + VERSION = $(MAJOR).$(MINOR).$(PATCHLEVEL)$(EXTRAVERSION) +else + VERSION = $(MAJOR).$(MINOR).$(PATCHLEVEL) +endif +TAG = $(NAME)-$(VERSION) + +COMMIT = $(shell git describe --tags 2>/dev/null) +ifeq ($(COMMIT),) + VERSIONSTRING = $(TAG) +else + VERSIONSTRING = $(COMMIT) +endif + DETECT_TOOL = $(TOPLEVEL)/scripts/detect_tool -E2_VERSION = $(shell cat $(TOPLEVEL)/version) -E2_COMMIT ?= $(shell cd $(TOPLEVEL);scripts/buildversion.sh) PROJECTDIR ?= $(shell cd $(TOPLEVEL);scripts/e2-locate-project-root 2>/dev/null) E2_SYNTAX = $(shell cat $(TOPLEVEL)/syntax) E2DATA = /mnt/e2data -export E2_VERSION E2_COMMIT E2DATA PROJECTDIR E2_SYNTAX +export E2DATA PROJECTDIR E2_SYNTAX DESTDIR = PREFIX = /usr/local @@ -52,9 +71,7 @@ export LUA_VERSION UPSTREAM BASE_PROJECT_PATH LUAC BUILD_LUAC ARCH BINARY_STORE CC = gcc CFLAGS = -g -Wall -CPPFLAGS = -D E2_COMMIT="\"$(E2_COMMIT)\"" \ - -D E2_VERSION="\"$(E2_VERSION)\"" \ - -DBINDIR="\"$(BINDIR)\"" \ +CPPFLAGS = -DBINDIR="\"$(BINDIR)\"" \ -DLIBDIR="\"$(LIBDIR)\"" \ -DLIBEXECDIR="\"$(LIBEXECDIR)\"" \ -DINCDIR="\"$(INCDIR)\"" \ diff --git a/scripts/genscript.sh b/scripts/genscript.sh index efc933f..a98b651 100755 --- a/scripts/genscript.sh +++ b/scripts/genscript.sh @@ -6,8 +6,6 @@ function die() { } set -e -test -n "$E2_COMMIT" || die "E2_COMMIT not set" -test -n "$E2_VERSION" || die "E2_VERSION not set" test -n "$E2_SYNTAX" || die "E2_SYNTAX not set" test -n "$PREFIX" || die "PREFIX not set" test -n "$BINDIR" || die "BINDIR not set" @@ -26,9 +24,7 @@ test -n "$CHROOT_TOOL" || die "CHROOT_TOOL not set" test -n "$TAR_TOOL" || die "TAR_TOOL not set" test -n "$CHOWN_TOOL" || die "CHOWN_TOOL not set" test -n "$RM_TOOL" || die "RM_TOOL not set" -sed -e s/"@E2_COMMIT@"/"$E2_COMMIT"/g \ - -e s/"@E2_VERSION@"/"$E2_VERSION"/g \ - -e s/"@E2_SYNTAX@"/"$E2_SYNTAX"/g \ +sed -e s/"@E2_SYNTAX@"/"$E2_SYNTAX"/g \ -e s,"@E2_E2DATA@","$E2DATA",g \ -e s,"@LIBDIR@","$LIBDIR",g \ -e s,"@LIBEXECDIR@","$LIBEXECDIR",g \ diff --git a/version b/version deleted file mode 100644 index 0f72b8f..0000000 --- a/version +++ /dev/null @@ -1 +0,0 @@ -2.3.0-wip