Message ID | 20230203101739.526320-1-juerg.haefliger@canonical.com |
---|---|
State | New |
Headers | show |
Series | [Unstable/lunar] UBUNTU: [Packaging] annotations: Preserve single-line annotation rules | expand |
On Fri, Feb 03, 2023 at 11:17:39AM +0100, Juerg Haefliger wrote: > Currently, rules with notes are written out as separate lines, i. e., > one line for the policy and one line for the note, followed by an > empty line. The parser now supports single line rules so preserve that > style when writting out the rules. > > Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com> > --- > debian.raspi/config/annotations.dep | 0 > debian/scripts/misc/kconfig/annotations.py | 12 +++++++++--- > 2 files changed, 9 insertions(+), 3 deletions(-) > create mode 100644 debian.raspi/config/annotations.dep > > diff --git a/debian.raspi/config/annotations.dep b/debian.raspi/config/annotations.dep > new file mode 100644 > index 000000000000..e69de29bb2d1 ^ drop this maybe? -Andrea > diff --git a/debian/scripts/misc/kconfig/annotations.py b/debian/scripts/misc/kconfig/annotations.py > index 2bbc1413aeed..2673f193b6ba 100644 > --- a/debian/scripts/misc/kconfig/annotations.py > +++ b/debian/scripts/misc/kconfig/annotations.py > @@ -82,6 +82,7 @@ class Annotation(Config): > > m = re.match(r'.* note<(.*?)>', line) > if m: > + entry['oneline'] = match > match = True > entry['note'] = "'" + m.group(1).replace("'", '') + "'" > > @@ -288,11 +289,16 @@ class Annotation(Config): > if 'policy' in new_val: > val = dict(sorted(new_val['policy'].items())) > line = f"{conf : <47} policy<{val}>" > - tmp.write(line + "\n") > if 'note' in new_val: > val = new_val['note'] > - line = f"{conf : <47} note<{val}>" > - tmp.write(line + "\n\n") > + if new_val.get('oneline', False): > + # Single line > + line += f' note<{val}>' > + else: > + # Separate policy and note lines, > + # followed by an empty line > + line += f'\n{conf : <47} note<{val}>\n' > + tmp.write(line + "\n") > > # Replace annotations with the updated version > tmp.flush() > -- > 2.34.1 > > > -- > kernel-team mailing list > kernel-team@lists.ubuntu.com > https://lists.ubuntu.com/mailman/listinfo/kernel-team
On Sat, 4 Feb 2023 10:51:46 +0100 Andrea Righi <andrea.righi@canonical.com> wrote: > On Fri, Feb 03, 2023 at 11:17:39AM +0100, Juerg Haefliger wrote: > > Currently, rules with notes are written out as separate lines, i. e., > > one line for the policy and one line for the note, followed by an > > empty line. The parser now supports single line rules so preserve that > > style when writting out the rules. > > > > Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com> > > --- > > debian.raspi/config/annotations.dep | 0 > > debian/scripts/misc/kconfig/annotations.py | 12 +++++++++--- > > 2 files changed, 9 insertions(+), 3 deletions(-) > > create mode 100644 debian.raspi/config/annotations.dep > > > > diff --git a/debian.raspi/config/annotations.dep b/debian.raspi/config/annotations.dep > > new file mode 100644 > > index 000000000000..e69de29bb2d1 > > ^ drop this maybe? Meh. I'll resend. ...Juerg > -Andrea > > > diff --git a/debian/scripts/misc/kconfig/annotations.py b/debian/scripts/misc/kconfig/annotations.py > > index 2bbc1413aeed..2673f193b6ba 100644 > > --- a/debian/scripts/misc/kconfig/annotations.py > > +++ b/debian/scripts/misc/kconfig/annotations.py > > @@ -82,6 +82,7 @@ class Annotation(Config): > > > > m = re.match(r'.* note<(.*?)>', line) > > if m: > > + entry['oneline'] = match > > match = True > > entry['note'] = "'" + m.group(1).replace("'", '') + "'" > > > > @@ -288,11 +289,16 @@ class Annotation(Config): > > if 'policy' in new_val: > > val = dict(sorted(new_val['policy'].items())) > > line = f"{conf : <47} policy<{val}>" > > - tmp.write(line + "\n") > > if 'note' in new_val: > > val = new_val['note'] > > - line = f"{conf : <47} note<{val}>" > > - tmp.write(line + "\n\n") > > + if new_val.get('oneline', False): > > + # Single line > > + line += f' note<{val}>' > > + else: > > + # Separate policy and note lines, > > + # followed by an empty line > > + line += f'\n{conf : <47} note<{val}>\n' > > + tmp.write(line + "\n") > > > > # Replace annotations with the updated version > > tmp.flush() > > -- > > 2.34.1 > > > > > > -- > > kernel-team mailing list > > kernel-team@lists.ubuntu.com > > https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff --git a/debian.raspi/config/annotations.dep b/debian.raspi/config/annotations.dep new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/debian/scripts/misc/kconfig/annotations.py b/debian/scripts/misc/kconfig/annotations.py index 2bbc1413aeed..2673f193b6ba 100644 --- a/debian/scripts/misc/kconfig/annotations.py +++ b/debian/scripts/misc/kconfig/annotations.py @@ -82,6 +82,7 @@ class Annotation(Config): m = re.match(r'.* note<(.*?)>', line) if m: + entry['oneline'] = match match = True entry['note'] = "'" + m.group(1).replace("'", '') + "'" @@ -288,11 +289,16 @@ class Annotation(Config): if 'policy' in new_val: val = dict(sorted(new_val['policy'].items())) line = f"{conf : <47} policy<{val}>" - tmp.write(line + "\n") if 'note' in new_val: val = new_val['note'] - line = f"{conf : <47} note<{val}>" - tmp.write(line + "\n\n") + if new_val.get('oneline', False): + # Single line + line += f' note<{val}>' + else: + # Separate policy and note lines, + # followed by an empty line + line += f'\n{conf : <47} note<{val}>\n' + tmp.write(line + "\n") # Replace annotations with the updated version tmp.flush()
Currently, rules with notes are written out as separate lines, i. e., one line for the policy and one line for the note, followed by an empty line. The parser now supports single line rules so preserve that style when writting out the rules. Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com> --- debian.raspi/config/annotations.dep | 0 debian/scripts/misc/kconfig/annotations.py | 12 +++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 debian.raspi/config/annotations.dep