kbuild: correctly skip tilded backups in localversion files
PATCH 1/1 kbuild: correctly skip tilded backups in localversion files
kbuild: correctly skip tilded backups 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.
---
Another try.
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.
Makefile | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
Makefile renamed from Makefile~4tilde-backups~ +5 -10
@@ -777,5 +777,5 @@ $(vmlinux-dirs): prepare scripts # $(localver-full) # $(localver) -# localversion* (all localversion* files) +# localversion* (files, without backups containing '~') # $(CONFIG_LOCALVERSION) (from kernel config setting) # $(localver-auto) (only if CONFIG_LOCALVERSION_AUTO is set)
@@ -788,14 +788,9 @@ $(vmlinux-dirs): prepare scripts # 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))) - +localversion = $(objtree)/localversion $(srctree)/localversion +ext_versions = $(objtree)/localversion[^~]* $(srctree)/localversion[!~]* +versions = $(localversion) $(ext_versions) localver = $(subst $(space),, \ - $(shell cat /dev/null $(_localver)) \ + $(shell cat /dev/null $(sort $(wildcard $(versions)))) \ $(patsubst "%",%,$(CONFIG_LOCALVERSION)))
PATCH 1/1 update for (kbuild: correctly skip tilded backups in localversion files)
kbuild: finally correctly skip tilded backups in localversion files
---
Final addition. Why i want to maximize usage of shell, rather, than `make'? Just because i think, it's more portable, clear way.
Thanks.
Makefile renamed from Makefile~4tilde-backups~ +6 -6
@@ -788,10 +788,10 @@ $(vmlinux-dirs): prepare scripts # scripts/setlocalversion and add the appropriate checks as needed. -localversion = $(objtree)/localversion $(srctree)/localversion -ext_versions = $(objtree)/localversion[^~]* $(srctree)/localversion[!~]* -versions = $(localversion) $(ext_versions) -localver = $(subst $(space),, \ - $(shell cat /dev/null $(sort $(wildcard $(versions)))) \ - $(patsubst "%",%,$(CONFIG_LOCALVERSION))) +pattern = ".*/localversion[^~]*" +string = $(shell cat /dev/null \ + `find $(objtree) $(srctree) -maxdepth 1 -regex $(pattern) | sort`) + +localver = $(subst $(space),, $(string) \ + $(patsubst "%",%,$(CONFIG_LOCALVERSION))) # If CONFIG_LOCALVERSION_AUTO is set scripts/setlocalversion is called
Quoted 1 line · On Wed, 31 Jan 2007 07:11:04 +0000 Oleg Verych <[email protected]> wrote:
kbuild: correctly skip tilded backups in localversion files
Does this patch replace Bastian's patch, below?
From: Bastian Blank <[email protected]>
Fix the problem that localversion files were 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.
---
Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
Makefile renamed from Makefile~kbuild-dont-ignore-localversion-files-if-the-path-includes-a +1 -1
@@ -793,7 +793,7 @@ space := $(nullstring) # end of lin ___localver = $(objtree)/localversion* $(srctree)/localversion* __localver = $(sort $(wildcard $(___localver))) # skip backup files (containing '~') -_localver = $(foreach f, $(__localver), $(if $(findstring ~, $(f)),,$(f))) +_localver = $(foreach f, $(__localver), $(if $(findstring ~, $(notdir $(f))),,$(f))) localver = $(subst $(space),, \ $(shell cat /dev/null $(_localver)) \
_
Quoted 6 lines · Andrew Morton
Quoted 1 line · On Wed, 31 Jan 2007 07:11:04 +0000 Oleg Verych <[email protected]> wrote:
kbuild: correctly skip tilded backups in localversion files
Does this patch replace Bastian's patch, below?
Along with "Message-ID: <[email protected]>" -- yes.
Note, that they also make a little bit of cleanup to top makefile's mess, And, i think, have more elegant, portable, clean solution.
Roman commented on another my patch, saying, that tilde in the end isn't the only way to name backups. Filename, containing '~' is a backup in the sources, thus i'm proposing new patch.
Unfortunately still no more comments from anybody. Roman joined, but seems busy now, to comment on such minor stuff.
Anyway, thanks.
Quoted 32 lines
From: Bastian Blank <[email protected]>
Fix the problem that localversion files were 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.
Cc Sam Ravnborg <[email protected]>Cc Roman Zippel <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)diff -puN Makefile~kbuild-dont-ignore-localversion-files-if-the-path-includes-a
MakefileMakefile renamed from Makefile~kbuild-dont-ignore-localversion-files-if-the-path-includes-a +1
-1@@ -793,7 +793,7 @@ space := $(nullstring) # end of lin ___localver = $(objtree)/localversion* $(srctree)/localversion* __localver = $(sort $(wildcard $(___localver))) # skip backup files (containing '~') -_localver = $(foreach f, $(__localver), $(if $(findstring ~, $(f)),,$(f))) +_localver = $(foreach f, $(__localver), $(if $(findstring ~, $(notdir $(f))),,$(f))) localver = $(subst $(space),, \ $(shell cat /dev/null $(_localver)) \_
Quoted 10 lines · On Thu, 1 Feb 2007 03:37:17 +0100 Oleg Verych <[email protected]> wrote:
Quoted 6 lines · Andrew Morton
Quoted 1 line · On Wed, 31 Jan 2007 07:11:04 +0000 Oleg Verych <[email protected]> wrote:
kbuild: correctly skip tilded backups in localversion files
Does this patch replace Bastian's patch, below?
Along with "Message-ID: <[email protected]>" -- yes.
OK. Just to avoid mistakes, can you please resend everything, against 2.6.20-rc7?
2.6.20-rc7 (Re: [patch] kbuild: correctly skip tilded backups in localversion files)
kbuild: correctly skip tilded backups in localversion files
Tildes as in path as in filenames are handled correctly now:
only files, containing tilde '~', are backups, thus are not valid.
[KJ]:
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.
---
My using of the `sh' rides from willing to have more portable, understandable implementation (and due to GFDL make's docs ;)
Original report 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.
--- linux-2.6.20-rc7/Makefile | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
linux-2.6.20-rc7/Makefile +6 -11
@@ -777,5 +777,5 @@ $(vmlinux-dirs): prepare scripts # $(localver-full) # $(localver) -# localversion* (all localversion* files) +# localversion* (files without backups, containing '~') # $(CONFIG_LOCALVERSION) (from kernel config setting) # $(localver-auto) (only if CONFIG_LOCALVERSION_AUTO is set)
@@ -788,15 +788,10 @@ $(vmlinux-dirs): prepare scripts # scripts/setlocalversion and add the appropriate checks as needed. -nullstring := -space := $(nullstring) # end of line +pattern = ".*/localversion[^~]*" +string = $(shell cat /dev/null \ + `find $(objtree) $(srctree) -maxdepth 1 -regex $(pattern) | sort`) -___localver = $(objtree)/localversion* $(srctree)/localversion* -__localver = $(sort $(wildcard $(___localver))) -# skip backup files (containing '~') -_localver = $(foreach f, $(__localver), $(if $(findstring ~, $(f)),,$(f))) - -localver = $(subst $(space),, \ - $(shell cat /dev/null $(_localver)) \ - $(patsubst "%",%,$(CONFIG_LOCALVERSION))) +localver = $(subst $(space),, $(string) \ + $(patsubst "%",%,$(CONFIG_LOCALVERSION))) # If CONFIG_LOCALVERSION_AUTO is set scripts/setlocalversion is called
Quoted 8 lines · Andrew Morton
Quoted 6 lines · On Thu, 1 Feb 2007 03:37:17 +0100 Oleg Verych <[email protected]> wrote:
Quoted 5 lines · Andrew Morton
Quoted 1 line · On Wed, 31 Jan 2007 07:11:04 +0000 Oleg Verych <[email protected]> wrote:
kbuild: correctly skip tilded backups in localversion files
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Does this patch replace Bastian's patch, below?
Along with "Message-ID: <[email protected]>" -- yes.
OK. Just to avoid mistakes, can you please resend everything, against 2.6.20-rc7?
I've resent patches, that i wanted to be in -mm, even without anyone, who can ack or even test them. But it seems, they not made it to lkml.
____