build/rpc: Add git sha1 to SPDK version macro
Retrieve git sha1 during SPKD build, add sha1 to SPDK_VERSION_STRING macro and to spdk_get_version RPC method This might be useful for issues reporting/investigation Change-Id: I2bfed752839036bf914b546066ed4d23ef4c99b8 Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com> Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com> Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/474004 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
e4aee795c0
commit
2ad7573393
@ -1,8 +1,8 @@
|
||||
/*-
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright (c) Intel Corporation.
|
||||
* All rights reserved.
|
||||
* Copyright (c) Intel Corporation. All rights reserved.
|
||||
* Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -97,6 +97,14 @@
|
||||
#define SPDK_VERSION_PATCH_STRING ""
|
||||
#endif
|
||||
|
||||
#ifdef SPDK_GIT_COMMIT
|
||||
#define SPDK_GIT_COMMIT_STRING SPDK_VERSION_STRINGIFY(SPDK_GIT_COMMIT)
|
||||
#define SPDK_GIT_COMMIT_STRING_SHA1 " git sha1 " SPDK_GIT_COMMIT_STRING
|
||||
#else
|
||||
#define SPDK_GIT_COMMIT_STRING ""
|
||||
#define SPDK_GIT_COMMIT_STRING_SHA1 ""
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Human-readable version string.
|
||||
*/
|
||||
@ -105,6 +113,7 @@
|
||||
SPDK_VERSION_MAJOR_STRING \
|
||||
SPDK_VERSION_MINOR_STRING \
|
||||
SPDK_VERSION_PATCH_STRING \
|
||||
SPDK_VERSION_SUFFIX
|
||||
SPDK_VERSION_SUFFIX \
|
||||
SPDK_GIT_COMMIT_STRING_SHA1
|
||||
|
||||
#endif
|
||||
|
@ -1,8 +1,8 @@
|
||||
/*-
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright (c) Intel Corporation.
|
||||
* All rights reserved.
|
||||
* Copyright (c) Intel Corporation. All rights reserved.
|
||||
* Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -415,6 +415,9 @@ spdk_rpc_spdk_get_version(struct spdk_jsonrpc_request *request, const struct spd
|
||||
spdk_json_write_named_uint32(w, "minor", SPDK_VERSION_MINOR);
|
||||
spdk_json_write_named_uint32(w, "patch", SPDK_VERSION_PATCH);
|
||||
spdk_json_write_named_string_fmt(w, "suffix", "%s", SPDK_VERSION_SUFFIX);
|
||||
#ifdef SPDK_GIT_COMMIT
|
||||
spdk_json_write_named_string_fmt(w, "commit", "%s", SPDK_GIT_COMMIT_STRING);
|
||||
#endif
|
||||
spdk_json_write_object_end(w);
|
||||
|
||||
spdk_json_write_object_end(w);
|
||||
|
@ -212,6 +212,11 @@ COMMON_CFLAGS += -fsanitize=thread
|
||||
LDFLAGS += -fsanitize=thread
|
||||
endif
|
||||
|
||||
SPDK_GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null)
|
||||
ifneq (, $(SPDK_GIT_COMMIT))
|
||||
COMMON_CFLAGS += -DSPDK_GIT_COMMIT=$(SPDK_GIT_COMMIT)
|
||||
endif
|
||||
|
||||
COMMON_CFLAGS += -pthread
|
||||
LDFLAGS += -pthread
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user