summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <pochu@debian.org>2023-03-20 13:23:25 +0100
committerEmilio Pozuelo Monfort <pochu@debian.org>2023-03-27 10:25:24 +0200
commit33c20cbe6e85d32c1701898354dbc08a7a29a477 (patch)
tree70229108343b942bb61e8745d7c763d67965222b /bin
parentb46022d88e991d5f909f7b36a28ba3d88fea8d55 (diff)
merge-cve-files: don't create a new Bug object
Replace the bug's annotations instead now that we can modify the object.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/merge-cve-files14
1 files changed, 7 insertions, 7 deletions
diff --git a/bin/merge-cve-files b/bin/merge-cve-files
index d1ca8fb91a..e016912b53 100755
--- a/bin/merge-cve-files
+++ b/bin/merge-cve-files
@@ -25,28 +25,28 @@ def merge_notes(bug, notes):
"""
Special support for StringAnnotations.
+ Merges notes into the bug's annotations.
+
notes is a list of extra string annotations for this CVE (bug),
and may be empty.
"""
new_notes = []
if not notes:
# nothing to merge
- return bug
+ return
tagged_notes = [note.description for note in notes]
bug_notes = [ann.description for ann in bug.annotations if isinstance(ann, StringAnnotation)]
# get the list items in tagged_notes which are not in bug_notes
new_strings = list(set(tagged_notes) - set(bug_notes))
if not new_strings:
- return bug
+ return
for new_ann in notes:
if new_ann.description in new_strings:
new_notes.append(new_ann)
bug_list = list(bug.annotations)
bug_list.extend(new_notes)
- mod_bug = Bug(
- bug.file, bug.header, tuple(bug_list)
- )
- return mod_bug
+
+ bug.annotations = bug_list
def merge_annotations(annotations, new_annotation):
@@ -142,7 +142,7 @@ for extra_bug in extra_data:
new_annotations = merge_annotations(new_annotations, extra_annotation)
bug = bug._replace(annotations=new_annotations)
- bug = merge_notes(bug, notes)
+ merge_notes(bug, notes)
data = [bug if bug.header.name == old_bug.header.name else old_bug for old_bug in data]
with open(main_list, 'w') as f:

© 2014-2024 Faster IT GmbH | imprint | privacy policy