Closed avtobiff closed 2 years ago
mime_types_SUITE.erl needs work.
It would be better to handle
+deterministic
viaconfigure.ac
, and that would have the added benefit of also allowing an--enable-deterministic-build
option toconfigure
. This patch supports this new option while also still handling theYAWS_DETERMINISTIC_BUILD
env var:
Great!
+DEBUGINFO_OR_DETERMINISTIC= +if test "x${YAWS_DETERMINISTIC_BUILD}" = "x"; then
- DEBUGINFO_OR_DETERMINISTIC=+debug_info +else
- DEBUGINFO_OR_DETERMINISTIC=+deterministic +fi
Is there no use case where one would like to build with both
+deterministic
and +debug_info
? Maybe they implicitly are
mutually exclusive?
Furthermore, should --enable-deterministic-build
also set
YAWS_DETERMINISTIC_BUILD=true
SOURCE_DATE_EPOCH=$(date +%s)
Perhaps SOURCE_DATE_EPOCH
could be set implicitly by
--enable-deterministic-build
, but another configure
option
can be introduced to set it explicitly e.g. --source-date-epoch
.
It should still be overridable from the environment though.
With this patch, I think changes to
examples/src/Makefile.am
andexamples/src/erlc_flags.mk
aren't needed.
Yeah, I know it is hacky; but I don't really know autotools...
Out of curiousity, you don't happen to know why make -C testsuites
break
with two successive runs if +deterministic
is used? I'm guessing that the
make dependency files (.Pbeam) maybe don't include enough data to build
a proper dependency graph.
With the last commit diffoscope reports only different timestamps of the
installed files, when building make all doc apps
.
Please review.
Fixing mime_types_SUITE is still needed.
When the tests pass and the review is approved I'll squash and write a proper commit message.
This PR is ready for final review.
I'm still working on reviewing this, thanks for your patience.
I modified this a bit, and rebased it to master
. Thanks!
This commit creates a deterministic build environment, which enables reproducible builds.
Hardcode include path in generated mime_types.erl
If YAWS_DETERMINISTIC_BUILD is set, set the +deterministic compiler flag.
Remove +deterministic when building tests
The *_SUITE_data directories will not be handled correctly when +determenistic is used. When the beam files are built once, they will try to rebuild on the next make invocation and it will not work. I.e. if the beam is built, it will be built again. This breaks the pattern make && make install.
Generate deterministic www/*/Makefile
Several things are taken from the build environment when building, they are not needed to build or use the examples and are hence hardcoded or just removed.
The SHELL variable in www/code/Makefile and www/shoppingcart/Makefile is taken from the build environment when generated. To enable reproducible builds hardcode SHELL = /bin/sh.
Omit build environment paths.
Remove calls to ac-aux/missing and ac-aux/install-sh, they include absolute build environment paths.
See #446