commit:     a16e1907a3b38f8d80348a86206bb4b20d295915
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  7 10:40:14 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jan  9 16:38:29 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a16e1907

gpkg: Improve "try running PORTAGE_TRUST_HELPER" message

The message was a tad unclear. This hopefully improves it.

Thanks to Sam James for helpful feedback.

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
Part-of: https://github.com/gentoo/portage/pull/1541
Closes: https://github.com/gentoo/portage/pull/1541
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/gpkg.py | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/lib/portage/gpkg.py b/lib/portage/gpkg.py
index 4f6a05cc84..cc36a66d62 100644
--- a/lib/portage/gpkg.py
+++ b/lib/portage/gpkg.py
@@ -555,26 +555,32 @@ class checksum_helper:
         # Attempt to give a nicer error the sniffing the status output.
         error_summaries = []
         portage_trust_helper = self.settings.get("PORTAGE_TRUST_HELPER", "")
+        portage_trust_helper_msg = [
+            # fmt: off
+            "\t" + "Possible fix:",
+            "\t" + f"Try running '{portage_trust_helper}', i.e., 
$PORTAGE_TRUST_HELPER, as root",
+            # fmt: on
+        ]
 
         def _match_list(regex: re.Pattern, msgs: list) -> list[re.Match]:
             return list(filter(lambda s: re.match(regex, s), msgs))
 
+        errors = 0
         if _match_list(r"^\[GNUPG:\] NODATA", gpg_error_lines):
+            errors += 1
             error_summaries.append("binpkg appears unsigned (missing any 
signature)")
         if _match_list(r"^\[GNUPG:\] NO_PUBKEY", gpg_error_lines):
-            error_summaries.append(
-                "binpkg signed with at least one unknown key "
-                + f"(try running PORTAGE_TRUST_HELPER={portage_trust_helper}?)"
-            )
+            errors += 1
+            error_summaries.append("binpkg signed with at least one unknown 
key.")
+            error_summaries.extend(portage_trust_helper_msg)
         if _match_list(r"^\[GNUPG:\] TRUST_UNDEFINED", gpg_error_lines):
-            error_summaries.append(
-                f"binpkg signed with a known key of undefined trust "
-                + f"(try running PORTAGE_TRUST_HELPER={portage_trust_helper}?)"
-            )
+            errors += 1
+            error_summaries.append("binpkg signed with a known key of 
undefined trust.")
+            error_summaries.extend(portage_trust_helper_msg)
 
         # Don't show any summary if it's ambiguous, in case of
         # a malformed signature.
-        if len(error_summaries) > 1 or not error_summaries:
+        if errors > 1 or not errors:
             error_summaries = ["(none available)"]
 
         out = portage.output.EOutput()

Reply via email to