Re: [PATCH] kbuild: Clean up and speed up the localversion logic

From: Nico Schottelius
Date: Tue Jun 22 2010 - 06:53:57 EST


Michal Marek [Thu, Jun 17, 2010 at 03:40:38PM +0200]:
> Now that we run scripts/setlocalversion during every build, it makes
> sense to move all the localversion logic there. This cleans up the
> toplevel Makefile and also makes sure that the script is called only
> once in 'make prepare' (previously, it would be called every time due to
> a variable expansion in an ifneq statement). No user-visible change is
> intended, unless one runs the setlocalversion script directly.

Sounds good in general.

> --- a/scripts/setlocalversion
> +++ b/scripts/setlocalversion
> @@ -10,73 +10,158 @@
> #
>
> usage() {
> - echo "Usage: $0 [srctree]" >&2
> + echo "Usage: $0 [--scm-only] [srctree]" >&2
> exit 1
> }

If more stuff like this is coming, we should probably rewrite
option handling. No need to change right now, but to keep in mind.

> -cd "${1:-.}" || usage
> +scm_only=false
> +srctree=.
> +if test "$1" = "--scm-only"; then
> + scm_only=true
> + shift
> +fi
> +if test $# -gt 0; then
> + srctree=$1

You probably want

srctree="$1"

to catch spaces and co. in the path.

Otherwise I just had a quick view over it, but seems to look good.

Nico

--
New PGP key: 7ED9 F7D3 6B10 81D7 0EC5 5C09 D7DC C8E4 3187 7DF0
Please resign, if you signed 9885188C or 8D0E27A4.

Currently moving *.schottelius.org to http://www.nico.schottelius.org/ ...

Attachment: pgp00000.pgp
Description: PGP signature