commit: cf720dae82166593a5deeeffe2c42681ffd57ce5
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 21 06:19:29 2026 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jan 21 16:33:00 2026 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=cf720dae
binrepo: default to /var/cache/binhost/${NAME} for location
To allow clean separation of what requires PGP verification and what doesn't,
we want to store remote binpkgs in a different location. This has other
advantages too as it's generally cleaner - having the source of the files
is always going to be useful.
Default `location` in `binrepos.conf` to `location = /var/cache/binhost/${NAME}`
for this. Make sure to exclude `PORTAGE_BINHOST` because it's not clear
what the implicit name would be there, it is deprecated anyway.
Bug: https://bugs.gentoo.org/934784
Bug: https://bugs.gentoo.org/945384
Bug: https://bugs.gentoo.org/945385
Thanks-to: Zac Medico <zmedico <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>
lib/portage/binrepo/config.py | 10 ++++++++++
lib/portage/tests/emerge/conftest.py | 12 ++++++++++--
man/portage.5 | 4 ++--
3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/lib/portage/binrepo/config.py b/lib/portage/binrepo/config.py
index 4c0b729c57..8eec17b98d 100644
--- a/lib/portage/binrepo/config.py
+++ b/lib/portage/binrepo/config.py
@@ -57,6 +57,7 @@ class BinRepoConfig:
class BinRepoConfigLoader(Mapping):
def __init__(self, paths, settings):
"""Load config from files in paths"""
+ import os
# Defaults for value interpolation.
parser_defaults = {
@@ -117,6 +118,15 @@ class BinRepoConfigLoader(Mapping):
)
)
+ # With PORTAGE_BINHOST, it's not clear what the implicit name would
+ # be, so treat it like local.
+ if not settings.get("PORTAGE_BINHOST", ""):
+ for repo in repos:
+ if repo.location is None:
+ repo.location = (
+ f"{settings['EPREFIX']}/var/cache/binhost/{repo.name}"
+ )
+
self._data = OrderedDict(
(repo.name or repo.name_fallback, repo)
for repo in sorted(
diff --git a/lib/portage/tests/emerge/conftest.py
b/lib/portage/tests/emerge/conftest.py
index 043c3821c2..619e0ec005 100644
--- a/lib/portage/tests/emerge/conftest.py
+++ b/lib/portage/tests/emerge/conftest.py
@@ -817,7 +817,11 @@ def _generate_all_baseline_commands(playground, binhost):
# Remove binrepos.conf and test PORTAGE_BINHOST.
def _rm_pkgdir_and_rm_binrepos_conf_file():
- shutil.rmtree(pkgdir)
+ shutil.rmtree(pkgdir, ignore_errors=True)
+ shutil.rmtree(
+ f"{settings['EPREFIX']}/var/cache/binhost/test-binhost",
+ ignore_errors=True,
+ )
os.unlink(binrepos_conf_file)
getbinpkgonly_fetchonly = Emerge(
@@ -830,7 +834,11 @@ def _generate_all_baseline_commands(playground, binhost):
# Test bug 920537 binrepos.conf with local file src-uri.
def _rm_pkgdir_and_create_binrepos_conf_with_file_uri():
- shutil.rmtree(pkgdir)
+ shutil.rmtree(pkgdir, ignore_errors=True)
+ shutil.rmtree(
+ f"{settings['EPREFIX']}/var/cache/binhost/test-binhost",
+ ignore_errors=True,
+ )
with open(binrepos_conf_file, "w") as f:
f.write("[test-binhost]\n")
f.write(f"sync-uri = file://{binhost_dir}\n")
diff --git a/man/portage.5 b/man/portage.5
index 298bd77ef4..9d1da407bf 100644
--- a/man/portage.5
+++ b/man/portage.5
@@ -670,8 +670,8 @@ repositories, those with higher priority are preferred.
.TP
.B location
Specify a cache location which serves as a partial local mirror of a
-remote repository. If unset then the effective default is PKGDIR
-(see \fBmake.conf\fR(5)).
+remote repository. If unset then the default is
/var/cache/binhost/repository_name.
+It was previously PKGDIR (see \fBmake.conf\fR(5)).
.TP
.B sync\-uri
Specifies URI of repository used for `emerge \-\-getbinpkg`.