Makefile, scst: Add revision to SCST version macro

Add SCST revision to SCST_VERSION_STRING macro. This might be useful
for issues reporting/investigation.
This commit is contained in:
Gleb Chesnokov
2023-01-27 12:40:49 +03:00
parent 87340a8427
commit a86e5c55ea
3 changed files with 25 additions and 6 deletions

View File

@@ -70,9 +70,17 @@ EMULEX_DIR=emulex
ISCSI_DIR=iscsi-scst
REVISION ?= $(shell if [ -e .git ]; then echo -n .; git rev-parse --short HEAD 2>/dev/null; fi)
SCST_GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
REVISION ?= $(SCST_GIT_COMMIT)
export REVISION
VERSION_WITHOUT_REVISION := $(shell echo -n "$$(sed -n 's/^\#define[[:blank:]]SCST_VERSION_NAME[[:blank:]]*\"\([^-]*\).*\"/\1/p' scst/include/scst_const.h)")
VERSION := $(VERSION_WITHOUT_REVISION)$(REVISION)
ifneq (, $(REVISION))
VERSION := $(VERSION_WITHOUT_REVISION).$(REVISION)
else
VERSION := $(VERSION_WITHOUT_REVISION)
endif
DEBIAN_REVISION=1.1
RPMTOPDIR ?= $(shell if [ $$(id -u) = 0 ]; then echo /usr/src/packages;\
else echo $$PWD/rpmbuilddir; fi)

View File

@@ -37,6 +37,9 @@
#include "scst_itf_ver.h"
#define SCST_STRINGIFY_x(x...) #x
#define SCST_STRINGIFY(x...) SCST_STRINGIFY_x(x)
/*
* Version numbers, the same as for the kernel.
*
@@ -45,9 +48,16 @@
*/
#define SCST_VERSION(a, b, c, d) (((a) << 24) + ((b) << 16) + ((c) << 8) + d)
#define SCST_VERSION_CODE SCST_VERSION(3, 8, 0, 0)
#ifdef SCST_VERSION_REVISION
#define SCST_VERSION_REVISION_SUFFIX "." SCST_STRINGIFY(SCST_VERSION_REVISION)
#else
#define SCST_VERSION_REVISION_SUFFIX ""
#endif
#define SCST_VERSION_STRING_SUFFIX
#define SCST_VERSION_NAME "3.8.0-pre"
#define SCST_VERSION_STRING SCST_VERSION_NAME SCST_VERSION_STRING_SUFFIX
#define SCST_VERSION_STRING SCST_VERSION_NAME SCST_VERSION_STRING_SUFFIX SCST_VERSION_REVISION_SUFFIX
#define SCST_CONST_VERSION SCST_CONST_INTF_VER

View File

@@ -1,8 +1,9 @@
# See also Documentation/core-api/symbol-namespaces.rst for more information
# about DEFAULT_SYMBOL_NAMESPACE.
ccflags-y += -I$(src)/../include\
-DDEFAULT_SYMBOL_NAMESPACE=SCST\
$(shell [ -n "${CONFIG_SCST_NO_DLM}" ] && echo -DCONFIG_SCST_NO_DLM)
ccflags-y += -I$(src)/../include \
-DDEFAULT_SYMBOL_NAMESPACE=SCST \
$(shell [ -n "${CONFIG_SCST_NO_DLM}" ] && echo -DCONFIG_SCST_NO_DLM) \
$(shell [ -n "${REVISION}" ] && echo -DSCST_VERSION_REVISION=${REVISION})
#ccflags-y += -DCONFIG_SCST_STRICT_SERIALIZING
#ccflags-y += -DCONFIG_SCST_USE_EXPECTED_VALUES