]> xenbits.xensource.com Git - libvirt.git/commitdiff
apibuild: Don't include the Copyright in the <description> of a module
authorPeter Krempa <pkrempa@redhat.com>
Thu, 3 Nov 2022 10:07:12 +0000 (11:07 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 3 Nov 2022 13:11:22 +0000 (14:11 +0100)
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>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
scripts/apibuild.py

index c232b4e2c8c886a0be0ca65bfe9a50e3d28feb06..9614709e6cd2bbae6a138d0b99db04baaff2ee8e 100755 (executable)
@@ -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