Merge ~litios/ubuntu-cve-tracker:cleanup/generics into ubuntu-cve-tracker:master

Proposed by David Fernandez Gonzalez
Status: Merged
Merge reported by: David Fernandez Gonzalez
Merged at revision: b6245b56e9c8ee99aa2e35a5a2fc1fae37986230
Proposed branch: ~litios/ubuntu-cve-tracker:cleanup/generics
Merge into: ubuntu-cve-tracker:master
Diff against target: 183 lines (+11/-64)
4 files modified
scripts/active_edit (+2/-6)
scripts/check-cves (+0/-7)
scripts/check-syntax (+8/-35)
scripts/source_map.py (+1/-16)
Reviewer Review Type Date Requested Status
Emilia Torino Approve
Review via email: mp+456416@code.launchpad.net

Description of the change

Generics was a feature to support a specific customer case.
This customer project has been migrated from UCT.
We shouldn't need this anymore.

To post a comment you must log in.
b6245b5... by David Fernandez Gonzalez

Remove 'generics' feature

Generics was a feature to support a specific customer case.
This customer project has been migrated from UCT.
We shouldn't need this anymore.

Signed-off-by: David Fernandez Gonzalez <email address hidden>

Revision history for this message
Emilia Torino (emitorino) wrote :

Just minor comment otherwise LGTM!

review: Approve
Revision history for this message
David Fernandez Gonzalez (litios) wrote :

