commit:     93c443002a755862b3f4aae2f3066578734f45ca
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Jun 19 00:54:22 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 19 18:13:09 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=93c44300

emerge-webrsync: don't always abort because PORTAGE_GPG_DIR is empty/unset

A recent commit improved upon the way in which the fallback path from
gemato to gpg(1) is implemented. However, it also made it impossible to
use emerge-webrsync in the case that all these conditions hold true:

- PGP verification hasn't been disabled
- the 'FEATURES' variable doesn't contain "webrsync-gpg"
- gemato cannot be found in 'PATH'
- the 'PORTAGE_GPG_DIR' variable is unset or empty

The symptom of this regression is depicted below.

 * app-portage/gemato does not appear to be installed. Falling back to gpg.
 * PGP verification method: legacy gpg
emerge-webrsync: Please set PORTAGE_GPG_DIR in make.conf!

Rectify this defect by re-positioning the test for whether the
'PORTAGE_GPG_DIR' variable is empty, thereby ensuring that it is only
conducted if the 'FEATURES' variable is found to contain "webrsync-gpg".

Also, revise the diagnostic message so as to be more formal and
matter-of-fact in tone.

Fixes: b54fced4a5a8310bc65972de5b284b249c61315b
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 c5c16eaf81..22df8ce635 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -119,6 +119,9 @@ handle_pgp_setup() {
                # Discourage the use of the deprecated "webrsync-gpg" feature
                # because it prevents the use of gemato for verification.
                ewarn "FEATURES=webrsync-gpg is deprecated, see the 
make.conf(5) man page."
+               if [[ ! ${PORTAGE_GPG_DIR} ]]; then
+                       die "PORTAGE_GPG_DIR is unset or empty (the 
webrsync-gpg feature requires that it be set)"
+               fi
                WEBRSYNC_VERIFY_SIGNATURE=2
        elif ! type -P gemato > /dev/null; then
                # Fall back to conventional verification with gpg(1).
@@ -149,9 +152,6 @@ handle_pgp_setup() {
                PORTAGE_GPG_DIR=${PORTAGE_TEMP_GPG_DIR}
        fi
 
-       if [[ ${WEBRSYNC_VERIFY_SIGNATURE} == 2 && -z "${PORTAGE_GPG_DIR}" ]]; 
then
-               die "Please set PORTAGE_GPG_DIR in make.conf!"
-       fi
 }
 
 do_tar() {

Reply via email to