commit:     c9fb98b4913b286ed404d1df408e51d4f17b1dfb
Author:     John Helmert III <ajak <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 17 03:16:17 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Sep 19 07:15:59 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c9fb98b4

ResolverPlayground: produce pkgdir indexes

Tests expect the index to be generated anyway, so let's not rely on
implicit FEATURES=-pkgdir-index-trusted.

Signed-off-by: John Helmert III <ajak <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/dbapi/bintree.py                     | 9 ++++++++-
 lib/portage/tests/resolver/ResolverPlayground.py | 4 ++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index ec31b52d00..9d7c45577b 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -803,7 +803,13 @@ class binarytree:
             except PortageException:
                 pass
 
-    def populate(self, getbinpkgs=False, getbinpkg_refresh=False, 
add_repos=()):
+    def populate(
+        self,
+        getbinpkgs=False,
+        getbinpkg_refresh=False,
+        add_repos=(),
+        force_reindex=False,
+    ):
         """
         Populates the binarytree with package metadata.
 
@@ -833,6 +839,7 @@ class binarytree:
         try:
             update_pkgindex = self._populate_local(
                 reindex="pkgdir-index-trusted" not in self.settings.features
+                or force_reindex
             )
 
             if update_pkgindex and self.dbapi.writable:

diff --git a/lib/portage/tests/resolver/ResolverPlayground.py 
b/lib/portage/tests/resolver/ResolverPlayground.py
index 7f97d3100c..f1cd844708 100644
--- a/lib/portage/tests/resolver/ResolverPlayground.py
+++ b/lib/portage/tests/resolver/ResolverPlayground.py
@@ -17,6 +17,7 @@ from portage.const import (
 )
 from portage.process import find_binary
 from portage.dep import Atom, _repo_separator
+from portage.dbapi.bintree import binarytree
 from portage.package.ebuild.config import config
 from portage.package.ebuild.digestgen import digestgen
 from portage._sets import load_default_config
@@ -397,6 +398,9 @@ class ResolverPlayground:
             else:
                 raise InvalidBinaryPackageFormat(binpkg_format)
 
+            bintree = binarytree(pkgdir=self.pkgdir, settings=self.settings)
+            bintree.populate(force_reindex=True)
+
     def _create_installed(self, installed):
         for cpv in installed:
             a = Atom("=" + cpv, allow_repo=True)

Reply via email to