Thanks for checking! :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/scripts/active_edit b/scripts/active_edit
2index 2b46b07..dc49bc5 100755
3--- a/scripts/active_edit
4+++ b/scripts/active_edit
5@@ -91,11 +91,10 @@ def _add_pkg(p, fp, fixed, parent, embargoed):
6 fixed_in_release_version = fixed[p][2]
7 for rel in ['upstream'] + cve_lib.release_sort(list(source.keys())):
8 aliases = source_map.get_aliases_of_ubuntu_package(source, p, rel)
9- pkgs_from_generic = source_map.get_packages_from_generic_name(source, p, rel)
10 # determine default state but override this if pkg_db has a
11 # better one
12 state = "needs-triage"
13- if not pkg_in_rel(p, rel) and not aliases and not pkgs_from_generic:
14+ if not pkg_in_rel(p, rel) and not aliases:
15 # package doesn't exist in this release - see if it wants a
16 # DNE entry
17 if release_wants_dne(rel):
18@@ -135,8 +134,6 @@ def _add_pkg(p, fp, fixed, parent, embargoed):
19 pkgs_to_add = [p]
20 if aliases:
21 pkgs_to_add = aliases
22- elif pkgs_from_generic:
23- pkgs_to_add = pkgs_from_generic
24
25 # If the subproject doesn't require cve triage,
26 # we shouldn't add any entries to the CVE
27@@ -154,8 +151,7 @@ def add_pkg(p, fp, fixed, parent, embargoed):
28 add = False
29 for r in source.keys():
30 aliases = source_map.get_all_aliases(source, r)
31- pkgs_from_generic = source_map.get_packages_from_generic_name(source, p, r)
32- add |= p in source[r] or p in aliases or len(pkgs_from_generic) > 0
33+ add |= p in source[r] or p in aliases
34 if add:
35 _add_pkg(p, fp, fixed, parent, embargoed)
36
37diff --git a/scripts/check-cves b/scripts/check-cves
38index 198d90b..4c9461e 100755
39--- a/scripts/check-cves
40+++ b/scripts/check-cves
41@@ -933,13 +933,6 @@ class CVEHandler(xml.sax.handler.ContentHandler):
42 external_subprojects.setdefault(subproject, set()).add(hint)
43 elif hint in aliases:
44 external_subprojects.setdefault(subproject, set()).add(hint)
45- else:
46- pkgs = source_map.get_packages_from_generic_name(source, hint, subproject)
47- for pkg in pkgs:
48- if 'aliases' in source[subproject][pkg]:
49- external_subprojects.setdefault(subproject, set()).add(','.join(source[subproject][pkg]['aliases']))
50- else:
51- external_subprojects.setdefault(subproject, set()).add(hint)
52
53 return external_subprojects
54
55diff --git a/scripts/check-syntax b/scripts/check-syntax
56index 734aa04..ca2c509 100755
57--- a/scripts/check-syntax
58+++ b/scripts/check-syntax
59@@ -139,16 +139,6 @@ def get_pkgs_from_aliases(sources, aliases, pkg, rel):
60 aliases[rel][pkg] = source_map.get_aliases_of_ubuntu_package(sources, pkg, rel)
61 return aliases[rel][pkg]
62
63-def get_pkgs_from_generic(sources, generics, pkg, rel):
64- if rel in generics:
65- if pkg in generics[rel]:
66- return generics[rel][pkg]
67- else:
68- generics[rel] = {}
69-
70- generics[rel][pkg] = source_map.get_packages_from_generic_name(sources, pkg, rel)
71- return generics[rel][pkg]
72-
73 def subprocess_setup():
74 # Python installs a SIGPIPE handler by default. This is usually not what
75 # non-Python subprocesses expect.
76@@ -391,7 +381,6 @@ if len(cna_cves_set) > 0 and all_files:
77 % (cna_cves_set[cve][0], cna_cves_set[cve][1], cve))
78
79 aliases_cache = {}
80-generics_cache = {}
81
82 def check_cve(cve):
83 if re.match(r"EMB-", cve):
84@@ -475,23 +464,23 @@ def check_cve(cve):
85 continue
86
87 if rel in source:
88- skip_aliases_generics = False
89+ skip_aliases = False
90 if not 'soss' in rel:
91 _, series = cve_lib.product_series(rel)
92 # If the series is not listed in the original CVE,
93 # we won't create the CVE in the subproject.
94 if not is_active(cve) and series not in listed_series:
95- skip_aliases_generics = True
96+ skip_aliases = True
97
98 # We are not adding CVEs in ignored.
99 if "ignored/" in cvepath:
100- skip_aliases_generics = True
101+ skip_aliases = True
102
103- if not skip_aliases_generics:
104- aliases_or_generics = False
105+ if not skip_aliases:
106+ aliases = False
107 pkgs_from_aliases = get_pkgs_from_aliases(source, aliases_cache, pkg, rel)
108 if pkgs_from_aliases:
109- aliases_or_generics = True
110+ aliases = True
111 aliases_releases.add(rel)
112
113 for pkg_alias in pkgs_from_aliases:
114@@ -505,26 +494,10 @@ def check_cve(cve):
115 file=sys.stderr,
116 )
117 cve_okay = False
118-
119- pkgs_from_generic = get_pkgs_from_generic(source, generics_cache, pkg, rel)
120- if pkgs_from_generic:
121- aliases_or_generics = True
122- aliases_releases.add(rel)
123- for curr_pkg in pkgs_from_generic:
124- if curr_pkg not in data["pkgs"].keys():
125- filename = srcmap["pkgs"][pkg][nearby_rel][0]
126- linenum = srcmap["pkgs"][pkg][nearby_rel][1]
127- print(
128- "%s: %d: %s missing release '%s'"
129- # put the error on a line near where this entry should go
130- % (filename, linenum, curr_pkg, rel),
131- file=sys.stderr,
132- )
133- cve_okay = False
134
135- # This package-release uses aliases or generic names,
136+ # This package-release uses aliases,
137 # it shouldn't be listed
138- if aliases_or_generics:
139+ if aliases:
140 if rel in listed_releases and pkg \
141 not in pkgs_from_aliases:
142 filename = srcmap["pkgs"][pkg][nearby_rel][0]
143diff --git a/scripts/source_map.py b/scripts/source_map.py
144index 9f3c66b..48c22f4 100755
145--- a/scripts/source_map.py
146+++ b/scripts/source_map.py
147@@ -416,16 +416,6 @@ def get_aliases_of_ubuntu_package(sources, pkg_name, rel):
148 aliases.append(pkg)
149 return aliases
150
151-def get_packages_from_generic_name(sources, generic_name, rel):
152- pkgs = []
153- if not rel in sources:
154- return pkgs
155-
156- for pkg in sources[rel]:
157- if 'generic_name' in sources[rel][pkg] and sources[rel][pkg]['generic_name'] == generic_name:
158- pkgs.append(pkg)
159- return pkgs
160-
161 def load_subprojects_lists(releases=None):
162 map = dict()
163
164@@ -486,18 +476,13 @@ def load_subprojects_lists(releases=None):
165 else:
166 map[rel][pkg]['section'] = 'main'
167
168- if '|' in pkg:
169- main_package_name = pkg.split('|')[0]
170- map[rel][pkg]['generic_name'] = main_package_name
171-
172 if 'aliases' in details:
173 with open(details['aliases'], 'r') as file:
174 aliases = yaml.safe_load(file)
175
176 for pkg in aliases:
177 for src_pkg in map[rel]:
178- if pkg == src_pkg or \
179- ('generic_name' in map[rel][src_pkg] and pkg == map[rel][src_pkg]['generic_name']):
180+ if pkg == src_pkg:
181 map[rel][src_pkg]['aliases'] = aliases[pkg]
182 #else:
183 # print("WARN: pkg %s found in aliases but not in supported list for %s. Skipping" % (pkg, rel))

Subscribers

People subscribed via source and target branches