[Buildroot] [PATCH] utils/checkpackagelib/lib_mk.py: handle 'else' and 'elif' statements
Thomas Petazzoni
thomas.petazzoni at bootlin.com
Sat Jan 2 12:55:05 UTC 2021
On Wed, 9 Dec 2020 16:32:18 +0100
Thomas De Schampheleire <patrickdepinguin at gmail.com> wrote:
> From: Thomas De Schampheleire <thomas.de_schampheleire at nokia.com>
>
> An 'else' or 'elif' clause inside a make conditional should not be indented
> in the same way as the if/endif clause. check-package did not recognize the
> else statement and expected an indentation.
>
> For example:
>
> ifdef FOOBAR
> interesting
> else
> more interesting
> endif
>
> would, according to check-package, need to become:
>
> ifdef FOOBAR
> interesting
> else
> more interesting
> endif
>
> Treat 'else' and 'elif' the same as if-like keywords in the Indent test, but
> take into account that 'else' is also valid shell, so we need to correctly
> handle line continuation to prevent complaining about the 'else' in:
>
> ifdef FOOBAR
> if true; \
> ... \
> else \
> ... \
> fi
> endif
>
> We don't add the 'else' and 'elif' statements to start_conditional, because
> it would cause incorrect nesting counting in class OverriddenVariable.
>
> Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire at nokia.com>
> ---
> utils/checkpackagelib/lib_mk.py | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
More information about the buildroot
mailing list