From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/git/
Date: Thu, 14 Dec 2023 04:30:57 +0000 (UTC) [thread overview]
Message-ID: <1702528253.1339a02103f57c456851d69d427bc130bcb671bc.sam@gentoo> (raw)
commit: 1339a02103f57c456851d69d427bc130bcb671bc
Author: Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 11 09:07:45 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Dec 14 04:30:53 2023 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1339a021
sync: git: include signing key and git revision in log output
Include the signing key and the git revision on verficiation if
verbose output is requested or on verification error.
Before
* Trusted signature found on top commit
After:
* Trusted signature found on top commit (git revision: refs/remotes/origin/master, signing key: F748E9B3C47E393CC24C8FAF7C2AC09CD98F2EDF)
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
Closes: https://github.com/gentoo/portage/pull/1206
Signed-off-by: Sam James <sam <AT> gentoo.org>
lib/portage/sync/modules/git/git.py | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/lib/portage/sync/modules/git/git.py b/lib/portage/sync/modules/git/git.py
index 44d739ce6b..8fdbf97de0 100644
--- a/lib/portage/sync/modules/git/git.py
+++ b/lib/portage/sync/modules/git/git.py
@@ -500,6 +500,7 @@ class GitSync(NewBase):
opts = self.options.get("emerge_config").opts
debug = "--debug" in opts
quiet = self.settings.get("PORTAGE_QUIET") == "1"
+ verbose = "--verbose" in opts
openpgp_env = self._get_openpgp_env(self.repo.sync_openpgp_key_path, debug)
@@ -534,35 +535,48 @@ class GitSync(NewBase):
"log.showsignature=0",
"log",
"-n1",
- "--pretty=format:%G?",
+ "--pretty=format:%G?%n%GF",
revision,
]
try:
- status = portage._unicode_decode(
+ lines = portage._unicode_decode(
subprocess.check_output(
rev_cmd,
cwd=portage._unicode_encode(self.repo.location),
env=env,
)
- ).strip()
+ ).splitlines()
except subprocess.CalledProcessError:
return False
+ status = lines[0].strip()
+ if len(lines) > 1:
+ signing_key = lines[1].strip()
+
if status == "G": # good signature is good
if not quiet:
- out.einfo("Trusted signature found on top commit")
+ message = "Trusted signature found on top commit"
+ if verbose:
+ message += (
+ f" (git revision: {revision}, signing key: {signing_key})"
+ )
+ out.einfo(message)
return True
if status == "U": # untrusted
- out.ewarn("Top commit signature is valid but not trusted")
+ out.ewarn(
+ f"Top commit signature is valid but not trusted (git revision: {revision}, signing key: {signing_key})"
+ )
return True
if status == "B":
- expl = "bad signature"
+ expl = (
+ f"bad signature using key {signing_key} on git revision {revision}"
+ )
elif status == "X":
- expl = "expired signature"
+ expl = f"expired signature using key {signing_key} on git revision {revision}"
elif status == "Y":
- expl = "expired key"
+ expl = f"expired key using key {signing_key} on git revision {revision}"
elif status == "R":
- expl = "revoked key"
+ expl = f"revoked key using key {signing_key} on git revision {revision}"
elif status == "E":
expl = "unable to verify signature (missing key?)"
elif status == "N":
next reply other threads:[~2023-12-14 4:31 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-14 4:30 Sam James [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-05-12 16:20 [gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/git/ Sam James
2023-10-31 0:35 Sam James
2023-10-22 19:03 Sam James
2023-10-22 19:03 Sam James
2023-10-22 19:03 Sam James
2023-08-17 6:59 Sam James
2023-08-17 6:53 Sam James
2023-02-27 6:15 Sam James
2023-02-25 23:22 Sam James
2023-02-24 9:22 Sam James
2023-02-24 9:22 Sam James
2023-02-24 9:22 Sam James
2022-12-21 1:28 Sam James
2022-12-21 1:28 Sam James
2022-12-21 1:28 Sam James
2022-11-20 3:12 Sam James
2022-07-03 0:56 Mike Gilbert
2020-07-02 22:08 Zac Medico
2018-07-23 19:58 Zac Medico
2018-07-23 18:52 Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1702528253.1339a02103f57c456851d69d427bc130bcb671bc.sam@gentoo \
--to=sam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox