[PATCH 3/5] apibuild: Don't include the Copyright in the <description> of a module

Peter Krempa posted 5 patches 3 years, 3 months ago
[PATCH 3/5] apibuild: Don't include the Copyright in the <description> of a module
Posted by Peter Krempa 3 years, 3 months ago
When building the top level description from a header file the
'parseTopComment' method of the 'CParser' would include all trailing
lines into the <description> field. This was designed to concatenate
multi-line descriptions, but unfortunately in all cases also included
the Copyright statement which followed.

Explicitly end the scanning of the header on a line which starts with
'Copyright (C)' and truncate the spaces from the end of the last item.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 scripts/apibuild.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/apibuild.py b/scripts/apibuild.py
index c232b4e2c8..4ded66bc02 100755
--- a/scripts/apibuild.py
+++ b/scripts/apibuild.py
@@ -721,6 +721,14 @@ class CParser:
                 item = m.group(1)
                 line = m.group(2).lstrip()

+            # don't include the Copyright in the last 'item'
+            if line.startswith("Copyright (C)"):
+                # truncate any whitespace originating from newlines
+                # before  the Copyright
+                if item:
+                    res[item] = res[item].rstrip()
+                break
+
             if item:
                 if item in res:
                     res[item] = res[item] + " " + line
-- 
2.37.3
Re: [PATCH 3/5] apibuild: Don't include the Copyright in the <description> of a module
Posted by Ján Tomko 3 years, 3 months ago
On a Thursday in 2022, Peter Krempa wrote:
>When building the top level description from a header file the
>'parseTopComment' method of the 'CParser' would include all trailing
>lines into the <description> field. This was designed to concatenate
>multi-line descriptions, but unfortunately in all cases also included
>the Copyright statement which followed.
>
>Explicitly end the scanning of the header on a line which starts with
>'Copyright (C)' and truncate the spaces from the end of the last item.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> scripts/apibuild.py | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
>diff --git a/scripts/apibuild.py b/scripts/apibuild.py
>index c232b4e2c8..4ded66bc02 100755
>--- a/scripts/apibuild.py
>+++ b/scripts/apibuild.py
>@@ -721,6 +721,14 @@ class CParser:
>                 item = m.group(1)
>                 line = m.group(2).lstrip()
>
>+            # don't include the Copyright in the last 'item'
>+            if line.startswith("Copyright (C)"):
>+                # truncate any whitespace originating from newlines
>+                # before  the Copyright

double space

Jano