aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2024-05-25 14:53:52 -0700
committerZac Medico <zmedico@gentoo.org>2024-05-25 14:53:52 -0700
commitcd41fb9390fcca9dc8a565b5c52dbba73d9ae59c (patch)
treeb6b54f3a562a09f8a50738f3c9625de1be7f12ba
parentinstall-qa-checks.d: suppress some gnulib implicit decls on musl (diff)
downloadportage-cd41fb9390fcca9dc8a565b5c52dbba73d9ae59c.tar.gz
portage-cd41fb9390fcca9dc8a565b5c52dbba73d9ae59c.tar.bz2
portage-cd41fb9390fcca9dc8a565b5c52dbba73d9ae59c.zip
binrepos.conf: Support "frozen" attribute
In order to allow consistent and reproducible dependency calculations during mixed source and binary updates, add a "frozen" binrepos.conf attribute which will freeze binrepo index updates and cause messsages to indicate that the repo is frozen rather than up-to-date: Local copy of remote index is frozen and will be used. This should only be set temporarily in order to guarantee consistent and reproducible dependency calculations for mixed binary and source updates. Bug: https://bugs.gentoo.org/932739 Signed-off-by: Zac Medico <zmedico@gentoo.org>
-rw-r--r--lib/portage/binrepo/config.py10
-rw-r--r--lib/portage/dbapi/bintree.py5
-rw-r--r--man/portage.58
3 files changed, 19 insertions, 4 deletions
diff --git a/lib/portage/binrepo/config.py b/lib/portage/binrepo/config.py
index 5601a2e00..c744d1012 100644
--- a/lib/portage/binrepo/config.py
+++ b/lib/portage/binrepo/config.py
@@ -1,4 +1,4 @@
-# Copyright 2020 Gentoo Authors
+# Copyright 2020-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
from collections import OrderedDict
@@ -12,6 +12,7 @@ from portage.util.configparser import SafeConfigParser, ConfigParserError, read_
class BinRepoConfig:
__slots__ = (
+ "frozen",
"name",
"name_fallback",
"fetchcommand",
@@ -19,6 +20,7 @@ class BinRepoConfig:
"resumecommand",
"sync_uri",
)
+ _bool_opts = ("frozen",)
def __init__(self, opts):
"""
@@ -26,6 +28,9 @@ class BinRepoConfig:
"""
for k in self.__slots__:
setattr(self, k, opts.get(k.replace("_", "-")))
+ for k in self._bool_opts:
+ if isinstance(getattr(self, k, None), str):
+ setattr(self, k, getattr(self, k).lower() in ("true", "yes"))
def info_string(self):
"""
@@ -38,6 +43,8 @@ class BinRepoConfig:
if self.priority is not None:
repo_msg.append(indent + "priority: " + str(self.priority))
repo_msg.append(indent + "sync-uri: " + self.sync_uri)
+ if self.frozen:
+ repo_msg.append(f"{indent}frozen: {str(self.frozen).lower()}")
repo_msg.append("")
return "\n".join(repo_msg)
@@ -48,6 +55,7 @@ class BinRepoConfigLoader(Mapping):
# Defaults for value interpolation.
parser_defaults = {
+ "frozen": "false",
"EPREFIX": settings["EPREFIX"],
"EROOT": settings["EROOT"],
"PORTAGE_CONFIGROOT": settings["PORTAGE_CONFIGROOT"],
diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index 22e2995c2..221afbd15 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -1408,7 +1408,7 @@ class binarytree:
url = base_url.rstrip("/") + "/Packages"
f = None
- if not getbinpkg_refresh and local_timestamp:
+ if local_timestamp and (repo.frozen or not getbinpkg_refresh):
raise UseCachedCopyOfRemoteIndex()
try:
@@ -1566,11 +1566,12 @@ class binarytree:
noiselevel=-1,
)
except UseCachedCopyOfRemoteIndex:
+ desc = "frozen" if repo.frozen else "up-to-date"
writemsg_stdout("\n")
writemsg_stdout(
colorize(
"GOOD",
- _("Local copy of remote index is up-to-date and will be used."),
+ _("Local copy of remote index is %s and will be used.") % desc,
)
+ "\n"
)
diff --git a/man/portage.5 b/man/portage.5
index 1f717c4cb..3b8329bfb 100644
--- a/man/portage.5
+++ b/man/portage.5
@@ -1,4 +1,4 @@
-.TH "PORTAGE" "5" "Apr 2023" "Portage @VERSION@" "Portage"
+.TH "PORTAGE" "5" "May 2024" "Portage @VERSION@" "Portage"
.SH NAME
portage \- the heart of Gentoo
.SH "DESCRIPTION"
@@ -642,6 +642,12 @@ is intended to be used as a replacement for the \fBmake.conf\fR(5)
.I Attributes supported in DEFAULT section:
.RS
.TP
+.B frozen = yes|no|true|false
+Use the most recently cached copy of the remote index, and do not
+attempt to refresh it. This should only be set temporarily in order to
+guarantee consistent and reproducible dependency calculations (for
+mixed binary and source updates).
+.TP
.B fetchcommand
Specifies a \fBFETCHCOMMAND\fR used to fetch files from a repository,
overriding the value from \fBmake.conf\fR(5).