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
$(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)
git archive --format=tar --prefix=$(PACKAGE)/ $(PACKAGE) \
>$(PACKAGE).tar
gzip <$(PACKAGE).tar >$(PACKAGE).tar.gz
+
+tag:
+ git tag $(TAG)
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
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
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
category)
e2option.flag("version", "show version number",
function()
- print(_version)
+ print(buildconfig.VERSIONSTRING)
e2lib.finish(0)
end,
category)
}
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
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
# 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
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)\"" \
}
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"
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 \