Merge ~mdeslaur/ubuntu-cve-tracker:more-source-map-cache into ubuntu-cve-tracker:master

Proposed by Marc Deslauriers
Status: Merged
Merge reported by: Marc Deslauriers
Merged at revision: 5661c00df492483a5448327823c31f40c44bf77a
Proposed branch: ~mdeslaur/ubuntu-cve-tracker:more-source-map-cache
Merge into: ubuntu-cve-tracker:master
Diff against target: 71 lines (+22/-3)
2 files modified
scripts/gen-source-map-cache (+13/-0)
scripts/source_map.py (+9/-3)
Reviewer Review Type Date Requested Status
Alex Murray Approve
Review via email: mp+462252@code.launchpad.net

Commit message

commit 5661c00df492483a5448327823c31f40c44bf77a
Author: Marc Deslauriers <email address hidden>
Date: Tue Mar 12 12:43:20 2024 -0400

    source_map.py: use detailed cache if available

commit 3335f8ca63d56e8ea81a15f61a217103ec573fb1
Author: Marc Deslauriers <email address hidden>
Date: Tue Mar 12 12:30:11 2024 -0400

    gen-source-map-cache: create cache for detailed source map

Description of the change

This merge request will add a cache for the detailed source map, this should speed up most of the other tools in UCT.

To post a comment you must log in.
Revision history for this message
Alex Murray (alexmurray) wrote :

LGTM!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/scripts/gen-source-map-cache b/scripts/gen-source-map-cache
index 1c84cc6..cb86360 100755
--- a/scripts/gen-source-map-cache
+++ b/scripts/gen-source-map-cache
@@ -32,19 +32,29 @@ def main():
32 sys.exit(1)32 sys.exit(1)
3333
34 mirror = config['packages_mirror']34 mirror = config['packages_mirror']
35
36 # This is used by check-syntax and active_edit
35 sources_pickle = os.path.join(mirror, 'sources_map.pickle')37 sources_pickle = os.path.join(mirror, 'sources_map.pickle')
38
39 # This is used by active_edit
36 sources_pickle_dev_proposed = os.path.join(mirror, 'sources_map_dev_proposed.pickle')40 sources_pickle_dev_proposed = os.path.join(mirror, 'sources_map_dev_proposed.pickle')
3741
42 # This is used by most of the other tools
43 sources_pickle_detailed = os.path.join(mirror, 'sources_map_detailed.pickle')
44
38 # Remove these first so that source_map.load doesn't load them!45 # Remove these first so that source_map.load doesn't load them!
39 if os.path.exists(sources_pickle):46 if os.path.exists(sources_pickle):
40 os.unlink(sources_pickle)47 os.unlink(sources_pickle)
41 if os.path.exists(sources_pickle_dev_proposed):48 if os.path.exists(sources_pickle_dev_proposed):
42 os.unlink(sources_pickle_dev_proposed)49 os.unlink(sources_pickle_dev_proposed)
50 if os.path.exists(sources_pickle_detailed):
51 os.unlink(sources_pickle_detailed)
4352
44 sources = source_map.load(detailed=False)53 sources = source_map.load(detailed=False)
45 sources_dev_proposed = source_map.load(pockets=["-proposed"],54 sources_dev_proposed = source_map.load(pockets=["-proposed"],
46 releases=[cve_lib.devel_release],55 releases=[cve_lib.devel_release],
47 detailed=False)56 detailed=False)
57 sources_detailed = source_map.load(detailed=True)
4858
49 # Use protocol=3 to remain compatible with focal59 # Use protocol=3 to remain compatible with focal
50 with open(sources_pickle, 'wb') as handle:60 with open(sources_pickle, 'wb') as handle:
@@ -53,5 +63,8 @@ def main():
53 with open(sources_pickle_dev_proposed, 'wb') as handle:63 with open(sources_pickle_dev_proposed, 'wb') as handle:
54 pickle.dump(sources_dev_proposed, handle, protocol=3)64 pickle.dump(sources_dev_proposed, handle, protocol=3)
5565
66 with open(sources_pickle_detailed, 'wb') as handle:
67 pickle.dump(sources_detailed, handle, protocol=3)
68
56if __name__ == '__main__':69if __name__ == '__main__':
57 main()70 main()
diff --git a/scripts/source_map.py b/scripts/source_map.py
index c5ec9ad..e353fa8 100755
--- a/scripts/source_map.py
+++ b/scripts/source_map.py
@@ -222,14 +222,20 @@ def load(data_type='sources', pockets=None, releases=None, skip_eol_releases=Tru
222 if 'packages_mirror' in config:222 if 'packages_mirror' in config:
223 mirror = config['packages_mirror']223 mirror = config['packages_mirror']
224224
225 if data_type == 'sources' and skip_eol_releases == True and arch == "amd64" and detailed == False:225 if data_type == 'sources' and skip_eol_releases == True and arch == "amd64":
226 if pockets == None and releases == None:226 if detailed == False and pockets == None and releases == None:
227 sources_pickle = os.path.join(mirror, 'sources_map.pickle')227 sources_pickle = os.path.join(mirror, 'sources_map.pickle')
228 if os.path.exists(sources_pickle):228 if os.path.exists(sources_pickle):
229 with open(sources_pickle, 'rb') as handle:229 with open(sources_pickle, 'rb') as handle:
230 map = pickle.load(handle)230 map = pickle.load(handle)
231 return map231 return map
232 elif pockets == ["-proposed"] and releases == [cve_lib.devel_release]:232 elif detailed == True and pockets == None and releases == None:
233 sources_pickle = os.path.join(mirror, 'sources_map_detailed.pickle')
234 if os.path.exists(sources_pickle):
235 with open(sources_pickle, 'rb') as handle:
236 map = pickle.load(handle)
237 return map
238 elif detailed == False and pockets == ["-proposed"] and releases == [cve_lib.devel_release]:
233 sources_pickle_dev_proposed = os.path.join(mirror, 'sources_map_dev_proposed.pickle')239 sources_pickle_dev_proposed = os.path.join(mirror, 'sources_map_dev_proposed.pickle')
234 if os.path.exists(sources_pickle_dev_proposed):240 if os.path.exists(sources_pickle_dev_proposed):
235 with open(sources_pickle_dev_proposed, 'rb') as handle:241 with open(sources_pickle_dev_proposed, 'rb') as handle:

Subscribers

People subscribed via source and target branches