commit:     2fd3c876ab81f282671cb98fe924c92c329611a2
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 28 19:31:15 2018 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Feb 28 19:31:15 2018 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=2fd3c876

scripts/rsync-generation/update-rsync-master: ensure mtime always moves forwards

relying on times stored in git is never going to work well, so pick a
time that we reasonably sync between multiple generators

 scripts/rsync-generation/update-rsync-master.sh | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/scripts/rsync-generation/update-rsync-master.sh 
b/scripts/rsync-generation/update-rsync-master.sh
index ef30f387d5..86a9a4773b 100755
--- a/scripts/rsync-generation/update-rsync-master.sh
+++ b/scripts/rsync-generation/update-rsync-master.sh
@@ -1,5 +1,7 @@
 #!/usr/bin/env bash
 
+SCRIPTSTARTTIME=$(date +%s)
+
 # get keys for ssh and signing
 eval $(env SHELL=/bin/bash keychain -q --noask --eval)
 
@@ -43,6 +45,15 @@ apply_git_mtimes() {
        local from=$1
        local to=$2
 
+       # As of 28-02-2018 we no longer take author or committer time,
+       # because both can be garbage (in the future, or terribly in the
+       # past).  Instead, we take the starttime of this script, rounded to
+       # the minute.  Because all generators should have this set off from
+       # cron at the same start-time, this should result in the trees
+       # staying in sync.  A scheduled synchronisation should wipe out any
+       # differences that may happen.
+       local thistime="$(((SCRIPTSTARTTIME / 60) * 60))"
+
        local ts=0
        local files=()
        {
@@ -54,7 +65,7 @@ apply_git_mtimes() {
                        [0-9][0-9][0-9]*)
                                if [[ ${ts} -gt 0 ]] ; then
                                        [[ ${#files[@]} == 0 ]] || \
-                                               touch -m -d @${ts} -- 
"${files[@]}"
+                                               touch -m -d @${thistime} -- 
"${files[@]}"
                                fi
                                ts=${line}
                                files=()

Reply via email to