commit: 17f8e55c1950b4d6825d854d940bac448394a125
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Jun 15 22:02:29 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 16 01:16:55 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=17f8e55c
emerge-webrsync: treat have_files as a quasi-boolean in do_snapshot()
As concerns the do_snapshot() function, test the 'have_files' variable
for arithmetical truthfulness, rather than compare it directly against 0
or 1. Doing so improves the legibility of the code.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/emerge-webrsync | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index e024365fa1..f5570996e6 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -477,7 +477,7 @@ do_snapshot() {
&& have_files=1
fi
- if [[ ${have_files} -eq 0 ]] ; then
+ if (( ! have_files )); then
fetch_file "${mirror}/snapshots/${digest}"
"${digest}" \
&& fetch_file
"${mirror}/snapshots/${signature}" "${signature}" \
&& fetch_file "${mirror}/snapshots/${file}"
"${file}" \
@@ -491,7 +491,7 @@ do_snapshot() {
# we want to try and retrieve
# from a different mirror
#
- if [[ ${have_files} -eq 1 ]]; then
+ if (( have_files )); then
[[ ${PORTAGE_QUIET} -eq 1 ]] || einfo "Getting
snapshot timestamp ..."
snapshot_timestamp=$(get_snapshot_timestamp
"${DISTDIR}/${file}")
@@ -514,7 +514,7 @@ do_snapshot() {
fi
fi
- if [[ ${have_files} -eq 1 ]]; then
+ if (( have_files )); then
break
else
# Remove files and use a different mirror
@@ -522,10 +522,10 @@ do_snapshot() {
fi
done
- [[ ${have_files} -eq 1 ]] && break
+ (( have_files )) && break
done
- if [[ ${have_files} -eq 1 ]]; then
+ if (( have_files )); then
sync_local "${DISTDIR}/${file}" && r=0
else
ewarn "${date} snapshot was not found"