commit:     3f1b6a725c17784c929d4309a207e6788d8854d5
Author:     Florian Albrechtskirchinger <falbrechtskirchinger <AT> gmail <DOT> 
com>
AuthorDate: Sun Mar  1 03:25:56 2026 +0000
Commit:     Florian Albrechtskirchinger <falbrechtskirchinger <AT> gmail <DOT> 
com>
CommitDate: Sun Mar  1 03:56:13 2026 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=3f1b6a72

sys-fs/bcachefs-kmod: allow dynamic versioning in live builds

Stop hardcoding VERSION in the Makefile.

The Makefile determines VERSION in one of two (relevant) ways:
* If a .git directory is present, it uses git-describe.
* Otherwise, it reads the contents of a .version file.

Write ${PV} to a .version file to let the Makefile inject the
git-describe output for live builds.

This provides a more accurate version string (including the commit hash)
in modinfo rather than a generic and unhelpful "9999".

Signed-off-by: Florian Albrechtskirchinger <falbrechtskirchinger <AT> gmail.com>

 sys-fs/bcachefs-kmod/bcachefs-kmod-1.36.1.ebuild | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/sys-fs/bcachefs-kmod/bcachefs-kmod-1.36.1.ebuild 
b/sys-fs/bcachefs-kmod/bcachefs-kmod-1.36.1.ebuild
index 16eae0a7e3..4e57ea69d8 100644
--- a/sys-fs/bcachefs-kmod/bcachefs-kmod-1.36.1.ebuild
+++ b/sys-fs/bcachefs-kmod/bcachefs-kmod-1.36.1.ebuild
@@ -87,13 +87,18 @@ src_unpack() {
 src_prepare() {
        default
 
-       sed -i s/^VERSION=.*$/VERSION=${PV}/ Makefile || die
+       # Live builds will overwrite .version with git-describe output
+       echo "${PV}" > .version || die
        emake DESTDIR="${WORKDIR}" PREFIX="/module" install_dkms
 }
 
 src_compile() {
-       local module_src="module/src/${PN%-*}-${PV}"
-       local modlist=( 
"bcachefs=:../${module_src}:../${module_src}/src/fs/bcachefs" )
+       local dirs=( "${WORKDIR}/module/src/${PN%-*}-"* )
+       local module_src="${dirs[0]}"
+
+       [[ -d "${module_src}" ]] || die
+
+       local modlist=( "bcachefs=:${module_src}:${module_src}/src/fs/bcachefs" 
)
        local modargs=(
                KDIR=${KV_OUT_DIR}
        )

Reply via email to