commit: 7d91c82fa25bcf641ed96d3a0a6b4a99a9b0aa15
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Jun 15 18:09:58 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun 17 03:00:37 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7d91c82f
emerge-webrsync: perform minor refactoring upon check_file_signature()
This commit performs some minor refactoring upon the
check_file_signature() function, the exact nature of which is described
herewith.
Drop the 'if' command that is responsible for testing the value of the
'WEBRSYNC_VERIFY_SIGNATURE' variable and potentially displaying an
informational message. This responsibility is now handled by the
previously enclosed case statement by matching against an additional
pattern and deliberately falling through to the next. The maximal degree
of identation is thus reduced.
Refrain from assigning 1 to the 'r' variable as a foregone conclusion,
and drop the superfluous 'return' command. Should verification fail, the
die() function is called. Otherwise, the function shall always
implicitly return 0.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/emerge-webrsync | 48 +++++++++++++++++++++---------------------------
1 file changed, 21 insertions(+), 27 deletions(-)
diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index fba23610d8..71f01f8708 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -334,38 +334,32 @@ gpg_verify() {
check_file_signature() {
local signature=$1 file=$2
- local r=1
+ local r
- if [[ ${WEBRSYNC_VERIFY_SIGNATURE} != 0 ]]; then
- [[ ${PORTAGE_QUIET} -eq 1 ]] || einfo "Checking signature ..."
-
- case ${WEBRSYNC_VERIFY_SIGNATURE} in
- 1)
- check_file_signature_gemato "${signature}"
"${file}"
- r=$?
-
- if [[ ${r} -eq 127 ]] ; then
- ewarn "Falling back to gpg as gemato is
not installed"
- check_file_signature_gpg_unwrapped
"${signature}" "${file}"
- r=$?
- fi
-
- ;;
- 2)
+ case ${WEBRSYNC_VERIFY_SIGNATURE} in
+ [12])
+ if [[ ${PORTAGE_QUIET} -ne 1 ]]; then
+ einfo "Checking signature ..."
+ fi
+ ;;&
+ 1)
+ check_file_signature_gemato "${signature}" "${file}"
+ r=$?
+ if [[ ${r} -eq 127 ]] ; then
+ ewarn "Falling back to gpg as gemato is not
installed"
check_file_signature_gpg_unwrapped
"${signature}" "${file}"
r=$?
- ;;
- esac
+ fi
+ ;;
+ 2)
+ check_file_signature_gpg_unwrapped "${signature}"
"${file}"
+ r=$?
+ esac
- if [[ ${r} != 0 ]] ; then
- eerror "Error occurred in check_file_signature: ${r}.
Aborting."
- die "Verification error occured."
- fi
- else
- r=0
+ if [[ ${r} != 0 ]] ; then
+ eerror "Error occurred in check_file_signature: ${r}. Aborting."
+ die "Verification error occured."
fi
-
- return "${r}"
}
get_snapshot_timestamp() {