summaryrefslogtreecommitdiffstats
path: root/src/pkg/CMakeLists.txt
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2023-10-18 21:18:32 +0000
committerDamjan Marion <dmarion@0xa5.net>2023-10-26 12:09:44 +0000
commit5ca8bfcacb3be58c46965ab52fba72ac6dfb828c (patch)
treed50ba1ac74b752d3fea76bedc07b638024a28da7 /src/pkg/CMakeLists.txt
parente9d7babde07ea93af54336200dbd65cc64bbd7ff (diff)
build: allow for reproducible builds
Setting and using the SOURCE_DATE_EPOCH variable takes care of most of the magic necessary. https://reproducible-builds.org/docs/source-date-epoch/ vpp-ext-deps packages after this change is being built with that date set to date of the last modification of the subtree (similar logic to deriving the "number" for the package version) For the rest of the packages, pinning the following three variables should result in bit-identical artifacts across multiple runs: export SOURCE_DATE_EPOCH=$(date +%s) export VPP_BUILD_HOST="buildhost" export VPP_BUILD_USER="builduser" Add a blurb in the docs describing this new functionality. Type: improvement Change-Id: I71b085f0577b2358aa98f01dafd8e392239420a6 Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Diffstat (limited to 'src/pkg/CMakeLists.txt')
-rw-r--r--src/pkg/CMakeLists.txt17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/pkg/CMakeLists.txt b/src/pkg/CMakeLists.txt
index 892ef71fb5e..5fa2826ad9a 100644
--- a/src/pkg/CMakeLists.txt
+++ b/src/pkg/CMakeLists.txt
@@ -18,8 +18,23 @@ endif()
get_cmake_property(VPP_COMPONENTS COMPONENTS)
string(REPLACE ";" " " VPP_COMPONENTS "${VPP_COMPONENTS}")
+##############################################################################
+# pinned timestamp for reproducible builds
+##############################################################################
+set(VPP_SOURCE_DATE_EPOCH
+ ""
+ CACHE
+ STRING "Artifact build timestamp for reproducible builds"
+)
+
+if(VPP_SOURCE_DATE_EPOCH STREQUAL "")
+ set(VPP_TIMESTAMP_ARG "")
+else()
+ set(VPP_TIMESTAMP_ARG "--date=@${VPP_SOURCE_DATE_EPOCH}")
+endif()
+
execute_process(
- COMMAND date -R
+ COMMAND date -R ${VPP_TIMESTAMP_ARG}
OUTPUT_VARIABLE TIMESTAMP
OUTPUT_STRIP_TRAILING_WHITESPACE
)