[Devel] [PATCH rh7 1/2] Makefile: properly generate KERNELRELEASE value

Konstantin Khorenko khorenko at virtuozzo.com
Fri Nov 13 05:55:23 PST 2015


In case kernel is built from the tree (not with help of rpmbuild),
KERNELRELEASE env variable is not provided and should be
constructed from local git tags.

Generated KERNELRELEASE example:
"3.10.0-229.7.2.ovz.9.10-00001-g1da4621"

VZVERSION has been also aligned with format used in kernel.spec:
"9.10" instead of "ovz.9.10".

https://jira.sw.ru/browse/PSBM-34957

Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 02d6a38..0e9306d 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,13 @@ RHEL_DRM_SUBLEVEL = 7
 VZVERSION = ovz.custom
 
 ifeq ($(VZVERSION), ovz.custom)
-  VZVERSION := $(shell if [ -d ".git" ]; then git describe | sed -r 's/^.*\.vz7\./ovz./'; fi)
+  VZVERSION := $(shell if [ -d ".git" ]; then \
+  		 git describe --abbrev=0 2>/dev/null | \
+  		 sed -r 's/^.*\.vz7\.//'; fi)
+
+  ifeq ($(EXTRAVERSION),)
+    EXTRAVERSION := -$(RHEL_RELEASE).ovz.$(VZVERSION)
+  endif
 endif
 
 # *DOCUMENTATION*
-- 
1.8.3.1



More information about the Devel mailing list