diff options
author | Emilio Pozuelo Monfort <pochu@debian.org> | 2023-03-20 15:39:43 +0100 |
---|---|---|
committer | Emilio Pozuelo Monfort <pochu@debian.org> | 2023-03-27 10:25:24 +0200 |
commit | d2c8ae0ad681d005f50d2ca76b1de7dc2fe732eb (patch) | |
tree | 66f5b32d825235c290b0d0c31d26d5891809673e /bin | |
parent | c60cc24e47ae0c9532fa59676acabf8fbcba398f (diff) |
merge-cve-files: don't return the modified list
We no longer get a tuple, so there's no need to convert it to
a list and return it. The method just merges the annotation into
the received annotations.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/merge-cve-files | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/bin/merge-cve-files b/bin/merge-cve-files index 897eddabb4..8521eb6969 100755 --- a/bin/merge-cve-files +++ b/bin/merge-cve-files @@ -50,11 +50,12 @@ def merge_notes(bug, notes): def merge_annotations(annotations, new_annotation): + """ + Adds new_annotation to the annotations list + """ if not isinstance(new_annotation, PackageAnnotation): raise NotImplementedError(f"unsupported annotation of type {new_annotation.type} (line {new_annotation.line})") - annotations = list(annotations) - annotations_for_pkg = [ann for ann in annotations \ if isinstance(ann, PackageAnnotation) \ and ann.package == new_annotation.package] @@ -69,7 +70,7 @@ def merge_annotations(annotations, new_annotation): continue annotations.insert(idx, new_annotation) - return annotations + return # append/substitute the new one at the right place @@ -103,7 +104,6 @@ def merge_annotations(annotations, new_annotation): annotations.insert(idx + 1, new_annotation) break - return annotations if len(sys.argv) not in (2, 3): print(f"Usage: {os.path.basename(sys.argv[0])} (CVE/list) extra-cve-list") @@ -123,7 +123,6 @@ for extra_bug in extra_data: bug = next(bug for bug in data if bug.header.name == extra_bug.header.name) notes = [] - new_annotations = bug.annotations for extra_annotation in extra_bug.annotations: if isinstance(extra_annotation, FlagAnnotation): continue @@ -131,9 +130,8 @@ for extra_bug in extra_data: notes.append(extra_annotation) continue - new_annotations = merge_annotations(new_annotations, extra_annotation) + merge_annotations(bug.annotations, extra_annotation) - bug.annotations = new_annotations merge_notes(bug, notes) with open(main_list, 'w') as f: |