NACK: [Unstable/Lunar][PATCH] UBUNTU: [Packaging] annotations: Use non-greedy policy match

Juerg Haefliger juerg.haefliger at canonical.com
Fri Feb 3 07:18:51 UTC 2023


Just realized that the new annotations file can't handle single line configs
properly. Need to fix that first.

...Juerg


> A single line can contain both policy and note sections, so use non-greedy
> matches for all sections.
> 
> Otherwise, a line like:
> 
> CONFIG_FOO   policy<{'arm64': 'm'}> note<LP: #123456>
> 
> results in:
> 
> Traceback (most recent call last):
>   File "debian/scripts/misc/kconfig/annotations.py", line 80, in _parse_body
>     entry['policy'] |= literal_eval(m.group(1))
>   File "/usr/lib/python3.10/ast.py", line 64, in literal_eval
>     node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
>   File "/usr/lib/python3.10/ast.py", line 50, in parse
>     return compile(source, filename, mode, flags,
>   File "<unknown>", line 1
>     {'arm64': 'm'}> note<LP: #123456
>                            ^
> SyntaxError: invalid syntax
> 
> Signed-off-by: Juerg Haefliger <juerg.haefliger at canonical.com>
> ---
>  debian/scripts/misc/kconfig/annotations.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/debian/scripts/misc/kconfig/annotations.py b/debian/scripts/misc/kconfig/annotations.py
> index 84dd4d26e6af..af963b76355b 100644
> --- a/debian/scripts/misc/kconfig/annotations.py
> +++ b/debian/scripts/misc/kconfig/annotations.py
> @@ -74,7 +74,7 @@ class Annotation(Config):
>                              entry = self.config[conf]
>                          else:
>                              entry = {'policy': {}}
> -                        m = re.match(r'.*policy<(.*)>', line)
> +                        m = re.match(r'.*policy<(.*?)>', line)
>                          if m:
>                              entry['policy'] |= literal_eval(m.group(1))
>                          else:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20230203/07316729/attachment.sig>


More information about the kernel-team mailing list