linux-info.eclass: Support Makefiles that set vars to a non-static value

Previously, the Makefile had to define version variables
be a string literal.
This change will support both methods.

Closes: https://bugs.gentoo.org/490328

Signed-off-by: Mike Pagano <mpagano@gentoo.org>
This commit is contained in:
Mike Pagano
2021-09-02 06:59:48 -04:00
parent 19400683f1
commit d1ea596f03
+5 -8
View File
@@ -539,14 +539,11 @@ get_version() {
# And contrary to existing functions I feel we shouldn't trust the
# directory name to find version information as this seems insane.
# So we parse ${KERNEL_MAKEFILE}. We should be able to trust that
# the Makefile is simple enough to use the noexec extract function.
# This has been true for every release thus far, and it's faster
# than using make to evaluate the Makefile every time.
KV_MAJOR=$(getfilevar_noexec VERSION "${KERNEL_MAKEFILE}")
KV_MINOR=$(getfilevar_noexec PATCHLEVEL "${KERNEL_MAKEFILE}")
KV_PATCH=$(getfilevar_noexec SUBLEVEL "${KERNEL_MAKEFILE}")
KV_EXTRA=$(getfilevar_noexec EXTRAVERSION "${KERNEL_MAKEFILE}")
# So we parse ${KERNEL_MAKEFILE}.
KV_MAJOR=$(getfilevar VERSION "${KERNEL_MAKEFILE}")
KV_MINOR=$(getfilevar PATCHLEVEL "${KERNEL_MAKEFILE}")
KV_PATCH=$(getfilevar SUBLEVEL "${KERNEL_MAKEFILE}")
KV_EXTRA=$(getfilevar EXTRAVERSION "${KERNEL_MAKEFILE}")
if [ -z "${KV_MAJOR}" -o -z "${KV_MINOR}" -o -z "${KV_PATCH}" ]
then