]> git.e2factory.org Git - e2factory.git/commitdiff
compose version string from single variables
authorGordon Hecker <gh@emlix.com>
Tue, 26 May 2009 09:28:32 +0000 (11:28 +0200)
committerGordon Hecker <gh@emlix.com>
Tue, 26 May 2009 14:24:52 +0000 (16:24 +0200)
replace E2_COMMIT and E2_VERSION build time variables
new make target: tag

Signed-off-by: Gordon Hecker <gh@emlix.com>
Makefile
README.RELEASE_PROCESS
generic/e2lib.lua
generic/e2option.lua
generic/lua-version-map.lua.in
local/e2tool.lua
make.vars
scripts/genscript.sh
version [deleted file]

index 98edc386f59f80b37ec2a314af523c031ab27044..a6e582e6b601b7cbe5847d1e4593c6596fa3ded6 100644 (file)
--- 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)
index 96dda35e0b4a5544e9ee496e1de9920627fe2849..957c2b578078ebee899c3f12c970df6f3c987969 100644 (file)
@@ -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
index 1abce16870142e492c0e9b82b49a5832059e284d..74b07068fc6f93e1e9ee8e103c039ae74cf8f454 100644 (file)
@@ -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
index 69574f9f376366d99f6ac3d9eb9161ab9148a48a..43616353f16fe24f83dce532f912107ae04ddd74 100644 (file)
@@ -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)
index 2356682ef86d79d871f40561526eb0978fcd0d47..07551a6cbfacc36701ede790b02a643241a335d2 100644 (file)
@@ -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
index bc9de8263a916ee4da7e609fadb54eb47725c391..b15284fdbcaa881b4d16fd0da715a3a2d177375d 100644 (file)
@@ -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
index 45482314fd36437664fe9f375575ce8b65260627..716907a511b2d8f4a8b6fde0b15c80480c8c501b 100644 (file)
--- 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)\"" \
index efc933fa68c905eeaf02e68b034989aa59350388..a98b6515a5282341688df7e74fc6a579be8b7bb0 100755 (executable)
@@ -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 (file)
index 0f72b8f..0000000
--- a/version
+++ /dev/null
@@ -1 +0,0 @@
-2.3.0-wip