Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binrepos.conf: Support "frozen" attribute #1329

Merged
merged 1 commit into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/portage/binrepo/config.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -12,20 +12,25 @@

class BinRepoConfig:
__slots__ = (
"frozen",
"name",
"name_fallback",
"fetchcommand",
"priority",
"resumecommand",
"sync_uri",
)
_bool_opts = ("frozen",)

def __init__(self, opts):
"""
Create a BinRepoConfig with options in opts.
"""
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):
"""
Expand All @@ -38,6 +43,8 @@ def info_string(self):
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)

Expand All @@ -48,6 +55,7 @@ def __init__(self, paths, settings):

# Defaults for value interpolation.
parser_defaults = {
"frozen": "false",
"EPREFIX": settings["EPREFIX"],
"EROOT": settings["EROOT"],
"PORTAGE_CONFIGROOT": settings["PORTAGE_CONFIGROOT"],
Expand Down
5 changes: 3 additions & 2 deletions lib/portage/dbapi/bintree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ def _populate_remote(self, getbinpkg_refresh=True, pretend=False):
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:
Expand Down Expand Up @@ -1566,11 +1566,12 @@ def _populate_remote(self, getbinpkg_refresh=True, pretend=False):
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"
)
Expand Down
8 changes: 7 additions & 1 deletion man/portage.5
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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).
Expand Down