minifi-cpp: fix reproducibility issue

Minifi-cpp will add a build identifier to the binary. If not specified,
a random build identifier will be generated for each build. This breaks
reproducibility. Set BUILD_IDENTIFIER to ${PV} to ensure the identifier
remains constant across builds.

Additionally, set BUILD_DATE to SOURCE_DATE_EPOCH to use reproducible
timestamp.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Yi Zhao 2025-09-19 11:33:35 +08:00 committed by Khem Raj
parent c0226393ba
commit 00fa5e02f1
No known key found for this signature in database
GPG Key ID: BB053355919D3314
2 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,34 @@
From ee9722731b3f9cfc3d8e338ab09bc0ad409a6941 Mon Sep 17 00:00:00 2001
From: Yi Zhao <yi.zhao@windriver.com>
Date: Thu, 18 Sep 2025 14:43:11 +0000
Subject: [PATCH] generateVersion.sh: set BUILD_DATE to SOURCE_DATE_EPOCH
Use SOURCE_DATE_EPOCH to set BUILD_DATE to improve reproducibility.
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
---
generateVersion.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/generateVersion.sh b/generateVersion.sh
index 0b50a16..96cc3ae 100755
--- a/generateVersion.sh
+++ b/generateVersion.sh
@@ -25,7 +25,11 @@ flags=$6
extensions=$7
buildident=$8
-date=$(date +%s)
+if [ -n "${SOURCE_DATE_EPOCH}" ]; then
+ date=$(date -u -d "@${SOURCE_DATE_EPOCH}" +%s)
+else
+ date=$(date +%s)
+fi
if [ -d "${src_dir}"/.git ]; then
buildrev=$(git -C "${src_dir}" log -1 --pretty=format:"%H")
--
2.48.1

View File

@ -28,6 +28,7 @@ SRC_URI = "git://github.com/apache/nifi-minifi-cpp.git;protocol=https;branch=mai
file://0007-libsodium-aarch64-set-compiler-attributes-after-including-arm_.patch \
file://0008-MINIFICPP-2553-CMP0065-OLD-removed-in-cmake-4.0-remo.patch \
file://0001-Add-missing-include-for-malloc-free.patch;patchdir=thirdparty/fmt-src \
file://0001-generateVersion.sh-set-BUILD_DATE-to-SOURCE_DATE_EPO.patch \
file://systemd-volatile.conf \
file://sysvinit-volatile.conf \
"
@ -114,6 +115,7 @@ EXTRA_OECMAKE = " \
-DFETCHCONTENT_SOURCE_DIR_FMT=${S}/thirdparty/fmt-src \
-DFETCHCONTENT_SOURCE_DIR_SPDLOG=${S}/thirdparty/spdlog-src \
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '-DENABLE_SYSTEMD=ON', '-DENABLE_SYSTEMD=OFF', d)} \
-DBUILD_IDENTIFIER=${PV} \
"
PACKAGECONFIG ??= "libarchive expression-language"