Embed _psl_compile_time derived from $SOURCE_DATE_EPOCH if set
Making packages build byte-for-byte reproducibly from a given toolchain+source makes it much easier to corroborate builds by testing against other build infrastructure. By default, libpsl currently embeds the current unix timestamp in _psl_compile_time, which makes it bytewise incompatible if it is rebuild even on the same machine one second later. See https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal for more information about $SOURCE_DATE_EPOCH.
This commit is contained in:
parent
37858be73f
commit
f9a1bdcf80
|
@ -157,6 +157,7 @@ int main(int argc, const char **argv)
|
|||
struct stat st;
|
||||
size_t cmdsize = 16 + strlen(argv[1]);
|
||||
char *cmd = alloca(cmdsize), checksum[64] = "";
|
||||
const char *source_date_epoch = NULL;
|
||||
|
||||
#if 0
|
||||
/* include library code did not generate punycode, so let's do it for the builtin data */
|
||||
|
@ -177,7 +178,10 @@ int main(int argc, const char **argv)
|
|||
if (stat(argv[1], &st) != 0)
|
||||
st.st_mtime = 0;
|
||||
fprintf(fpout, "static time_t _psl_file_time = %lu;\n", st.st_mtime);
|
||||
fprintf(fpout, "static time_t _psl_compile_time = %lu;\n", time(NULL));
|
||||
if ((source_date_epoch = getenv("SOURCE_DATE_EPOCH")))
|
||||
fprintf(fpout, "static time_t _psl_compile_time = %lu;\n", atol(source_date_epoch));
|
||||
else
|
||||
fprintf(fpout, "static time_t _psl_compile_time = %lu;\n", time(NULL));
|
||||
fprintf(fpout, "static const char _psl_sha1_checksum[] = \"%s\";\n", checksum);
|
||||
fprintf(fpout, "static const char _psl_filename[] = \"%s\";\n", argv[1]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue