Returns: { advisory_set_id: [ { "commit_hash": "...", "vcs_url": "...", } ] }
(patches_map, advisory_ids_by_set)
| 526 | |
| 527 | |
| 528 | def build_patch_set_map(patches_map, advisory_ids_by_set): |
| 529 | """ |
| 530 | Returns: |
| 531 | { |
| 532 | advisory_set_id: [ |
| 533 | { |
| 534 | "commit_hash": "...", |
| 535 | "vcs_url": "...", |
| 536 | } |
| 537 | ] |
| 538 | } |
| 539 | """ |
| 540 | result = {} |
| 541 | |
| 542 | for advisory_set_id, advisory_ids in advisory_ids_by_set.items(): |
| 543 | seen = set() |
| 544 | collected = [] |
| 545 | |
| 546 | for (package_id, advisory_id), patches in patches_map.items(): |
| 547 | if advisory_id not in advisory_ids: |
| 548 | continue |
| 549 | |
| 550 | for patch in patches: |
| 551 | key = ( |
| 552 | patch["commit_hash"], |
| 553 | patch["vcs_url"], |
| 554 | ) |
| 555 | |
| 556 | if key in seen: |
| 557 | continue |
| 558 | |
| 559 | seen.add(key) |
| 560 | collected.append(patch) |
| 561 | |
| 562 | result[advisory_set_id] = collected |
| 563 | return result |
| 564 | |
| 565 | |
| 566 | def get_affected_advisories_bulk(packages, max_advisories, base_url, reachability=False): |
no test coverage detected