Re: [PATCH, v2] kbuild: Improve version string logic

Frans Pop
2009-10-14T21:56:39Z

On Wednesday 14 October 2009, David Rientjes wrote:
> On Tue, 13 Oct 2009, Linus Torvalds wrote:
> > Let's keep the old behavior by making the AUTO option an three-way
> > choice ("none", "short", "auto"), and making sure that it actually
> > takes work to choose "none" (and that "make oldconfig" doesn't choose
> > it unless you explicitly made the choice before - so people who just
> > re-use old .config files wouldn't get "none" by mistake).

I'm working on a patch that implements this; will post it later.

> I don't think you want to do that because it would require the .config
> to be posted on bug reports, for example, to determine the setting of
> CONFIG_LOCALVERSION_AUTO before you can interpret the kernel version.
> In other words, you wouldn't know that "2.6.32-rc4" is actually 200
> commits beyond the actual release unless you also know that the .config
> has CONFIG_LOCALVERSION_AUTO="none".

Even with this patch you can never be 100% sure of that, for example
because you cannot be 100% certain that a kernel was built from a tree
that's under revision control. The most *any* change can do is increase
the likelyhood that we get that information in the version number.

Will explain more in a different reply later.

> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
> Makefile | 32 ++++++++++++++++++++------------
> 1 files changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/Makefile b/Makefile
> --- a/Makefile
> +++ b/Makefile
> @@ -898,9 +898,13 @@ $(vmlinux-dirs): prepare scripts
> # $(localver)
> # localversion* (files without backups, containing '~')
> # $(CONFIG_LOCALVERSION) (from kernel config setting)
> -# $(localver-auto) (only if CONFIG_LOCALVERSION_AUTO is set)
> -# ./scripts/setlocalversion (SCM tag, if one exists)
> -# $(LOCALVERSION) (from make command line if provided)
> +# $(LOCALVERSION) (from make command line, if provided)
> +# $(localver-extra)
> +# $(scm-identifier) (unique SCM tag, if one exists)
> +# ./scripts/setlocalversion (only with CONFIG_LOCALVERSION_AUTO)
> +# .scmversion (only with CONFIG_LOCALVERSION_AUTO)
> +# + (only without CONFIG_LOCALVERSION_AUTO
> +# and repository is at non-tagged commit)
> #
> # Note how the final $(localver-auto) string is included *only* if the

You forgot to change the $(localver-auto) here; and maybe also remove that
leading space in this line.