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

David Rientjes
2009-10-13T02:01:35Z

On Mon, 12 Oct 2009, Ingo Molnar wrote:

> diff --git a/Makefile b/Makefile
> index 927d7a3..5dab509 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -963,8 +963,6 @@ localver = $(subst $(space),, $(string) \
> # .scmversion is used when generating rpm packages so we do not loose
> # the version information from the SCM when we do the build of the kernel
> # from the copied source
> -ifdef CONFIG_LOCALVERSION_AUTO
> -
> ifeq ($(wildcard .scmversion),)
> _localver-auto = $(shell $(CONFIG_SHELL) \
> $(srctree)/scripts/setlocalversion $(srctree))
> @@ -972,7 +970,14 @@ else
> _localver-auto = $(shell cat .scmversion 2> /dev/null)
> endif
>
> +ifdef CONFIG_LOCALVERSION_AUTO
> localver-auto = $(LOCALVERSION)$(_localver-auto)
> +else
> + ifeq ($_localver-auto,)
> + localver-auto = $(LOCALVERSION)
> + else
> + localver-auto = $(LOCALVERSION)+
> + endif
> endif
>
> localver-full = $(localver)$(localver-auto)

I don't see where the `+' is dropped between -rc tags;
scripts/setlocalversion should return -00000-rc5 for v2.6.32-rc5, for
example, so _localver-auto will always be non-NULL and the `+' is
appended.

I think scripts/setlocalversion should also be modified as I earlier
suggested to suppress output when git-describe shows no additional
commits beyond the tag. Then, CONFIG_LOCALVERSION_AUTO would not be
v2.6.32-rc4-00000-rc4, for example, when 2.6.32-rc4 is released.

Your patch also adds the make LOCALVERSION= string to the version without
requiring CONFIG_LOCALVERSION_AUTO. That's a change from prior behavior,
but I think it's helpful for user-specified version tags.