From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D44851581CA for ; Wed, 18 Jun 2025 02:33:33 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id BF7DD3415F0 for ; Wed, 18 Jun 2025 02:33:33 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id BAA7B1104D9; Wed, 18 Jun 2025 02:33:32 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id B3BC61104D9 for ; Wed, 18 Jun 2025 02:33:32 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6BFE53415EF for ; Wed, 18 Jun 2025 02:33:32 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 09B7E29EB for ; Wed, 18 Jun 2025 02:33:31 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1750214007.4f248a5a9d4f152824ec01da720cd093d614ba9a.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/emerge-webrsync X-VCS-Directories: bin/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 4f248a5a9d4f152824ec01da720cd093d614ba9a X-VCS-Branch: master Date: Wed, 18 Jun 2025 02:33:31 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 63bd35b7-8758-4388-b8d7-f05c02747f82 X-Archives-Hash: c320aed741b4f6a5642ad0bd29f21bd0 commit: 4f248a5a9d4f152824ec01da720cd093d614ba9a Author: Kerin Millar plushkava net> AuthorDate: Wed Jun 18 00:35:55 2025 +0000 Commit: Sam James gentoo org> CommitDate: Wed Jun 18 02:33:27 2025 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=4f248a5a emerge-webrsync: defer to the terminology of Unix Time Formal terminology is preferable to slapdash terminology. The following changes are made in that spirit. - rename get_utc_second_from_string() to get_unixtime_from_string() - rename get_utc_date_in_seconds() to get_unixtime() - rename the 'snapshot_date_seconds' variable to 'snapshot_unixtime' - rename the 'utc_time_in_secs' variable to 'unixtime' - rename the 'utc_seconds' variable to 'unixtime' Signed-off-by: Kerin Millar plushkava.net> Signed-off-by: Sam James gentoo.org> bin/emerge-webrsync | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index d7ad148c20..a8e70e0af1 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -169,21 +169,21 @@ do_tar() { } } -get_utc_date_in_seconds() { +get_unixtime() { date -u +"%s" } get_date_part() { - local utc_time_in_secs=$1 part=$2 + local unixtime=$1 part=$2 if [[ ${USERLAND} == BSD ]] ; then - date -r "${utc_time_in_secs}" -u +"${part}" + date -r "${unixtime}" -u +"${part}" else - date -d "@${utc_time_in_secs}" -u +"${part}" + date -d "@${unixtime}" -u +"${part}" fi } -get_utc_second_from_string() { +get_unixtime_from_string() { local s=$1 if [[ ${USERLAND} == BSD ]] ; then @@ -471,7 +471,7 @@ sync_local() { do_snapshot() { local ignore_timestamp=$1 date=$2 - local snapshot_timestamp utc_seconds have_files signature digest mirror file + local snapshot_timestamp have_files signature unixtime digest mirror file local -A suffix_by local -a tarballs @@ -525,11 +525,11 @@ do_snapshot() { have_files=0 fi else - utc_seconds=$(get_utc_second_from_string "${date}") + unixtime=$(get_unixtime_from_string "${date}") # Check that this snapshot is what the age it claims to be - if [[ ${snapshot_timestamp} -lt ${utc_seconds} || \ - ${snapshot_timestamp} -gt $(( utc_seconds + 2 * 86400 )) ]]; then + if [[ ${snapshot_timestamp} -lt ${unixtime} || \ + ${snapshot_timestamp} -gt $(( unixtime + 2 * 86400 )) ]]; then ewarn "Snapshot timestamp is not within acceptable period!" have_files=0 @@ -556,7 +556,7 @@ do_snapshot() { } do_latest_snapshot() { - local timestamp_{difference,problem} snapshot_date{,_seconds} approx_snapshot_time existing_timestamp start_{hour,time} + local timestamp_{difference,problem} snapshot_{date,unixtime} approx_snapshot_time existing_timestamp start_{hour,time} local min_time_diff attempts=0 einfo "Fetching most recent snapshot ..." @@ -571,7 +571,7 @@ do_latest_snapshot() { min_time_diff=$(( 2 * 60 * 60 )) existing_timestamp=$(get_repository_timestamp) - start_time=$(get_utc_date_in_seconds) + start_time=$(get_unixtime) start_hour=$(get_date_part "${start_time}" "%H") # Daily snapshots are created at 00:45 and are not @@ -582,16 +582,16 @@ do_latest_snapshot() { fi snapshot_date=$(get_date_part "${start_time}" "%Y%m%d") - snapshot_date_seconds=$(get_utc_second_from_string "${snapshot_date}") + snapshot_unixtime=$(get_unixtime_from_string "${snapshot_date}") while (( attempts++ < 40 )); do - (( snapshot_date_seconds -= 86400 )) + (( snapshot_unixtime -= 86400 )) # snapshots are created at 00:45 - (( approx_snapshot_time = snapshot_date_seconds + 86400 + 2700 )) + (( approx_snapshot_time = snapshot_unixtime + 86400 + 2700 )) (( timestamp_difference = existing_timestamp - approx_snapshot_time )) [[ ${timestamp_difference} -lt 0 ]] && (( timestamp_difference = -1 * timestamp_difference )) - snapshot_date=$(get_date_part "${snapshot_date_seconds}" "%Y%m%d") + snapshot_date=$(get_date_part "${snapshot_unixtime}" "%Y%m%d") timestamp_problem="" if [[ ${timestamp_difference} -eq 0 ]]; then