From b9599a6c8073b633b6b94b015cf54f9ea79f0164 Mon Sep 17 00:00:00 2001 From: Arturo Buzarra Date: Wed, 2 Jun 2021 19:28:55 +0200 Subject: [PATCH] build.sh: add support to set build timestamp By default is enabled the reproducible builds feature and to provide a real timestamp for the build system, we include it in our local.conf file. https://onedigi.atlassian.net/browse/DEL-7574 Signed-off-by: Arturo Buzarra --- sdk/build-github.sh | 7 +++++++ sdk/build.sh | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/sdk/build-github.sh b/sdk/build-github.sh index d5885aa09..437ec5f8f 100755 --- a/sdk/build-github.sh +++ b/sdk/build-github.sh @@ -45,6 +45,12 @@ ZIP_INSTALLER_CFG=" DEY_IMAGE_INSTALLER = \"1\" " +SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}" +BUILD_TIMESTAMP=" +SOURCE_DATE_EPOCH = \"${SOURCE_DATE_EPOCH}\" +REPRODUCIBLE_TIMESTAMP_ROOTFS = \"${SOURCE_DATE_EPOCH}\" +" + BACKEND_REMOVAL_CFG=" DISTRO_FEATURES_remove = \"x11 wayland vulkan\" " @@ -192,6 +198,7 @@ for platform in ${DY_PLATFORMS}; do conf/local.conf printf "${RM_WORK_CFG}" >> conf/local.conf printf "${ZIP_INSTALLER_CFG}" >> conf/local.conf + printf "${BUILD_TIMESTAMP}" >> conf/local.conf # Remove all desktop backend distro features if building framebuffer images if [ "${DY_FB_IMAGE}" = "true" ]; then printf "${BACKEND_REMOVAL_CFG}" >> conf/local.conf diff --git a/sdk/build.sh b/sdk/build.sh index f5a2e47ff..cb8b75df9 100755 --- a/sdk/build.sh +++ b/sdk/build.sh @@ -49,6 +49,12 @@ ZIP_INSTALLER_CFG=" DEY_IMAGE_INSTALLER = \"1\" " +SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}" +BUILD_TIMESTAMP=" +SOURCE_DATE_EPOCH = \"${SOURCE_DATE_EPOCH}\" +REPRODUCIBLE_TIMESTAMP_ROOTFS = \"${SOURCE_DATE_EPOCH}\" +" + REPO="$(which repo)" error() { @@ -260,6 +266,10 @@ for platform in ${DY_PLATFORMS}; do if [ -n "${DY_EXTRA_LOCAL_CONF}" ]; then printf "%s\n" "${DY_EXTRA_LOCAL_CONF}" >> conf/local.conf fi + # Add build timestamp + if [ -n "${BUILD_TIMESTAMP}" ]; then + printf "${BUILD_TIMESTAMP}" >> conf/local.conf + fi # Check if it is a manufacturing job and, if the mfg layer is not there, add it if [ "${DY_MFG_IMAGE}" = "true" ] && ! grep -qs "meta-digi-mfg" conf/bblayers.conf; then sed -i -e "/meta-digi-dey/a\ ${YOCTO_INST_DIR}/sources/meta-digi-mfg \\\\" conf/bblayers.conf