commit:     f99eb91227918d5bf0cc531e78bd597c73b7ce1f
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Jul 24 16:09:10 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jul 26 10:22:41 2024 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f99eb912

emerge-webrsync: actually honour the sync-webrsync-verify-signature attribute

The repo_has_webrsync_verify variable was always being set as the empty
string, despite later being compared to 1 in the arithmetic context.
Have it work in the way that was originally intended. This also
eliminates a superfluous use of the has() function, which was the reason
for my inspecting the code in the first place.

Also, apply the exact same fix to emerge-delta-webrsync.

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

 bin/emerge-webrsync        | 9 +++++----
 misc/emerge-delta-webrsync | 9 +++++----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index caa4986da2..124bcaddcf 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -105,16 +105,17 @@ do_debug=0
 keep=false
 
 handle_pgp_setup() {
+       local attr repo_has_webrsync_verify webrsync_gpg
+
        # WEBRSYNC_VERIFY_SIGNATURE=0: disable PGP verification
        # WEBRSYNC_VERIFY_SIGNATURE=1: use gemato for verification, fallback to 
regular gpg
        # WEBRSYNC_VERIFY_SIGNATURE=2: use legacy FEATURES="webrsync-gpg"
        WEBRSYNC_VERIFY_SIGNATURE=1
 
-       has webrsync-gpg ${FEATURES} && webrsync_gpg=1 || webrsync_gpg=0
+       has webrsync-gpg ${FEATURES} && webrsync_gpg=1
 
-       repo_has_webrsync_verify=$(
-               has $(__repo_attr "${repo_name}" sync-webrsync-verify-signature 
| LC_ALL=C tr '[:upper:]' '[:lower:]') true yes
-       )
+       attr=$(__repo_attr "${repo_name}" sync-webrsync-verify-signature)
+       [[ ${attr,,} == @(true|yes) ]] && repo_has_webrsync_verify=1
 
        if [[ -n ${PORTAGE_TEMP_GPG_DIR} ]] || [[ ${repo_has_webrsync_verify} 
-eq 1 ]]; then
                # If FEATURES=webrsync-gpg is enabled then allow direct 
emerge-webrsync

diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index a788cdb0eb..8550c15fe0 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -165,16 +165,17 @@ if [[ ! -d $STATE_DIR ]]; then
 fi
 
 handle_pgp_setup() {
+       local attr repo_has_webrsync_verify webrsync_gpg
+
        # WEBRSYNC_VERIFY_SIGNATURE=0: disable PGP verification
        # WEBRSYNC_VERIFY_SIGNATURE=1: use gemato for verification, fallback to 
regular gpg
        # WEBRSYNC_VERIFY_SIGNATURE=2: use legacy FEATURES="webrsync-gpg"
        WEBRSYNC_VERIFY_SIGNATURE=1
 
-       has webrsync-gpg ${FEATURES} && webrsync_gpg=1 || webrsync_gpg=0
+       has webrsync-gpg ${FEATURES} && webrsync_gpg=1
 
-       repo_has_webrsync_verify=$(
-               has $(__repo_attr "${repo_name}" sync-webrsync-verify-signature 
| LC_ALL=C tr '[:upper:]' '[:lower:]') true yes
-       )
+       attr=$(__repo_attr "${repo_name}" sync-webrsync-verify-signature)
+       [[ ${attr,,} == @(true|yes) ]] && repo_has_webrsync_verify=1
 
        if [[ -n ${PORTAGE_TEMP_GPG_DIR} ]] || [[ ${repo_has_webrsync_verify} 
-eq 1 ]]; then
                # If FEATURES=webrsync-gpg is enabled then allow direct 
emerge-webrsync

Reply via email to