commit: cc6a6b08938809bcfa4a244ab5050fd3b496807f
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 25 19:59:38 2024 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Oct 27 23:13:09 2024 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=cc6a6b08
binarytree: Fix _inject_repo_revisions to ignore remote packages
For remote packages that reference source repos which do not
exist locally, do not inject repo revisions.
Fixes: 5aed7289d516 ("bintree: Add REPO_REVISIONS to package index header")
Bug: https://bugs.gentoo.org/939299
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
NEWS | 3 +++
lib/portage/dbapi/bintree.py | 9 ++++++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index 110fea45ab..5c1cea5c27 100644
--- a/NEWS
+++ b/NEWS
@@ -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)
--------------
diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index 6099bab968..a63652c7e0 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -1948,9 +1948,16 @@ class binarytree:
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 {}