From d16cfb47ef460153669eee57eaec807be6b4fdcc Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Thu, 18 Feb 2021 12:19:01 +0100 Subject: lts: take glib2.0 --- bin/merge-cve-files | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/merge-cve-files b/bin/merge-cve-files index b980cfbdbc..dcc7b9c6a2 100755 --- a/bin/merge-cve-files +++ b/bin/merge-cve-files @@ -10,7 +10,7 @@ import sys import setup_paths # noqa from debian_support import internRelease -from sectracker.parsers import cvelist, writecvelist, PackageAnnotation +from sectracker.parsers import cvelist, writecvelist, PackageAnnotation, FlagAnnotation, XrefAnnotation def merge_annotations(annotations, new_annotation): if not isinstance(new_annotation, PackageAnnotation): @@ -18,6 +18,23 @@ def merge_annotations(annotations, new_annotation): annotations = list(annotations) + annotations_for_pkg = [ann for ann in annotations \ + if isinstance(ann, PackageAnnotation) \ + and ann.package == new_annotation.package] + if not annotations_for_pkg: + if new_annotation.release: + raise ValueError(f"new annotation for {new_annotation.package}/{new_annotation.release} " + "but there is no annotation for sid") + # new package, add it at the top + for idx, annotation in enumerate(annotations): + if isinstance(annotation, FlagAnnotation) \ + or isinstance(annotation, XrefAnnotation): + continue + + annotations.insert(idx, new_annotation) + return annotations + + # append/substitute the new one at the right place for idx, annotation in enumerate(annotations): if not isinstance(annotation, PackageAnnotation) \ -- cgit v1.2.3