commit:     a7dd39c1ae4a5ea4e3252ae8129fbd671c95d5f7
Author:     Sheng Yu <syu.os <AT> protonmail <DOT> com>
AuthorDate: Tue Nov  8 22:52:46 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Nov  8 23:07:46 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a7dd39c1

Do not drop default PATH in the package index (avoid Packages regeneration)

The new Packages index (introduced in 445f10f4214c673f8fe0a9cc518c12767be4f159)
needs PATH but it got dropped later on when processing, so we would try
to rebuild the index on every emerge call.

This fixes regenerating Packages loop.

(Note that this didn't affect a released version.)

Fixes: 445f10f4214c673f8fe0a9cc518c12767be4f159
Bug: https://bugs.gentoo.org/877357
Bug: https://bugs.gentoo.org/877419
Signed-off-by: Sheng Yu <syu.os <AT> protonmail.com>
Closes: https://github.com/gentoo/portage/pull/934
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/dbapi/bintree.py | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index 771abedd5..d7c18e2e9 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -1000,20 +1000,9 @@ class binarytree:
                             pkg_paths[instance_key] = mypath
                             # update the path if the package has been moved
                             oldpath = d.get("PATH")
-                            if oldpath and oldpath != mypath:
-                                update_pkgindex = True
-                            # Omit PATH if it is the default path for
-                            # the current Packages format version.
-                            if (mypath != mycpv + ".tbz2") and (
-                                mypath != mycpv + ".gpkg.tar"
-                            ):
+                            if oldpath != mypath:
                                 d["PATH"] = mypath
-                                if not oldpath:
-                                    update_pkgindex = True
-                            else:
-                                d.pop("PATH", None)
-                                if oldpath:
-                                    update_pkgindex = True
+                                update_pkgindex = True
                             self.dbapi.cpv_inject(mycpv)
                             continue
                     if not os.access(full_path, os.R_OK):
@@ -1218,11 +1207,7 @@ class binarytree:
                         self.dbapi.cpv_remove(mycpv)
                         del pkg_paths[_instance_key(mycpv)]
 
-                    # record location if it's non-default
-                    if (mypath != mycpv + ".tbz2") and (mypath != mycpv + 
".gpkg.tar"):
-                        d["PATH"] = mypath
-                    else:
-                        d.pop("PATH", None)
+                    d["PATH"] = mypath
                     metadata[_instance_key(mycpv)] = d
 
             if reindex:

Reply via email to