commit:     f36f0754fcbbb7f9caad2bf26f226c4d1cee13f1
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 19 14:16:49 2025 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Wed Aug 27 15:09:04 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f36f0754

bintree: Introduce PORTAGE_BINHOST_TTL setting

Closes: https://bugs.gentoo.org/958401
Closes: https://github.com/gentoo/portage/pull/1444
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 lib/portage/dbapi/bintree.py | 5 +++++
 man/make.conf.5              | 8 ++++++++
 2 files changed, 13 insertions(+)

diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index 90f213f1cb..f6bc0d7490 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -2177,6 +2177,11 @@ class binarytree:
             header["URI"] = base_uri
         else:
             header.pop("URI", None)
+        ttl = self.settings.get("PORTAGE_BINHOST_TTL")
+        if ttl:
+            header["TTL"] = ttl
+        else:
+            header.pop("TTL", None)
         for k in (
             list(self._pkgindex_header_keys)
             + self.settings.get("USE_EXPAND_IMPLICIT", "").split()

diff --git a/man/make.conf.5 b/man/make.conf.5
index 97178093fd..ce389a4e61 100644
--- a/man/make.conf.5
+++ b/man/make.conf.5
@@ -1040,6 +1040,14 @@ use the URI header field as a base URI for fetching 
binary packages. If the URI
 header field is not defined then the client will use its ${PORTAGE_BINHOST}
 setting as the base URI.
 .TP
+\fBPORTAGE_BINHOST_TTL\fR = \
+\fI"3600"\fR
+If this is set, its value will be used to define the TTL header in package
+index.  The TTL header indicates to portage the duration in seconds after
+which the local package index should be considered potentially outdated.  It is
+recommended to set this value to the minimal duration between binary package
+builds to avoid unnecessary network requests on the package index.
+.TP
 .B PORTAGE_BINPKG_FORMAT
 This variable sets default format used for binary packages. Possible values
 are tar and rpm or both. It is very uncommon to set this and is likely

Reply via email to