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 <arturo.buzarra@digi.com>
This commit is contained in:
Arturo Buzarra 2021-06-02 19:28:55 +02:00 committed by Hector Palacios
parent 4e2fc007a1
commit b9599a6c80
2 changed files with 17 additions and 0 deletions

View File

@ -45,6 +45,12 @@ ZIP_INSTALLER_CFG="
DEY_IMAGE_INSTALLER = \"1\" 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=" BACKEND_REMOVAL_CFG="
DISTRO_FEATURES_remove = \"x11 wayland vulkan\" DISTRO_FEATURES_remove = \"x11 wayland vulkan\"
" "
@ -192,6 +198,7 @@ for platform in ${DY_PLATFORMS}; do
conf/local.conf conf/local.conf
printf "${RM_WORK_CFG}" >> conf/local.conf printf "${RM_WORK_CFG}" >> conf/local.conf
printf "${ZIP_INSTALLER_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 # Remove all desktop backend distro features if building framebuffer images
if [ "${DY_FB_IMAGE}" = "true" ]; then if [ "${DY_FB_IMAGE}" = "true" ]; then
printf "${BACKEND_REMOVAL_CFG}" >> conf/local.conf printf "${BACKEND_REMOVAL_CFG}" >> conf/local.conf

View File

@ -49,6 +49,12 @@ ZIP_INSTALLER_CFG="
DEY_IMAGE_INSTALLER = \"1\" 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)" REPO="$(which repo)"
error() { error() {
@ -260,6 +266,10 @@ for platform in ${DY_PLATFORMS}; do
if [ -n "${DY_EXTRA_LOCAL_CONF}" ]; then if [ -n "${DY_EXTRA_LOCAL_CONF}" ]; then
printf "%s\n" "${DY_EXTRA_LOCAL_CONF}" >> conf/local.conf printf "%s\n" "${DY_EXTRA_LOCAL_CONF}" >> conf/local.conf
fi 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 # 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 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 sed -i -e "/meta-digi-dey/a\ ${YOCTO_INST_DIR}/sources/meta-digi-mfg \\\\" conf/bblayers.conf