From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 537AB158074 for ; Thu, 19 Jun 2025 18:13:55 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 39485341F5F for ; Thu, 19 Jun 2025 18:13:55 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id E29321104E1; Thu, 19 Jun 2025 18:13:47 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id D63981104DE for ; Thu, 19 Jun 2025 18:13:47 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 880F9341F33 for ; Thu, 19 Jun 2025 18:13:47 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 01B682A08 for ; Thu, 19 Jun 2025 18:13:46 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1750356790.27bd0ed056b3b2ea2b64ead0a128ed0196062ee5.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/emerge-webrsync X-VCS-Directories: bin/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 27bd0ed056b3b2ea2b64ead0a128ed0196062ee5 X-VCS-Branch: master Date: Thu, 19 Jun 2025 18:13:46 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 3e5e35ed-c5de-41ec-baa6-5660e6b11f4a X-Archives-Hash: cb155aa01f73eec031b81dda96095b75 commit: 27bd0ed056b3b2ea2b64ead0a128ed0196062ee5 Author: Kerin Millar plushkava net> AuthorDate: Thu Jun 19 02:09:02 2025 +0000 Commit: Sam James gentoo org> CommitDate: Thu Jun 19 18:13:10 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=27bd0ed0 emerge-webrsync: have both signature checking routines employ common diagnostics Recently, the diagnostics shown by the check_file_signature_gpg() function in the event of a missing key were improved. Said commit did not adjust the diagnostics shown by the check_file_signature_gemato() function. That is, the former shows the new diagnostics whereas the latter continues to show the old diagnostics. Thus, one realises that there is an opportunity to unify them in this regard. Do so by introducing the assign_key() function and delegating to it the responsibility of testing for - and reacting to - a missing key. See-also: bf07fbe382a4a04c65dd76f286bcc061ba11728b Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> bin/emerge-webrsync | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index a705a59eef..005548cf90 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -260,16 +260,7 @@ check_file_signature_gemato() { local -a gemato_args local key - if [[ -n ${PORTAGE_GPG_KEY} ]] ; then - key="${PORTAGE_GPG_KEY}" - else - key="${EPREFIX}/usr/share/openpgp-keys/gentoo-release.asc" - fi - - if [[ ! -f "${key}" ]] ; then - eerror "${key} not available. Is sec-keys/openpgp-keys-gentoo-release installed?" - die "Needed keys unavailable! Install its package or set PORTAGE_GPG_KEY to the right path." - fi + assign_key gemato_args=( openpgp-verify-detached @@ -293,21 +284,7 @@ check_file_signature_gpg() { local signature=$1 file=$2 local fingerprint key - if [[ -n ${PORTAGE_GPG_KEY} ]] ; then - key="${PORTAGE_GPG_KEY}" - else - key="${EPREFIX}/usr/share/openpgp-keys/gentoo-release.asc" - fi - - if [[ ! -f "${key}" ]]; then - if [[ ${PORTAGE_GPG_KEY} ]]; then - eerror "PORTAGE_GPG_KEY does not appear to have been set correctly" - else - eerror "sec-keys/openpgp-keys-gentoo-release does not appear to be installed" - fi - die "${key@Q} does not exist (or is not a file)" - fi - + assign_key export GNUPGHOME if [[ ! ${GNUPGHOME=${PORTAGE_GPG_DIR}} ]]; then @@ -331,6 +308,23 @@ check_file_signature_gpg() { gpg_verify "${signature}" "${file}" } +assign_key() { + if [[ ${PORTAGE_GPG_KEY} ]]; then + key=${PORTAGE_GPG_KEY} + else + key=${EPREFIX}/usr/share/openpgp-keys/gentoo-release.asc + fi + + if [[ ! -f ${key} ]]; then + if [[ ${PORTAGE_GPG_KEY} ]]; then + eerror "PORTAGE_GPG_KEY does not appear to have been set correctly" + else + eerror "sec-keys/openpgp-keys-gentoo-release does not appear to be installed" + fi + die "${key@Q} does not exist (or is not a file)" + fi +} + gpg_fingerprint() { local -a fields