aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-11-06 17:07:10 +0000
committerSam James <sam@gentoo.org>2023-11-06 17:25:04 +0000
commit6ae45739e208b7a9d59e0b6056be72a5791aae04 (patch)
tree113977df6df380136041a1c64f7741991328019a
parentemerge: fix _show_ignored_binaries_respect_use with incomplete depgraph (diff)
downloadportage-6ae45739.tar.gz
portage-6ae45739.tar.bz2
portage-6ae45739.zip
bintree: don't call trust helper with --pretend
Trust helpers are likely to need privileges and it's a bit too far for pretend there, I think. People can run it manually if they want it done for them anyway. We could check writable instead but I'd like to get a fix in for the regression first. Bug: https://bugs.gentoo.org/915842 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--NEWS3
-rw-r--r--lib/_emerge/actions.py3
-rw-r--r--lib/portage/dbapi/bintree.py14
-rw-r--r--lib/portage/tests/dbapi/test_bintree.py6
-rw-r--r--lib/portage/tests/emerge/test_actions.py4
5 files changed, 24 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index 89d933527..654b3175f 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,9 @@ Bug fixes:
* Avoid crash with blockers in depgraph for binpkg-respect-use notice (bug #916336).
+* Don't call trust helper (e.g. getuto) with --getbinpkg --pretend as we may
+ lack privileges to do anything (bug #915842).
+
portage-3.0.54 (2023-10-25)
--------------
diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py
index 323fde376..07d477a04 100644
--- a/lib/_emerge/actions.py
+++ b/lib/_emerge/actions.py
@@ -174,6 +174,7 @@ def action_build(
kwargs["add_repos"] = (quickpkg_vardb,)
try:
+ kwargs["pretend"] = "--pretend" in emerge_config.opts
emerge_config.target_config.trees["bintree"].populate(
getbinpkgs="--getbinpkg" in emerge_config.opts, **kwargs
)
@@ -3472,6 +3473,8 @@ def run_action(emerge_config):
emerge_config.running_config.trees["vartree"].dbapi,
)
+ kwargs["pretend"] = "--pretend" in emerge_config.opts
+
try:
mytrees["bintree"].populate(
getbinpkgs="--getbinpkg" in emerge_config.opts,
diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index 0ecfdc25d..6446fde95 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -831,6 +831,7 @@ class binarytree:
add_repos=(),
force_reindex=False,
invalid_errors=True,
+ pretend=False,
):
"""
Populates the binarytree with package metadata.
@@ -844,6 +845,10 @@ class binarytree:
@type add_repos: sequence
"""
+ # TODO: Should we return here if we're --pretend? On the one hand,
+ # people might not want --pretend to affect state. On the other hand,
+ # it makes --pretend pretty useless with --getbinpkg as your index will
+ # be stale.
if self._populating:
return
@@ -898,7 +903,9 @@ class binarytree:
noiselevel=-1,
)
else:
- self._populate_remote(getbinpkg_refresh=getbinpkg_refresh)
+ self._populate_remote(
+ getbinpkg_refresh=getbinpkg_refresh, pretend=pretend
+ )
finally:
self._populating = False
@@ -1290,7 +1297,7 @@ class binarytree:
return
ret.check_returncode()
- def _populate_remote(self, getbinpkg_refresh=True):
+ def _populate_remote(self, getbinpkg_refresh=True, pretend=False):
self._remote_has_index = False
self._remotepkgs = {}
@@ -1299,7 +1306,8 @@ class binarytree:
# when binpackages are involved, not only when we refuse unsigned
# ones. (If the keys have expired we end up refusing signed but
# technically invalid packages...)
- self._run_trust_helper()
+ if not pretend:
+ self._run_trust_helper()
gpkg_only = True
else:
gpkg_only = False
diff --git a/lib/portage/tests/dbapi/test_bintree.py b/lib/portage/tests/dbapi/test_bintree.py
index 5a6ee5b14..0aa411ad9 100644
--- a/lib/portage/tests/dbapi/test_bintree.py
+++ b/lib/portage/tests/dbapi/test_bintree.py
@@ -120,7 +120,9 @@ class BinarytreeTestCase(TestCase):
settings.__getitem__.return_value = "/some/path"
bt = binarytree(pkgdir=os.getenv("TMPDIR", "/tmp"), settings=settings)
bt.populate(getbinpkgs=True, getbinpkg_refresh=refresh)
- ppopulate_remote.assert_called_once_with(getbinpkg_refresh=refresh)
+ ppopulate_remote.assert_called_once_with(
+ getbinpkg_refresh=refresh, pretend=False
+ )
@patch("portage.dbapi.bintree.writemsg")
@patch("portage.dbapi.bintree.BinRepoConfigLoader")
@@ -161,4 +163,4 @@ class BinarytreeTestCase(TestCase):
settings.__getitem__.return_value = "/some/path"
bt = binarytree(pkgdir=os.getenv("TMPDIR", "/tmp"), settings=settings)
bt.populate(getbinpkgs=True)
- ppopulate_remote.assert_called_once_with(getbinpkg_refresh=False)
+ ppopulate_remote.assert_called_once_with(getbinpkg_refresh=False, pretend=False)
diff --git a/lib/portage/tests/emerge/test_actions.py b/lib/portage/tests/emerge/test_actions.py
index d93e44bad..17e8b7a2b 100644
--- a/lib/portage/tests/emerge/test_actions.py
+++ b/lib/portage/tests/emerge/test_actions.py
@@ -42,4 +42,6 @@ class RunActionTestCase(TestCase):
run_action(config)
- bt.populate.assert_called_once_with(getbinpkgs=False, getbinpkg_refresh=True)
+ bt.populate.assert_called_once_with(
+ getbinpkgs=False, getbinpkg_refresh=True, pretend=False
+ )