Reproducible Builds: Use SOURCE_DATE_EPOCH for build time if present
What does this MR do?
The gitlab-workhorse
package currently fails in the Arch Linux Reproducible Builds setup with this diff:
│ │ ├── readelf --wide --decompress --hex-dump=.rodata {}
│ │ │ @@ -356560,15 +356560,15 @@
│ │ │ 0x016a2cd0 6e74696d 652f6367 6f3a2000 00000000 ntime/cgo: .....
│ │ │ 0x016a2ce0 02000000 14000000 00000000 00000000 ................
│ │ │ 0x016a2cf0 02000000 14000000 00000000 00000000 ................
│ │ │ 0x016a2d00 0f0e0d0c 0b0a0908 07060504 03020100 ................
│ │ │ 0x016a2d10 01000000 00000000 00000000 000000c2 ................
│ │ │ 0x016a2d20 00000000 00000000 00000000 00000000 ................
│ │ │ 0x016a2d30 02000000 1c000000 24010000 24010000 ........$...$...
│ │ │ - 0x016a2d40 32303231 30333233 2e303032 31333500 20210323.002135.
│ │ │ + 0x016a2d40 32303231 30373038 2e313234 39323100 20210708.124921.
│ │ │ 0x016a2d50 d42b4454 01000000 9615e4c6 01000000 .+DT............
│ │ │ 0x016a2d60 d0971975 01000000 9e00aacc 00000000 ...u............
│ │ │ 0x016a2d70 410671db 01000000 411601f7 01000000 A.q.....A.......
│ │ │ 0x016a2d80 02000000 1a000000 49020000 49020000 ........I...I...
│ │ │ 0x016a2d90 01000000 00000000 00000000 00000000 ................
│ │ │ 0x016a2da0 63616c6c 20667261 6d652074 6f6f206c call frame too l
│ │ │ 0x016a2db0 61726765 70746872 6561645f 63726561 argepthread_crea
With this patch, we check if SOURCE_DATE_EPOCH
is set and use the value as a UTC timestamp if present.
This value is automatically set by various build systems, you can read more about it here: https://reproducible-builds.org/docs/source-date-epoch/
Screenshots or Screencasts (strongly suggested)
With the patch applied:
How to setup and validate locally (strongly suggested)
Build the binary with SOURCE_DATE_EPOCH=0
, the binary should then contain a 1970-01-01
build time. This can be verified with strings
and grep
as well.
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) -
I have tested this MR in all supported browsers, or it's not needed. -
I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.
Edited by kpcyrd