[Devel] [PATCH RHEL7 COMMIT] Makefile: properly generate KERNELRELEASE value

Konstantin Khorenko khorenko at virtuozzo.com
Tue Nov 17 08:24:21 PST 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.9.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.9.10
------>
commit 16857c67c0899f940979a8516bb30aa03b52f273
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Tue Nov 17 20:24:21 2015 +0400

    Makefile: properly generate KERNELRELEASE value
    
    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>
    Acked-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 Makefile | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 02d6a38..aa59447 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,17 @@ 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)
+  GIT_DIR := .git
+  ifneq ("$(wildcard $(GIT_DIR) )", "")
+    VZVERSION := $(shell git describe --abbrev=0 2>/dev/null | \
+		   sed -r 's/^.*\.vz7\.//')
+  else
+    VZVERSION := custom
+  endif
+
+  ifeq ($(EXTRAVERSION),)
+    EXTRAVERSION := -$(RHEL_RELEASE).ovz.$(VZVERSION)
+  endif
 endif
 
 # *DOCUMENTATION*


More information about the Devel mailing list