[DRBD-cvs] svn commit by lars - r2545 - in trunk: . drbd scripts - the definition of UTS_RELEASE has been moved in 2.6.18

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Wed Oct 18 22:17:59 CEST 2006


Author: lars
Date: 2006-10-18 22:17:58 +0200 (Wed, 18 Oct 2006)
New Revision: 2545

Added:
   trunk/scripts/get_uts_release.sh
Modified:
   trunk/Makefile
   trunk/drbd.spec.in
   trunk/drbd/Makefile
Log:
the definition of UTS_RELEASE has been moved in 2.6.18
fix the Makefiles to find it anyways, and while at it,
be aware of the O=some-where-else kbuild variable.


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2006-10-18 16:55:45 UTC (rev 2544)
+++ trunk/Makefile	2006-10-18 20:17:58 UTC (rev 2545)
@@ -159,10 +159,10 @@
 all tools doc .filelist: drbd/drbd_buildtag.c
 
 KDIR := $(shell echo /lib/modules/`uname -r`/build)
-KVER := $(shell \
-	echo -e "\#include <linux/version.h>\ndrbd_kernel_release UTS_RELEASE" | \
-        gcc -nostdinc -E -P -I$(KDIR)/include - 2>&1 | \
-        sed -ne 's/^drbd_kernel_release "\(.*\)".*/\1/p')
+KVER := $(shell KDIR=$(KDIR) O=$(O) scripts/get_uts_release.sh)
+ifeq ($(KVER),)
+$(error "could not determine uts_release")
+endif
 
 kernel-patch: drbd/drbd_buildtag.c
 	set -o errexit; \

Modified: trunk/drbd/Makefile
===================================================================
--- trunk/drbd/Makefile	2006-10-18 16:55:45 UTC (rev 2544)
+++ trunk/drbd/Makefile	2006-10-18 20:17:58 UTC (rev 2545)
@@ -118,16 +118,19 @@
 # $(MAKE) -C $(KDIR) M=$(DRBDSRC) $(ARCH_UM) modules
 	-mv .drbd_kernelrelease.new .drbd_kernelrelease
 	@echo -n "Memorizing module configuration ... "
-	@{ echo -e "#\n# drbd.o was compiled with"          ; \
+	@config=$$( (for x in $(KDIR)/.config $(O)/.config ; do \
+	       if test -e $$x ; then echo $$x ; exit 0; fi ; \
+	       done; echo $(KDIR)/.config) | sed -e 's,//,/,g') ; \
+	{ echo -e "#\n# drbd.o was compiled with"          ; \
 	  echo "#  `gcc -v 2>&1 | tail -1`"                 ; \
 	  echo "# against this kernelrelease:"              ; \
 	  sed 's/^/#  /' .drbd_kernelrelease                ; \
 	  echo    "# kernel .config from"                   ; \
-	  echo -n "#  $(KDIR)/.config"                      ; \
-	  test -L "$(KDIR)" && echo "	alias"   &&           \
-	  echo "#  $$(readlink $(KDIR))/.config" || echo "" ; \
+	  echo -n "#  $$config"                      ; \
+	  test -L "$${config%/.config}" && echo "	alias"   &&           \
+	  echo "#  $$(readlink $${config%/.config})/.config" || echo "" ; \
 	  echo -e "# follows\n#\n"                          ; \
-	  cat $(KDIR)/.config ; } | gzip > .kernel.config.gz
+	  cat $$config ; } | gzip > .kernel.config.gz
 	@echo "done."
 
   clean:

Modified: trunk/drbd.spec.in
===================================================================
--- trunk/drbd.spec.in	2006-10-18 16:55:45 UTC (rev 2544)
+++ trunk/drbd.spec.in	2006-10-18 20:17:58 UTC (rev 2545)
@@ -64,9 +64,7 @@
 %prep
 %setup
 test -d %{kdir}/.
-test $(echo -e "#include <linux/version.h>\ndrbd_kernel_release UTS_RELEASE" |
-       gcc -nostdinc -E -P -I%{kdir}/include - |
-       sed -ne 's/^drbd_kernel_release "\(.*\)".*/\1/p') = %{kernelversion}
+test "$(scripts/get_uts_release.sh)" = %{kernelversion}
 
 %build
 echo kernelversion=%{kernelversion}

Added: trunk/scripts/get_uts_release.sh
===================================================================
--- trunk/scripts/get_uts_release.sh	2006-10-18 16:55:45 UTC (rev 2544)
+++ trunk/scripts/get_uts_release.sh	2006-10-18 20:17:58 UTC (rev 2545)
@@ -0,0 +1,12 @@
+#!/bin/bash
+{ 
+    for x in include/linux/{utsrelease,version}.h;
+    do
+        for d in $KDIR $O;
+        do
+            test -e "$d/$x" || continue;
+            echo "#include \"$d/$x\"";
+        done;
+    done;
+    echo "drbd_kernel_release UTS_RELEASE"
+} | gcc -nostdinc -E -P - | sed -ne 's/^drbd_kernel_release "\(.*\)".*/\1/p'


Property changes on: trunk/scripts/get_uts_release.sh
___________________________________________________________________
Name: svn:executable
   + *



More information about the drbd-cvs mailing list