Drillster/drone-volume-cache

Preserve timestamp for rsync?

Closed this issue · 4 comments

rsync -t

https://unix.stackexchange.com/questions/61586/how-to-tell-rsync-to-preserve-time-stamp-on-files-when-source-tree-has-a-mounted

This will make caching for timestamp based buildsystem more reliable, e.g., make.

nvm it seems like -a already includes -t.

OK, the real issue was more nuanced than I thought. Using drone-volume-cache made my Makefile rebuild certain steps unnecessarily. So I thought last modified timestamp for files is re-written. Actually it was opposite, some files' last modified timestamp weren't updated.

For example,

Right after Makefile build:

  • 2018-01-31 20:56:53.578703451 +0000 generated.h
  • 2018-01-31 20:56:36.466121582 +0000 source.h

after rebuilding and restore:

  • 2018-01-31 20:54:33.801955086 +0000 generated.h
  • 2018-01-31 20:56:36.466121582 +0000 source.h

Noticed that generated.h's timestamp went backward. I suspect that what's happening here is that, generated.h's timestamp changed after Makefile build, but the content isn't changed. And when drone-volume-cache plugin caches by rsync, rsync figured out that it didn't need to resync generated.h since the content is the same, so generate.h's timestamp is not updated.

OK please hold on let me investigate a bit, sorry for adding contradicting messages.

OK, the issue for me was that git clone step does not preserve last modified timestamp, not drone-volume-cache plugin. Since git doesn't store timestamp.