kbuild: fix tilded non backup files in localversion files

 Tildes as in path as in filenames are handled correctly now.

 Definition of `space' was removed, scripts/Kbuild.include has one.
 This definition was taken right from GNU make manual, while Kbuild's
 version is original.

Cc: Bastian Blank <[EMAIL PROTECTED]>
Cc: Sam Ravnborg <[EMAIL PROTECTED]>
Signed-off-by: Oleg Verych <[EMAIL PROTECTED]>
---
Original report and fix by Bastian Blank:

 The following patch fixes the problem that localversion files where
 ignored if the tree lives in a path which contains a ~. It changes the
 test to apply to the filename only.
 
 Debian allows versions which contains ~ in it. The upstream part of the
 version is in the directory name of the build tree and we got weird
 results because the localversion files was just got ignored in this
 case.
 
Test, note tildes also in src, build paths:
,-*- bash -*-
|[EMAIL PROTECTED]:/tmp/b~d$
|[EMAIL PROTECTED]:/tmp/b~d$ make mrproper > /dev/null
|[EMAIL PROTECTED]:/tmp/b~d$ make defconfig> /dev/null
|[EMAIL PROTECTED]:/tmp/b~d$ cat include/config/kernel.release
|cat: include/config/kernel.release: No such file or directory
|[EMAIL PROTECTED]:/tmp/b~d$ ls localversion*
|localversion  localversion~  localversion~buba
|[EMAIL PROTECTED]:/tmp/b~d$ make prepare
|make -C /mnt/work/app-src-build/kernel.org/_work/src/linux~2.6.20-rc5
|O=/dev/shm/b~d prepare
|  GEN     /dev/shm/b~d/Makefile
|  scripts/kconfig/conf -s arch/x86_64/Kconfig
|  Using
|/mnt/work/app-src-build/kernel.org/_work/src/linux~2.6.20-rc5 as
|source for kernel
|  GEN     /dev/shm/b~d/Makefile
|  CHK     include/linux/version.h
|  UPD     include/linux/version.h
|  CHK     include/linux/utsrelease.h
|  UPD     include/linux/utsrelease.h
|  SYMLINK include/asm -> include/asm-x86_64
|  CC      arch/x86_64/kernel/asm-offsets.s
|  GEN     include/asm-x86_64/asm-offsets.h
|[EMAIL PROTECTED]:/tmp/b~d$ cat include/config/kernel.release
|2.6.20-rc5-olecom-f+buba
|[EMAIL PROTECTED]:/tmp/b~d$ cat localversion~
|-BUG
|[EMAIL PROTECTED]:/tmp/b~d$ cat localversion~buba
|+buba
|[EMAIL PROTECTED]:/tmp/b~d$ cat localversion
|-olecom-f
|[EMAIL PROTECTED]:/tmp/b~d$
`-*-

--- linux~2.6.20-rc5/Makefile~localversion-with-tilde   2007-01-24 
01:02:43.000000000 +0100
+++ linux~2.6.20-rc5/Makefile   2007-01-24 03:57:40.353436750 +0100
@@ -777,5 +777,5 @@
 #      $(localver-full)
 #        $(localver)
-#          localversion*               (all localversion* files)
+#          localversion*               (all non backup localversion* files)
 #          $(CONFIG_LOCALVERSION)      (from kernel config setting)
 #        $(localver-auto)              (only if CONFIG_LOCALVERSION_AUTO is 
set)
@@ -788,12 +788,6 @@
 # scripts/setlocalversion and add the appropriate checks as needed.
 
-nullstring :=
-space      := $(nullstring) # end of line
-
-___localver = $(objtree)/localversion* $(srctree)/localversion*
-__localver  = $(sort $(wildcard $(___localver)))
-# skip backup files (containing '~')
-_localver = $(foreach f, $(__localver), $(if $(findstring ~, $(f)),,$(f)))
-
+__localver = $(objtree)/localversion* $(srctree)/localversion*
+_localver  = $(patsubst %~,,$(sort $(wildcard $(__localver))))
 localver = $(subst $(space),, \
           $(shell cat /dev/null $(_localver)) \

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
kbuild-devel mailing list
kbuild-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kbuild-devel

Reply via email to