mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 01:01:27 +00:00
scst: Extend build metadata passed to the SCST
Previously, only the revision string was passed from the build system into the SCST kernel module. This patch extends that by passing additional build metadata: kernel version, build date, Git commit hash, build number, and architecture type. These values are now consistently exposed in the kernel log, sysfs, and via modinfo, providing a unified and reliable way to identify the exact build in use.
This commit is contained in:
96
Makefile
96
Makefile
@@ -16,7 +16,7 @@
|
||||
#
|
||||
#
|
||||
|
||||
SHELL = /bin/bash
|
||||
SHELL := /bin/bash
|
||||
|
||||
# Define the location to the kernel src. Can be defined here or on
|
||||
# the command line during the build process. If KDIR is defined,
|
||||
@@ -30,58 +30,70 @@ SHELL = /bin/bash
|
||||
#export KVER=2.6.x
|
||||
|
||||
ifdef KDIR
|
||||
ifndef KVER
|
||||
export KVER = $(strip $(shell \
|
||||
cat $(KDIR)/include/config/kernel.release 2>/dev/null || \
|
||||
make -s -C $(KDIR) kernelversion))
|
||||
endif
|
||||
ifndef KVER
|
||||
KVER = $(strip $(shell \
|
||||
cat $(KDIR)/include/config/kernel.release 2>/dev/null || \
|
||||
make -s -C $(KDIR) kernelversion))
|
||||
endif
|
||||
else
|
||||
ifndef KVER
|
||||
KVER=$(strip $(shell uname -r))
|
||||
endif
|
||||
KDIR=/lib/modules/$(KVER)/build
|
||||
ifndef KVER
|
||||
KVER=$(strip $(shell uname -r))
|
||||
endif
|
||||
|
||||
KDIR=/lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
PKG_BUILD_MODE ?= 2release
|
||||
|
||||
OLD_QLA_INI_DIR=qla2x00t
|
||||
OLD_QLA_DIR=$(OLD_QLA_INI_DIR)/qla2x00-target
|
||||
OLD_QLA_INI_DIR = qla2x00t
|
||||
OLD_QLA_DIR = $(OLD_QLA_INI_DIR)/qla2x00-target
|
||||
|
||||
NEW_QLA_INI_DIR=qla2x00t-32gbit
|
||||
NEW_QLA_DIR=$(NEW_QLA_INI_DIR)/qla2x00-target
|
||||
NEW_QLA_INI_DIR = qla2x00t-32gbit
|
||||
NEW_QLA_DIR = $(NEW_QLA_INI_DIR)/qla2x00-target
|
||||
|
||||
ifeq ($(QLA_32GBIT),no)
|
||||
QLA_INI_DIR=$(OLD_QLA_INI_DIR)
|
||||
QLA_DIR=$(OLD_QLA_DIR)
|
||||
QLA_INI_DIR = $(OLD_QLA_INI_DIR)
|
||||
QLA_DIR = $(OLD_QLA_DIR)
|
||||
else
|
||||
QLA_INI_DIR=$(NEW_QLA_INI_DIR)
|
||||
QLA_DIR=$(NEW_QLA_DIR)
|
||||
QLA_INI_DIR = $(NEW_QLA_INI_DIR)
|
||||
QLA_DIR = $(NEW_QLA_DIR)
|
||||
endif
|
||||
|
||||
SCST_DIR = scst
|
||||
DOC_DIR = doc
|
||||
SCSTADM_DIR = scstadmin
|
||||
USR_DIR = usr
|
||||
SRP_DIR = srpt
|
||||
SCST_LOCAL_DIR = scst_local
|
||||
FCST_DIR = fcst
|
||||
EMULEX_DIR = emulex
|
||||
ISCSI_DIR = iscsi-scst
|
||||
|
||||
SCST_DIR=scst
|
||||
DOC_DIR=doc
|
||||
SCSTADM_DIR=scstadmin
|
||||
USR_DIR=usr
|
||||
SRP_DIR=srpt
|
||||
SCST_LOCAL_DIR=scst_local
|
||||
FCST_DIR=fcst
|
||||
EMULEX_DIR=emulex
|
||||
BUILD_DATE := $(shell date -u '+%Y/%m/%d-%H:%M:%S-%Z%:z')
|
||||
GIT_COMMIT := $(shell git rev-parse --short=12 HEAD 2>/dev/null)
|
||||
|
||||
ISCSI_DIR=iscsi-scst
|
||||
|
||||
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)")
|
||||
ifneq (, $(REVISION))
|
||||
VERSION := $(VERSION_WITHOUT_REVISION).$(REVISION)
|
||||
else
|
||||
VERSION := $(VERSION_WITHOUT_REVISION)
|
||||
ifndef BUILD_NUMBER
|
||||
BUILD_NUMBER := $(shell git rev-list --count HEAD 2>/dev/null || echo 0)
|
||||
endif
|
||||
DEBIAN_REVISION=1.1
|
||||
|
||||
ifndef ARCH_TYPE
|
||||
ARCH_TYPE := $(shell uname -m)
|
||||
endif
|
||||
|
||||
export KVER BUILD_DATE GIT_COMMIT BUILD_NUMBER ARCH_TYPE
|
||||
|
||||
RELEASE_VERSION := $(shell echo -n "$$(sed -n 's/^\#define[[:blank:]]SCST_VERSION_NAME[[:blank:]]*\"\([^-]*\).*\"/\1/p' scst/include/scst_const.h)")
|
||||
|
||||
ifndef REVISION
|
||||
ifneq ($(GIT_COMMIT),)
|
||||
REVISION := $(BUILD_NUMBER).$(GIT_COMMIT)
|
||||
else
|
||||
REVISION := $(BUILD_NUMBER)
|
||||
endif
|
||||
endif
|
||||
|
||||
VERSION := $(RELEASE_VERSION).$(REVISION)
|
||||
DEBIAN_REVISION := 1.1
|
||||
RPMTOPDIR ?= $(shell if [ $$(id -u) = 0 ]; then echo /usr/src/packages;\
|
||||
else echo $$PWD/rpmbuilddir; fi)
|
||||
SCST_SOURCE_FILES = $(shell if [ -e scripts/list-source-files ]; then \
|
||||
@@ -481,9 +493,9 @@ dpkg: ../scst_$(VERSION).orig.tar.gz
|
||||
|
||||
release-archive:
|
||||
$(MAKE) 2release
|
||||
scripts/generate-release-archive scst "$(VERSION_WITHOUT_REVISION)"
|
||||
md5sum ../scst-$(VERSION_WITHOUT_REVISION).tar.bz2 \
|
||||
> ../scst-$(VERSION_WITHOUT_REVISION).tar.bz2.md5sum
|
||||
scripts/generate-release-archive scst "$(RELEASE_VERSION)"
|
||||
md5sum ../scst-$(RELEASE_VERSION).tar.bz2 \
|
||||
> ../scst-$(RELEASE_VERSION).tar.bz2.md5sum
|
||||
$(MAKE) 2debug
|
||||
|
||||
multiple-release-archives:
|
||||
|
||||
@@ -53,10 +53,34 @@
|
||||
#define SCST_VERSION_STRING_SUFFIX
|
||||
#define SCST_VERSION_STRING SCST_VERSION_NAME SCST_VERSION_STRING_SUFFIX
|
||||
|
||||
#ifdef SCST_REVISION
|
||||
#define SCST_REVISION_STRING SCST_STRINGIFY(SCST_REVISION)
|
||||
#ifdef SCST_KVER
|
||||
#define SCST_KVER_STRING SCST_STRINGIFY(SCST_KVER)
|
||||
#else
|
||||
#define SCST_REVISION_STRING ""
|
||||
#define SCST_KVER_STRING ""
|
||||
#endif
|
||||
|
||||
#ifdef SCST_BUILD_DATE
|
||||
#define SCST_BUILD_DATE_STRING SCST_STRINGIFY(SCST_BUILD_DATE)
|
||||
#else
|
||||
#define SCST_BUILD_DATE_STRING ""
|
||||
#endif
|
||||
|
||||
#ifdef SCST_GIT_COMMIT
|
||||
#define SCST_GIT_COMMIT_STRING SCST_STRINGIFY(SCST_GIT_COMMIT)
|
||||
#else
|
||||
#define SCST_GIT_COMMIT_STRING ""
|
||||
#endif
|
||||
|
||||
#ifdef SCST_BUILD_NUMBER
|
||||
#define SCST_BUILD_NUMBER_STRING SCST_STRINGIFY(SCST_BUILD_NUMBER)
|
||||
#else
|
||||
#define SCST_BUILD_NUMBER_STRING ""
|
||||
#endif
|
||||
|
||||
#ifdef SCST_ARCH_TYPE
|
||||
#define SCST_ARCH_TYPE_STRING SCST_STRINGIFY(SCST_ARCH_TYPE)
|
||||
#else
|
||||
#define SCST_ARCH_TYPE_STRING ""
|
||||
#endif
|
||||
|
||||
#define SCST_CONST_VERSION SCST_CONST_INTF_VER
|
||||
|
||||
@@ -15,8 +15,12 @@ ccflags-y := -I$(src)/../include \
|
||||
-fstack-protector-strong \
|
||||
-Wstrict-prototypes
|
||||
|
||||
ccflags-y += $(shell [ -n "${CONFIG_SCST_NO_DLM}" ] && echo -DCONFIG_SCST_NO_DLM) \
|
||||
$(shell [ -n "${REVISION}" ] && echo -DSCST_REVISION=${REVISION})
|
||||
ccflags-y += $(shell [ -n "${CONFIG_SCST_NO_DLM}" ] && echo -DCONFIG_SCST_NO_DLM) \
|
||||
$(shell [ -n "${KVER}" ] && echo -DSCST_KVER=${KVER}) \
|
||||
$(shell [ -n "${BUILD_DATE}" ] && echo -DSCST_BUILD_DATE=${BUILD_DATE}) \
|
||||
$(shell [ -n "${GIT_COMMIT}" ] && echo -DSCST_GIT_COMMIT=${GIT_COMMIT}) \
|
||||
$(shell [ -n "${BUILD_NUMBER}" ] && echo -DSCST_BUILD_NUMBER=${BUILD_NUMBER}) \
|
||||
$(shell [ -n "${ARCH_TYPE}" ] && echo -DSCST_ARCH_TYPE=${ARCH_TYPE})
|
||||
|
||||
#ccflags-y += -DCONFIG_SCST_STRICT_SERIALIZING
|
||||
#ccflags-y += -DCONFIG_SCST_USE_EXPECTED_VALUES
|
||||
|
||||
@@ -2154,71 +2154,77 @@ static struct class_interface scst_interface = {
|
||||
.remove_dev = scst_remove,
|
||||
};
|
||||
|
||||
static void __init scst_print_config(void)
|
||||
bool scst_dump_config(char *buf, size_t len)
|
||||
{
|
||||
char buf[128];
|
||||
int i, j;
|
||||
ssize_t ret, pos;
|
||||
|
||||
i = snprintf(buf, sizeof(buf), "Enabled features: ");
|
||||
j = i;
|
||||
ret = scnprintf(buf, len, "SCST config: ");
|
||||
pos = ret;
|
||||
|
||||
#ifdef CONFIG_SCST_STRICT_SERIALIZING
|
||||
i += snprintf(&buf[i], sizeof(buf) - i, "STRICT_SERIALIZING");
|
||||
ret += scnprintf(buf + ret, len - ret, "%sSTRICT_SERIALIZING",
|
||||
ret == pos ? "" : ", ");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCST_EXTRACHECKS
|
||||
i += snprintf(&buf[i], sizeof(buf) - i, "%sEXTRACHECKS",
|
||||
(j == i) ? "" : ", ");
|
||||
ret += scnprintf(buf + ret, len - ret, "%sEXTRACHECKS",
|
||||
ret == pos ? "" : ", ");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCST_TRACING
|
||||
i += snprintf(&buf[i], sizeof(buf) - i, "%sTRACING",
|
||||
(j == i) ? "" : ", ");
|
||||
ret += scnprintf(buf + ret, len - ret, "%sTRACING",
|
||||
ret == pos ? "" : ", ");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCST_DEBUG
|
||||
i += snprintf(&buf[i], sizeof(buf) - i, "%sDEBUG",
|
||||
(j == i) ? "" : ", ");
|
||||
ret += scnprintf(buf + ret, len - ret, "%sDEBUG",
|
||||
ret == pos ? "" : ", ");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCST_DEBUG_TM
|
||||
i += snprintf(&buf[i], sizeof(buf) - i, "%sDEBUG_TM",
|
||||
(j == i) ? "" : ", ");
|
||||
ret += scnprintf(buf + ret, len - ret, "%sDEBUG_TM",
|
||||
ret == pos ? "" : ", ");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCST_DEBUG_RETRY
|
||||
i += snprintf(&buf[i], sizeof(buf) - i, "%sDEBUG_RETRY",
|
||||
(j == i) ? "" : ", ");
|
||||
ret += scnprintf(buf + ret, len - ret, "%sDEBUG_RETRY",
|
||||
ret == pos ? "" : ", ");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCST_DEBUG_OOM
|
||||
i += snprintf(&buf[i], sizeof(buf) - i, "%sDEBUG_OOM",
|
||||
(j == i) ? "" : ", ");
|
||||
ret += scnprintf(buf + ret, len - ret, "%sDEBUG_OOM",
|
||||
ret == pos ? "" : ", ");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCST_DEBUG_SN
|
||||
i += snprintf(&buf[i], sizeof(buf) - i, "%sDEBUG_SN",
|
||||
(j == i) ? "" : ", ");
|
||||
ret += scnprintf(buf + ret, len - ret, "%sDEBUG_SN",
|
||||
ret == pos ? "" : ", ");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCST_USE_EXPECTED_VALUES
|
||||
i += snprintf(&buf[i], sizeof(buf) - i, "%sUSE_EXPECTED_VALUES",
|
||||
(j == i) ? "" : ", ");
|
||||
ret += scnprintf(buf + ret, len - ret, "%sUSE_EXPECTED_VALUES",
|
||||
ret == pos ? "" : ", ");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCST_TEST_IO_IN_SIRQ
|
||||
i += snprintf(&buf[i], sizeof(buf) - i,
|
||||
"%sTEST_IO_IN_SIRQ",
|
||||
(j == i) ? "" : ", ");
|
||||
ret += scnprintf(buf + ret, len - ret, "%sTEST_IO_IN_SIRQ",
|
||||
ret == pos ? "" : ", ");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCST_STRICT_SECURITY
|
||||
i += snprintf(&buf[i], sizeof(buf) - i, "%sSTRICT_SECURITY",
|
||||
(j == i) ? "" : ", ");
|
||||
ret += scnprintf(buf + ret, len - ret, "%sSTRICT_SECURITY",
|
||||
ret == pos ? "" : ", ");
|
||||
#endif
|
||||
|
||||
if (j != i)
|
||||
PRINT_INFO("%s", buf);
|
||||
return ret != pos;
|
||||
}
|
||||
|
||||
static inline void __init scst_print_config(void)
|
||||
{
|
||||
char config[SCST_CONFIG_BUF_SIZE] = {};
|
||||
|
||||
if (scst_dump_config(config, sizeof(config)))
|
||||
PRINT_INFO("%s", config);
|
||||
}
|
||||
|
||||
static void scst_suspended(struct percpu_ref *ref)
|
||||
@@ -2462,13 +2468,18 @@ static int __init init_scst(void)
|
||||
goto out_thread_free;
|
||||
|
||||
#ifdef CONFIG_SCST_NO_TOTAL_MEM_CHECKS
|
||||
PRINT_INFO("SCST version %s (revision=%s) loaded successfully (global max mem for commands ignored, per device %dMB)",
|
||||
SCST_VERSION_STRING, SCST_REVISION_STRING, scst_max_dev_cmd_mem);
|
||||
PRINT_INFO("SCST loaded successfully (global max mem for commands ignored, per device %dMB)",
|
||||
scst_max_dev_cmd_mem);
|
||||
#else
|
||||
PRINT_INFO("SCST version %s (revision=%s) loaded successfully (max mem for commands %dMB, per device %dMB)",
|
||||
SCST_VERSION_STRING, SCST_REVISION_STRING, scst_max_cmd_mem, scst_max_dev_cmd_mem);
|
||||
PRINT_INFO("SCST loaded successfully (max mem for commands %dMB, per device %dMB)",
|
||||
scst_max_cmd_mem, scst_max_dev_cmd_mem);
|
||||
#endif
|
||||
|
||||
PRINT_INFO("SCST version: %s", SCST_VERSION_STRING);
|
||||
PRINT_INFO("SCST kver: %s", SCST_KVER_STRING);
|
||||
PRINT_INFO("SCST build date: %s", SCST_BUILD_DATE_STRING);
|
||||
PRINT_INFO("SCST git commit sha1: %s", SCST_GIT_COMMIT_STRING);
|
||||
PRINT_INFO("SCST build number: %s", SCST_BUILD_NUMBER_STRING);
|
||||
PRINT_INFO("SCST arch type: %s", SCST_ARCH_TYPE_STRING);
|
||||
scst_print_config();
|
||||
|
||||
out:
|
||||
@@ -2621,4 +2632,8 @@ MODULE_AUTHOR("Vladislav Bolkhovitin");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_DESCRIPTION("SCSI target core");
|
||||
MODULE_VERSION(SCST_VERSION_STRING);
|
||||
MODULE_INFO(revision, SCST_REVISION_STRING);
|
||||
MODULE_INFO(kver, SCST_KVER_STRING);
|
||||
MODULE_INFO(build_date, SCST_BUILD_DATE_STRING);
|
||||
MODULE_INFO(git_commit, SCST_GIT_COMMIT_STRING);
|
||||
MODULE_INFO(build_number, SCST_BUILD_NUMBER_STRING);
|
||||
MODULE_INFO(arch_type, SCST_ARCH_TYPE_STRING);
|
||||
|
||||
@@ -392,6 +392,10 @@ int scst_process_check_condition(struct scst_cmd *cmd);
|
||||
|
||||
int scst_assign_dev_handler(struct scst_device *dev, struct scst_dev_type *handler);
|
||||
|
||||
#define SCST_CONFIG_BUF_SIZE (128 + 1)
|
||||
|
||||
bool scst_dump_config(char *buf, size_t len);
|
||||
|
||||
struct scst_session *scst_alloc_session(struct scst_tgt *tgt, gfp_t gfp_mask,
|
||||
const char *initiator_name);
|
||||
void scst_free_session(struct scst_session *sess);
|
||||
|
||||
@@ -7438,58 +7438,34 @@ static ssize_t scst_version_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
char config[SCST_CONFIG_BUF_SIZE] = {};
|
||||
ssize_t ret = 0;
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%s (revision=%s)\n",
|
||||
SCST_VERSION_STRING, SCST_REVISION_STRING);
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST version: %s\n",
|
||||
SCST_VERSION_STRING);
|
||||
|
||||
#ifdef CONFIG_SCST_STRICT_SERIALIZING
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "STRICT_SERIALIZING\n");
|
||||
#endif
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST kver: %s\n",
|
||||
SCST_KVER_STRING);
|
||||
|
||||
#ifdef CONFIG_SCST_EXTRACHECKS
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "EXTRACHECKS\n");
|
||||
#endif
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST build date: %s\n",
|
||||
SCST_BUILD_DATE_STRING);
|
||||
|
||||
#ifdef CONFIG_SCST_TRACING
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "TRACING\n");
|
||||
#endif
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST git commit sha1: %s\n",
|
||||
SCST_GIT_COMMIT_STRING);
|
||||
|
||||
#ifdef CONFIG_SCST_DEBUG
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "DEBUG\n");
|
||||
#endif
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST build number: %s\n",
|
||||
SCST_BUILD_NUMBER_STRING);
|
||||
|
||||
#ifdef CONFIG_SCST_DEBUG_TM
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "DEBUG_TM\n");
|
||||
#endif
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST arch type: %s\n",
|
||||
SCST_ARCH_TYPE_STRING);
|
||||
|
||||
#ifdef CONFIG_SCST_DEBUG_RETRY
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "DEBUG_RETRY\n");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCST_DEBUG_OOM
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "DEBUG_OOM\n");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCST_DEBUG_SN
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "DEBUG_SN\n");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCST_USE_EXPECTED_VALUES
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "USE_EXPECTED_VALUES\n");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCST_TEST_IO_IN_SIRQ
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "TEST_IO_IN_SIRQ\n");
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCST_STRICT_SECURITY
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "STRICT_SECURITY\n");
|
||||
#endif
|
||||
if (scst_dump_config(config, sizeof(config)))
|
||||
ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%s\n", config);
|
||||
|
||||
TRACE_EXIT();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,24 @@
|
||||
ifndef PREFIX
|
||||
PREFIX=/usr/local
|
||||
PREFIX=/usr/local
|
||||
endif
|
||||
|
||||
REVISION ?= $(shell if [ -e .git ]; then echo -n .; git rev-parse --short HEAD 2>/dev/null; fi)
|
||||
VERSION = $(shell echo -n "$$(sed -n 's/^[[:blank:]]*\$$VERSION[[:blank:]]*=[[:blank:]]*[\"'"'"']\([0-9.]*\)[\"'"'"'];$$/\1/p' scstadmin/scst-*/lib/SCST/SCST.pm)$(REVISION)")
|
||||
GIT_COMMIT := $(shell git rev-parse --short=12 HEAD 2>/dev/null)
|
||||
|
||||
ifndef BUILD_NUMBER
|
||||
BUILD_NUMBER := $(shell git rev-list --count HEAD 2>/dev/null || echo 0)
|
||||
endif
|
||||
|
||||
RELEASE_VERSION := $(shell echo -n "$$(sed -n 's/^[[:blank:]]*\$$VERSION[[:blank:]]*=[[:blank:]]*[\"'"'"']\([0-9.]*\)[\"'"'"'];$$/\1/p' scstadmin/scst-*/lib/SCST/SCST.pm)")
|
||||
|
||||
ifndef REVISION
|
||||
ifneq ($(GIT_COMMIT),)
|
||||
REVISION := $(BUILD_NUMBER).$(GIT_COMMIT)
|
||||
else
|
||||
REVISION := $(BUILD_NUMBER)
|
||||
endif
|
||||
endif
|
||||
|
||||
VERSION := $(RELEASE_VERSION).$(REVISION)
|
||||
|
||||
SCSTADMIN_DIR = $(shell if [ ! -h scstadmin ]; then \
|
||||
rm -f scstadmin; \
|
||||
|
||||
Reference in New Issue
Block a user