haniceboy / gyp

Automatically exported from code.google.com/p/gyp
0 stars 0 forks source link

cmd_copy modifies source file changetime #312

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Our autobuild (buildbot) does the following steps on every iteration:

# remove leftover cruft
> git clean -dfx
> git reset --hard HEAD

# regenerate makefile
> gyp

> make

In gyp's make.py, we have
cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@")

On Linux, ln will update the changetime of the source file as visible by stat 
(since the reference count has changed).

A subsequent git --reset hard HEAD on the source file will notice the 
difference and pull down a new copy, updating all the timestamps.

So with this type of build process, any files that are the source of a copy 
rule will always be dirty for the next build iteration.

So I think that either cmd_copy should just be a 'cp', or cmd_copy needs to do 
some gymnastics with 'touch' or something to reset the changetime to what it 
was, if that is possible.

There is an option to git config, core.trustctime, so you can prevent that 
behavior.  Still, I think having a conservative copy that doesn't modify the 
source files might be better.

Original issue reported on code.google.com by rjogr...@google.com on 14 Dec 2012 at 11:16