diff options
author | Fabian Groffen <grobian@gentoo.org> | 2018-02-28 20:31:15 +0100 |
---|---|---|
committer | Fabian Groffen <grobian@gentoo.org> | 2018-02-28 20:31:15 +0100 |
commit | 2fd3c876ab81f282671cb98fe924c92c329611a2 (patch) | |
tree | 44b8828d24b0e57c6c1cf0fe96bcb2b7c01201bf | |
parent | script/rsync-generation/hashgen: allow compilation on Darwin (diff) | |
download | prefix-2fd3c876.tar.gz prefix-2fd3c876.tar.bz2 prefix-2fd3c876.zip |
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
-rwxr-xr-x | scripts/rsync-generation/update-rsync-master.sh | 13 |
1 files changed, 12 insertions, 1 deletions
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=() |