Skip to content

Commit

Permalink
binarytree: Fix _inject_repo_revisions to ignore remote packages
Browse files Browse the repository at this point in the history
For remote packages that reference source repos which do not
exist locally, do not inject repo revisions.

Fixes: 5aed728 ("bintree: Add REPO_REVISIONS to package index header")
Bug: https://bugs.gentoo.org/939299
Signed-off-by: Zac Medico <zmedico@gentoo.org>
  • Loading branch information
zmedico committed Oct 27, 2024
1 parent 7218c9c commit cc6a6b0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Release notes take the form of the following optional categories:
Bug fixes:
* depgraph: Ignore blockers when computing virtual deps visibility (PR #1387).

* binarytree: Fix _inject_repo_revisions to ignore remote packages for which
source repostories are missing, triggering KeyError (PR #1391).

portage-3.0.66.1 (2024-09-18)
--------------

Expand Down
9 changes: 8 additions & 1 deletion lib/portage/dbapi/bintree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1948,9 +1948,16 @@ def _inject_repo_revisions(self, header, repo_revisions):
package was not built locally, and in this case its
REPO_REVISIONS are not intended to be exposed.
"""
try:
repos = [
self.settings.repositories[repo_name] for repo_name in repo_revisions
]
except KeyError:
# Missing repo implies package was not built locally from source.
return
synced_repo_revisions = get_repo_revision_history(
self.settings["EROOT"],
[self.settings.repositories[repo_name] for repo_name in repo_revisions],
repos,
)
header_repo_revisions = (
json.loads(header["REPO_REVISIONS"]) if header.get("REPO_REVISIONS") else {}
Expand Down

0 comments on commit cc6a6b0

Please sign in to comment.