diff mbox series

glibc-locale: share source date epoch with glibc

Message ID 20250228203206.1979714-1-danismostlikely@gmail.com
State New
Headers show
Series glibc-locale: share source date epoch with glibc | expand

Commit Message

Dan McGregor Feb. 28, 2025, 8:32 p.m. UTC
From: Dan McGregor <dan.mcgregor@usask.ca>

Similar to [1], stash glibc's source date epoch file to be used by
the locale generation. This isn't used within the recipe itself,
but it does change the timestamps of the generated files to be
consistent with the main glibc packages. It also changes the
metadata in the resulting RPM to show the same build time as
glibc.

[1]: https://git.openembedded.org/openembedded-core/commit/?id=b996293b4c8ab7ff3ed852045d17290df29205df

Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca>
---
 meta/recipes-core/glibc/glibc-collateral.inc | 14 ++++++++++++++
 meta/recipes-core/glibc/glibc-package.inc    |  5 +++++
 2 files changed, 19 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-core/glibc/glibc-collateral.inc b/meta/recipes-core/glibc/glibc-collateral.inc
index 4f81f07da77..905e9338af4 100644
--- a/meta/recipes-core/glibc/glibc-collateral.inc
+++ b/meta/recipes-core/glibc/glibc-collateral.inc
@@ -10,3 +10,17 @@  do_configure[noexec] = "1"
 do_compile[noexec] = "1"
 
 do_install[depends] += "virtual/${MLPREFIX}libc:do_stash_locale"
+
+do_deploy_source_date_epoch[depends] += "virtual/${MLPREFIX}libc:do_stash_locale"
+do_deploy_source_date_epoch () {
+    mkdir -p ${SDE_DEPLOYDIR} ${SDE_DIR}
+    if [ -e "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale/__source_date_epoch.txt" ]; then
+        echo "Deploying SDE from glibc stash -> ${SDE_DEPLOYDIR}."
+        cp -p ${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale/__source_date_epoch.txt \
+            ${SDE_DEPLOYDIR}/__source_date_epoch.txt
+        cp -p ${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale/__source_date_epoch.txt \
+            ${SDE_FILE}
+    else
+        echo "SDE_FILE not found!"
+    fi
+}
diff --git a/meta/recipes-core/glibc/glibc-package.inc b/meta/recipes-core/glibc/glibc-package.inc
index 21f2200d19b..a6aee043453 100644
--- a/meta/recipes-core/glibc/glibc-package.inc
+++ b/meta/recipes-core/glibc/glibc-package.inc
@@ -215,6 +215,10 @@  do_stash_locale () {
 			cp ${D}${bindir}/$i $target/
 		fi
 	done
+
+	# Stash the source date epoch file so RPMs have the
+	# same build time.
+	cp -a "${SDE_FILE}" $dest/__source_date_epoch.txt
 }
 
 addtask do_stash_locale after do_install before do_populate_sysroot do_package
@@ -238,6 +242,7 @@  stash_locale_cleanup () {
 	for i in ${bashscripts}; do
 		rm -f $cleanupdir${bindir}/$i
 	done
+	rm -f $cleanupdir/__source_date_epoch.txt
 	rm -f $cleanupdir${bindir}/localedef
 	rm -rf $cleanupdir${datadir}/i18n
 	rm -rf $cleanupdir${libdir}/gconv