commit:     f05140beb2dd9a3577ff2042941cb3e4fbb1df31
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 17 05:15:27 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 21 01:28:02 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f05140be

porttree: skip metadata verification if repository is immutable (not volatile)

With Python 3.11, I get:
- ~232695 total syscalls before (38268 read calls)
- ~203656 total syscalls after (27381 read calls)

It's a cheap improvement for simply promising to not touch
ebuilds in a repository.

Bug: https://bugs.gentoo.org/528394
See: a72a01746638debe472496bd8fc661992a6ba08b
See: 5c7bf4eb09f644813a6f017ffd91665664142560
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/dbapi/porttree.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/portage/dbapi/porttree.py b/lib/portage/dbapi/porttree.py
index 15e1fd6ff..448a7f300 100644
--- a/lib/portage/dbapi/porttree.py
+++ b/lib/portage/dbapi/porttree.py
@@ -614,7 +614,8 @@ class portdbapi(dbapi):
         if ro_auxdb is not None:
             auxdbs.append(ro_auxdb)
         auxdbs.append(self.auxdb[repo_path])
-        eclass_db = 
self.repositories.get_repo_for_location(repo_path).eclass_db
+        repo = self.repositories.get_repo_for_location(repo_path)
+        eclass_db = repo.eclass_db
 
         for auxdb in auxdbs:
             try:
@@ -637,7 +638,9 @@ class portdbapi(dbapi):
                 # EAPI from _parse_eapi_ebuild_head, we disregard cache entries
                 # for unsupported EAPIs.
                 continue
-            if auxdb.validate_entry(metadata, ebuild_hash, eclass_db):
+            if not repo.volatile or auxdb.validate_entry(
+                metadata, ebuild_hash, eclass_db
+            ):
                 break
         else:
             metadata = None

Reply via email to