Skip to contentSkip to conversation

CONFIG_LOCALVERSION_AUTO

2.6.16-rc6 New Mathis Ahrens 2 participants 4 messages Mar 15, 2006 – Mar 16, 2006 Kbuild

lore
Share & tools
lore
#0 lore raw

Hi all,

i just discovered this cute little feature, but had three minor issues while experimenting with it on 2.6.16-rc6:

1.
Semantics of LOCALVERSION are confusing and probably buggy. The Makefile states:

# Take the contents of any files called localversion* and the config

# variable CONFIG_LOCALVERSION and append them to KERNELRELEASE.
# LOCALVERSION from the command line override all of this

whereas my simplified view of current code is:

version = major + minor + patch + extra
release = version + localver-full
localver-full = localver + localver-auto
localver = <concat all localversions*> + $CONFIG_LOCALVERSION localver-auto = $LOCALVERSION + <some -gxxxxxx>

LOCALVERSION does not seem to /override/ anything if specified on the command line, but rather (with CONFIG_LOCALVERSION_AUTO=y) gets /inserted/.

Also, with CONFIG_LOCALVERSION_AUTO=n, specifying LOCALVERSION on the command line currently does nothing at all. This is a regression from 2.6.15, I suppose.

2.
"make kernelrelease" does not imply "make .kernelrelease", it only does cat the file .kernelrelease (or shows an error if it's not there).

This leads to the following IMHO slightly irritating behaviour

$ echo "LV1" > localversion
$ make kernelrelease
2.6.16-rc6LV1
$ echo "LV2" > localversion
$ make kernelrelease
2.6.16-rc6LV1

Is there a reason for this?

3.
The help of CONFIG_LOCALVERSION_AUTO reads:

Note: This requires Perl, and a git repository, but not necessarily the git or cogito tools to be installed.

Looking at scripts/setlocalversion, this does not seem to be correct anymore.

Cheers,
Mathis

#1 lore raw

PATCH 1/1 Makefile: localversion fix (was: [2.6.16-rc6] CONFIG_LOCALVERSION_AUTO)

Quoted 16 lines · Mathis Ahrens

1.
Semantics of LOCALVERSION are confusing and probably buggy. The Makefile states:

# Take the contents of any files called localversion* and the config

# variable CONFIG_LOCALVERSION and append them to KERNELRELEASE.
# LOCALVERSION from the command line override all of this

whereas my simplified view of current code is:

version = major + minor + patch + extra
release = version + localver-full
localver-full = localver + localver-auto
localver = <concat all localversions*> + $CONFIG_LOCALVERSION localver-auto = $LOCALVERSION + <some -gxxxxxx>

Quoted 8 lines

LOCALVERSION does not seem to /override/ anything if specified on the command line, but rather (with CONFIG_LOCALVERSION_AUTO=y) gets /inserted/.

Also, with CONFIG_LOCALVERSION_AUTO=n, specifying LOCALVERSION on the command line currently does nothing at all. This is a regression from 2.6.15, I suppose.

Hmm, no comments on this?
I am not sure if different behaviour is desired, but here goes my proposal:

From: Mathis Ahrens <[email protected]>

Fix Makefile to honor LOCALVERSION if specified on the command line. Make it then replace any other localversions from files, CONFIG_LOCALVERSION or CONFIG_LOCALVERSION_AUTO.

Makefile 2006-03-16 18:10:38.000000000 +0100 renamed from Makefile.orig 2006-03-15 01:49:26.000000000 +0100 +0 -0
@@ -760,22 +760,27 @@ $(vmlinux-dirs): prepare scripts
 # The KERNELRELEASE is stored in a file named .kernelrelease
 # to be used when executing for example make install or make

modules_install
#
-# Take the contents of any files called localversion* and the config -# variable CONFIG_LOCALVERSION and append them to KERNELRELEASE. -# LOCALVERSION from the command line override all of this +# If LOCALVERSION from the command line is not empty, that is +# appended to the KERNELRELEASE.
+#
+# Else we append in that order

+#     - the contents of any files called localversion*
+#     - the config variable CONFIG_LOCALVERSION
+#     - if CONFIG_LOCALVERSION_AUTO is set, another scm-specific string

nullstring :=
space := $(nullstring) # end of line

-___localver = $(objtree)/localversion* $(srctree)/localversion* -__localver = $(sort $(wildcard $(___localver))) +__localver-filelist = $(objtree)/localversion* $(srctree)/localversion* +_localver-filelist = $(sort $(wildcard $(__localver-filelist)))

 # skip backup files (containing '~')
-_localver = $(foreach f, $(__localver), $(if $(findstring ~, $(f)),,$(f)))
+localver-filelist = $(foreach f, $(_localver-filelist), \
+                    $(if $(findstring ~, $(f)),,$(f)))
+
+localver-files = $(subst $(space),, $(shell cat /dev/null
$(localver-filelist)))
+localver-conf = $(subst $(space),, $(patsubst
"%",%,$(CONFIG_LOCALVERSION)))
+

-localver = $(subst $(space),, \
- $(shell cat /dev/null $(_localver)) \
- $(patsubst "%",%,$(CONFIG_LOCALVERSION)))
-
# If CONFIG_LOCALVERSION_AUTO is set scripts/setlocalversion is called

 # and if the SCM is know a tag from the SCM is appended.
 # The appended tag is determinded by the SCM used.
@@ -784,12 +789,15 @@ localver = $(subst $(space),, \
 # Other SCMs can edit scripts/setlocalversion and add the appropriate
 # checks as needed.
 ifdef CONFIG_LOCALVERSION_AUTO
-    _localver-auto = $(shell $(CONFIG_SHELL) \
+    localver-auto = $(shell $(CONFIG_SHELL) \
                       $(srctree)/scripts/setlocalversion $(srctree))
-    localver-auto  = $(LOCALVERSION)$(_localver-auto)
 endif

-localver-full = $(localver)$(localver-auto)
+ifeq ($(LOCALVERSION),)
+ localver-full = $(localver-files)$(localver-conf)$(localver-auto)
+else
+ localver-full = $(subst $(space),, $(LOCALVERSION))
+endif

# Store (new) KERNELRELASE string in .kernelrelease kernelrelease = $(KERNELVERSION)$(localver-full)

#2 lore raw
In reply to Mathis Ahrens
Quoted 22 lines · Mathis Ahrens

Hi all,

i just discovered this cute little feature, but had three minor issues while experimenting with it on 2.6.16-rc6:

1.
Semantics of LOCALVERSION are confusing and probably buggy. The Makefile states:

# Take the contents of any files called localversion* and the config

# variable CONFIG_LOCALVERSION and append them to KERNELRELEASE.
# LOCALVERSION from the command line override all of this

whereas my simplified view of current code is:

version = major + minor + patch + extra
release = version + localver-full
localver-full = localver + localver-auto
localver = <concat all localversions*> + $CONFIG_LOCALVERSION localver-auto = $LOCALVERSION + <some -gxxxxxx>

Quoted 7 lines

LOCALVERSION does not seem to /override/ anything if specified on the command line, but rather (with CONFIG_LOCALVERSION_AUTO=y) gets /inserted/.

Also, with CONFIG_LOCALVERSION_AUTO=n, specifying LOCALVERSION on the command line currently does nothing at all. This is a regression from 2.6.15, I suppose.

This is a bug.
I will fix that for 2.6.17.

Quoted 5 lines

2.
"make kernelrelease" does not imply "make .kernelrelease", it only does cat the file .kernelrelease (or shows an error if it's not there).

This leads to the following IMHO slightly irritating behaviour

Quoted 8 lines
$ echo "LV1" > localversion
$ make kernelrelease
2.6.16-rc6LV1
$ echo "LV2" > localversion
$ make kernelrelease
2.6.16-rc6LV1

Is there a reason for this?

make kernelrelase shall work in both a read-only environment and shall avoid modifying files when run as another user.
So the simple measure was to error out only if .kernelrelease was missing.

The trick here seems to print $(KERNELVERSION)$(localver-full) but only if .kernelrelease is present.
On the other hand if .kernelrelase and $(KERNELVERSION)$(localver-full) differ then what to print.
The kernelrelease of the kernel or how it is configured?

echo -sam > locelversion does NOT change the kernel.
The kernelrealse of the kernel is only changed after running 'make'. And this is what we want to see - the kernelrelase of the kernel, not what happes to be stored in a file after the kernel was compiled.

Quoted 9 lines

3.
The help of CONFIG_LOCALVERSION_AUTO reads:

Note: This requires Perl, and a git repository, but not necessarily the git or cogito tools to be installed.

Looking at scripts/setlocalversion, this does not seem to be correct anymore.

Thanks. Will be fixed.

Sam

#3 lore raw
Quoted 9 lines · Sam Ravnborg
Quoted 4 lines · Mathis Ahrens

1.
Semantics of LOCALVERSION are confusing and probably buggy. [...]

This is a bug.
I will fix that for 2.6.17.

Cool, thanks.

Quoted 4 lines
Quoted 4 lines

2.
"make kernelrelease" does not imply "make .kernelrelease", it only does cat the file .kernelrelease (or shows an error if it's not there).

Oh, I notice that I have been dumb here. Of course make kernelrelease should not depend on make .kernelrelease or alter .kernelrelease in any way.

Quoted 8 lines
Quoted 8 lines

This leads to the following IMHO slightly irritating behaviour

$ echo "LV1" > localversion
$ make kernelrelease
2.6.16-rc6LV1
$ echo "LV2" > localversion
$ make kernelrelease
2.6.16-rc6LV1
Quoted 7 lines
Quoted 2 lines

Is there a reason for this?

make kernelrelase shall work in both a read-only environment and shall avoid modifying files when run as another user.
So the simple measure was to error out only if .kernelrelease was missing.

But then - for this I would use cat .kernelrelease ?

Quoted 6 lines

The trick here seems to print $(KERNELVERSION)$(localver-full) but only if .kernelrelease is present.
On the other hand if .kernelrelase and $(KERNELVERSION)$(localver-full) differ then what to print.
The kernelrelease of the kernel or how it is configured?

Yes, these may be different, and both are interesting:
1. What name would I get if I started building now.
2. Assuming I did not modify anything since the last build, what was it named?

Quoted 5 lines

echo -sam > locelversion does NOT change the kernel.
The kernelrealse of the kernel is only changed after running 'make'. And this is what we want to see - the kernelrelase of the kernel, not what happes to be stored in a file after the kernel was compiled.

Right. Only I get this also with cat .kernelrelease. That's why my intuition said, make kernelrelease probably prints the string
that *would* be appended, based on all the knowledge in the Makefile.

After all, this is interesting, since that composition is not trivial, and the
logic is inside the Makefile.

Maybe this could be made another target?
make upcomingrelease (-;

Cheers,
Mathis