commit:     7dcae1c07118505a324f1c5d4eb1f37ca9df8999
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Jun 16 12:15:53 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun 17 03:00:40 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7dcae1c0

emerge-webrsync: clarify behaviour where gpg(1) is missing

Presently, the check_file_signature_gpg_unwrapped() function checks
whether gpg(1) is in PATH. In order to find out what happens in the case
that the check fails, it is necessary to read a comparatively long
branch of code. Remedy this by inverting the sense of the test and
making it clear that an exception shall be thrown where gpg(1) is found
to be missing.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/emerge-webrsync | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index d73361e6ce..37852d9472 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -288,7 +288,9 @@ check_file_signature_gpg_unwrapped() {
        local -x GNUPGHOME
        local key
 
-       if type -P gpg > /dev/null; then
+       if ! type -P gpg > /dev/null; then
+               die "cannot check signature: gpg binary not found"
+       else
                if [[ -n ${PORTAGE_GPG_KEY} ]] ; then
                        key="${PORTAGE_GPG_KEY}"
                else
@@ -318,8 +320,6 @@ check_file_signature_gpg_unwrapped() {
                        # problem).
                        die "signature verification failed"
                fi
-       else
-               die "cannot check signature: gpg binary not found"
        fi
 }
 

Reply via email to