commit:     50078fbbb3966773401c1fc59838c1e5952c1318
Author:     Dmitry Derevyanko <nrndda <AT> gmail <DOT> com>
AuthorDate: Sun Jul 29 23:22:38 2018 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Jul 29 23:23:27 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=50078fbb

linux-info.eclass: respect kernel CONFIG_LOCALVERSION

Closes: https://bugs.gentoo.org/460996
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 eclass/linux-info.eclass | 50 ++++++++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
index 6cd64457edd..b158e345d16 100644
--- a/eclass/linux-info.eclass
+++ b/eclass/linux-info.eclass
@@ -548,6 +548,30 @@ get_version() {
                return 1
        fi
 
+       # Grab the kernel release from the output directory.
+       # TODO: we MUST detect kernel.release being out of date, and 'return 1' 
from
+       # this function.
+       if [ -s "${KV_DIR}"/include/config/kernel.release ]; then
+               KV_LOCAL=$(<"${KV_DIR}"/include/config/kernel.release)
+       elif [ -s "${KV_DIR}"/.kernelrelease ]; then
+               KV_LOCAL=$(<"${KV_DIR}"/.kernelrelease)
+       else
+               KV_LOCAL=
+       fi
+
+       # KV_LOCAL currently contains the full release; discard the first bits.
+       tmplocal=${KV_LOCAL#${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}}
+
+       # If the updated local version was not changed, the tree is not 
prepared.
+       # Clear out KV_LOCAL in that case.
+       # TODO: this does not detect a change in the localversion part between
+       # kernel.release and the value that would be generated.
+       if [ "$KV_LOCAL" = "$tmplocal" ]; then
+               KV_LOCAL=
+       else
+               KV_LOCAL=$tmplocal
+       fi
+
        # and in newer versions we can also pull LOCALVERSION if it is set.
        # but before we do this, we need to find if we use a different object 
directory.
        # This *WILL* break if the user is using localversions, but we assume 
it was
@@ -555,7 +579,7 @@ get_version() {
        if [[ -z ${OUTPUT_DIR} ]] ; then
                # Try to locate a kernel that is most relevant for us.
                for OUTPUT_DIR in "${SYSROOT}" "${ROOT%/}" "" ; do
-                       
OUTPUT_DIR+="/lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}/build"
+                       
OUTPUT_DIR+="/lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}${KV_LOCAL}/build"
                        if [[ -e ${OUTPUT_DIR} ]] ; then
                                break
                        fi
@@ -571,30 +595,6 @@ get_version() {
        # and if we STILL have not got it, then we better just set it to KV_DIR
        KV_OUT_DIR="${KV_OUT_DIR:-${KV_DIR}}"
 
-       # Grab the kernel release from the output directory.
-       # TODO: we MUST detect kernel.release being out of date, and 'return 1' 
from
-       # this function.
-       if [ -s "${KV_OUT_DIR}"/include/config/kernel.release ]; then
-               KV_LOCAL=$(<"${KV_OUT_DIR}"/include/config/kernel.release)
-       elif [ -s "${KV_OUT_DIR}"/.kernelrelease ]; then
-               KV_LOCAL=$(<"${KV_OUT_DIR}"/.kernelrelease)
-       else
-               KV_LOCAL=
-       fi
-
-       # KV_LOCAL currently contains the full release; discard the first bits.
-       tmplocal=${KV_LOCAL#${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}}
-
-       # If the updated local version was not changed, the tree is not 
prepared.
-       # Clear out KV_LOCAL in that case.
-       # TODO: this does not detect a change in the localversion part between
-       # kernel.release and the value that would be generated.
-       if [ "$KV_LOCAL" = "$tmplocal" ]; then
-               KV_LOCAL=
-       else
-               KV_LOCAL=$tmplocal
-       fi
-
        # And we should set KV_FULL to the full expanded version
        KV_FULL="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}${KV_LOCAL}"
 

Reply via email to