]> git.ipfire.org Git - thirdparty/ccache.git/commit
Improve handling of SOURCE_DATE_EPOCH
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 30 Jan 2021 18:35:54 +0000 (19:35 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 1 Feb 2021 19:27:14 +0000 (20:27 +0100)
commitcad2416291c042443cf0c045047c34a2e07e103a
treee06ab2e85012ebd1d31b691f4ff1a9865c082386
parentf24daacb3bfbd084c0a48566c864876cbc2fbf32
Improve handling of SOURCE_DATE_EPOCH

PR #755 (be1ed774) made it so that the value of SOURCE_DATE_EPOCH is
ignored if time_macros sloppiness is set. A downside of this is
naturally that the user has to set sloppiness if SOURCE_DATE_EPOCH is
set in the environment.

Insight: SOURCE_DATE_EPOCH actually only ever changes the result if the
source code contains __DATE__. __TIME__ is not an issue since ccache
disables the direct mode if __TIME__is present and the preprocessor mode
will then see the actual expansion regardless of any SOURCE_DATE_EPOCH
value. Finally, the __TIMESTAMP__ case is not applicable at all since
it’s not affected by SOURCE_DATE_EPOCH.

Therefore, make sure to only hash SOURCE_DATE_EPOCH if we find __DATE__.
The user then does not have to set sloppiness to get direct mode hits
for files that don’t contain __DATE__.
doc/MANUAL.adoc
src/ccache.cpp
src/hashutil.cpp
test/CMakeLists.txt
test/suites/base.bash
test/suites/source_date_epoch.bash [new file with mode: 0644]