diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-12-02 08:07:37 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-12-02 08:07:37 +0000 |
commit | b5c55ff25897c707c41ce615dae2570aa1e7780e (patch) | |
tree | a7b2e232a035cbc7d15a99a27ac902c97fe5864d | |
parent | bb6b52b7d0dff0103cedbf3c13e81e3382cea86b (diff) | |
download | portage-b5c55ff25897c707c41ce615dae2570aa1e7780e.tar.gz portage-b5c55ff25897c707c41ce615dae2570aa1e7780e.tar.bz2 portage-b5c55ff25897c707c41ce615dae2570aa1e7780e.zip |
For consistent behavior in all timezones, make emerge-webrsync use UTC time for decisions about which snapshots to download.
svn path=/main/trunk/; revision=5154
-rwxr-xr-x | bin/emerge-webrsync | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync index 31d1e4f8b..be5f6d6d9 100755 --- a/bin/emerge-webrsync +++ b/bin/emerge-webrsync @@ -84,21 +84,20 @@ sync_local() { echo "Fetching most recent snapshot" -declare -i attempts=-1 +declare -i attempts=0 while (( $attempts < 40 )) ; do attempts=$(( attempts + 1 )) - #this too, sucks. it works in the interim though. - if [ "$USERLAND" == "BSD" ] || [ "$USERLAND" == "Darwin" ] ; then - daysbefore=$(expr $(date +"%s") - 86400 \* $attempts) - day=$(date -r $daysbefore +"%d") - month=$(date -r $daysbefore +"%m") - year=$(date -r $daysbefore +"%Y") - else - day=$(date -d "-$attempts day" +"%d") - month=$(date -d "-$attempts day" +"%m") - year=$(date -d "-$attempts day" +"%Y") - fi + # The snapshot for a given day is generated at 01:45 UTC on the following + # day, so the current day's snapshot (going by UTC time) hasn't been + # generated yet. Therefore, always start by looking for the previous day's + # snapshot (for attempts=1, subtract 1 day from the current UTC time). + daysbefore=$(expr $(date -u +"%s") - 86400 \* ${attempts}) + DATE_ARGS="-d @${daysbefore}" + [ "${USERLAND}" != "GNU" ] && DATE_ARGS="-r ${daysbefore}" + day=$(date ${DATE_ARGS} -u +"%d") + month=$(date ${DATE_ARGS} -u +"%m") + year=$(date ${DATE_ARGS} -u +"%Y") FILE_ORIG="portage-${year}${month}${day}.tar.bz2" |