diff mbox series

[7/8] procps: fix runtime version when using git shallow tarball

Message ID 20250624104155.559827-8-yi.zhao@windriver.com
State New
Headers show
Series fix runtime versions | expand

Commit Message

Yi Zhao June 24, 2025, 10:41 a.m. UTC
The runtime version of procps is generated by 'git describe' command in
local/git-version-gen. But when using git shallow tarball,
git-version-gen can not get the correct version due to missing git
tag/commit messages. This actually breaks reproducibility, since the
generated binaries should be consistent regardless of the source code
packaging format.

Add a .tarball-version file in source directory. Then get-version-gen
can determine the version through this file instead of 'git describe'
command.

Before the fix:
root@intel-x86-64:~# ps -V
ps from procps-ng UNKNOWN
root@intel-x86-64:~# sysctl -V
sysctl from procps-ng UNKNOWN

After the fix:
root@intel-x86-64:~# ps -V
ps from procps-ng 4.0.5
root@intel-x86-64:~# sysctl -V
sysctl from procps-ng 4.0.5

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
---
 meta/recipes-extended/procps/procps_4.0.5.bb | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-extended/procps/procps_4.0.5.bb b/meta/recipes-extended/procps/procps_4.0.5.bb
index 2b41be3930..db05eb3449 100644
--- a/meta/recipes-extended/procps/procps_4.0.5.bb
+++ b/meta/recipes-extended/procps/procps_4.0.5.bb
@@ -29,6 +29,10 @@  EXTRA_OECONF = "--enable-skill --disable-modern-top"
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}"
 PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd"
 
+do_configure:prepend () {
+	[ ! -e ${S}/.tarball-version ] && echo ${PV} > ${S}/.tarball-version
+}
+
 do_install:append () {
 	install -d ${D}${base_bindir}
 	[ "${bindir}" != "${base_bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i; done