aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts
diff options
context:
space:
mode:
authorOleksandr Hnatiuk <ohnatiuk@cisco.com>2024-08-28 21:20:04 -0700
committerDamjan Marion <dmarion@0xa5.net>2024-12-12 15:48:32 +0000
commit20956385c7f5bd308f4a0f6a6fdca3a77425b300 (patch)
tree8e74e5652a8fbaab146fd1c7892304246fac4183 /src/scripts
parentaac5e686f30f241ad147dad3b939b0e267b3a3ea (diff)
build: use VPP_BUILD_TOPDIR from environment if set
Commit 3d14f036199d added the possibility to use `VPP_BUILD_USER` and `VPP_BUILD_HOST` from environment (if they are set) to avoid reproducibility issues by hard-coding such data in the build system. However, there's no way to provide VPP_BUILD_TOPDIR externally. Add this feature to improve binary reproducibility. Type: improvement Change-Id: I3a7ee47d75af9635b636fa3750a3688314eaa60d Signed-off-by: Oleksandr Hnatiuk <ohnatiuk@cisco.com>
Diffstat (limited to 'src/scripts')
-rwxr-xr-xsrc/scripts/generate_version_h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/scripts/generate_version_h b/src/scripts/generate_version_h
index cdcdf5dd42a..e8379550186 100755
--- a/src/scripts/generate_version_h
+++ b/src/scripts/generate_version_h
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
: ${VPP_BUILD_USER:=$(whoami)}
: ${VPP_BUILD_HOST:=$(hostname)}
+: ${VPP_BUILD_TOPDIR:=$(git rev-parse --show-toplevel 2> /dev/null)}
DATE_FMT="+%Y-%m-%dT%H:%M:%S"
SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}"
VPP_BUILD_DATE=$(date -u -d "@$SOURCE_DATE_EPOCH" "$DATE_FMT" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "$DATE_FMT" 2>/dev/null || date -u "$DATE_FMT")
@@ -27,7 +28,7 @@ cat > ${1} << __EOF__
#define VPP_BUILD_DATE "$VPP_BUILD_DATE"
#define VPP_BUILD_USER "$VPP_BUILD_USER"
#define VPP_BUILD_HOST "$VPP_BUILD_HOST"
-#define VPP_BUILD_TOPDIR "$(git rev-parse --show-toplevel 2> /dev/null)"
+#define VPP_BUILD_TOPDIR "$VPP_BUILD_TOPDIR"
#define VPP_BUILD_VER "$(scripts/version)"
#endif
__EOF__