commit:     1620915f2d11f8f4d85e1fe477d9100a0ae437bd
Author:     Jethro Donaldson <devel <AT> jro <DOT> nz>
AuthorDate: Wed Dec  3 10:11:19 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Feb 16 06:54:15 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1620915f

bintree: keep local pkgindex of unreachable binrepo with --pretend

If --pretend is in effect with --getbinpkgs then keep cached binary
package index in play even if the remote repository is unreachable.
This allows emerge to still show what it would do when the binhost
is available.

Signed-off-by: Jethro Donaldson <devel <AT> jro.nz>
Part-of: https://github.com/gentoo/portage/pull/1527
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/dbapi/bintree.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index 87e407ad7e..781d9fd4f3 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -1753,7 +1753,16 @@ class binarytree:
             error_msg = str(err)
             writemsg(f"!!! [{binrepo_name}] {error_msg}\n\n")
             del err
-            pkgindex = None
+            if pretend:
+                writemsg(
+                    _(
+                        "[%s] Local copy of unavailable remote index will be "
+                        "used due to --pretend\n"
+                    )
+                    % (binrepo_name)
+                )
+            else:
+                pkgindex = None
 
         if pkgindex is rmt_idx and changed:
             pkgindex.modified = False  # don't update the header

Reply via email to