1 |
commit: 2fd3c876ab81f282671cb98fe924c92c329611a2 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 28 19:31:15 2018 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 28 19:31:15 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=2fd3c876 |
7 |
|
8 |
scripts/rsync-generation/update-rsync-master: ensure mtime always moves forwards |
9 |
|
10 |
relying on times stored in git is never going to work well, so pick a |
11 |
time that we reasonably sync between multiple generators |
12 |
|
13 |
scripts/rsync-generation/update-rsync-master.sh | 13 ++++++++++++- |
14 |
1 file changed, 12 insertions(+), 1 deletion(-) |
15 |
|
16 |
diff --git a/scripts/rsync-generation/update-rsync-master.sh b/scripts/rsync-generation/update-rsync-master.sh |
17 |
index ef30f387d5..86a9a4773b 100755 |
18 |
--- a/scripts/rsync-generation/update-rsync-master.sh |
19 |
+++ b/scripts/rsync-generation/update-rsync-master.sh |
20 |
@@ -1,5 +1,7 @@ |
21 |
#!/usr/bin/env bash |
22 |
|
23 |
+SCRIPTSTARTTIME=$(date +%s) |
24 |
+ |
25 |
# get keys for ssh and signing |
26 |
eval $(env SHELL=/bin/bash keychain -q --noask --eval) |
27 |
|
28 |
@@ -43,6 +45,15 @@ apply_git_mtimes() { |
29 |
local from=$1 |
30 |
local to=$2 |
31 |
|
32 |
+ # As of 28-02-2018 we no longer take author or committer time, |
33 |
+ # because both can be garbage (in the future, or terribly in the |
34 |
+ # past). Instead, we take the starttime of this script, rounded to |
35 |
+ # the minute. Because all generators should have this set off from |
36 |
+ # cron at the same start-time, this should result in the trees |
37 |
+ # staying in sync. A scheduled synchronisation should wipe out any |
38 |
+ # differences that may happen. |
39 |
+ local thistime="$(((SCRIPTSTARTTIME / 60) * 60))" |
40 |
+ |
41 |
local ts=0 |
42 |
local files=() |
43 |
{ |
44 |
@@ -54,7 +65,7 @@ apply_git_mtimes() { |
45 |
[0-9][0-9][0-9]*) |
46 |
if [[ ${ts} -gt 0 ]] ; then |
47 |
[[ ${#files[@]} == 0 ]] || \ |
48 |
- touch -m -d @${ts} -- "${files[@]}" |
49 |
+ touch -m -d @${thistime} -- "${files[@]}" |
50 |
fi |
51 |
ts=${line} |
52 |
files=() |