1 |
commit: 50078fbbb3966773401c1fc59838c1e5952c1318 |
2 |
Author: Dmitry Derevyanko <nrndda <AT> gmail <DOT> com> |
3 |
AuthorDate: Sun Jul 29 23:22:38 2018 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jul 29 23:23:27 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=50078fbb |
7 |
|
8 |
linux-info.eclass: respect kernel CONFIG_LOCALVERSION |
9 |
|
10 |
Closes: https://bugs.gentoo.org/460996 |
11 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
12 |
|
13 |
eclass/linux-info.eclass | 50 ++++++++++++++++++++++++------------------------ |
14 |
1 file changed, 25 insertions(+), 25 deletions(-) |
15 |
|
16 |
diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass |
17 |
index 6cd64457edd..b158e345d16 100644 |
18 |
--- a/eclass/linux-info.eclass |
19 |
+++ b/eclass/linux-info.eclass |
20 |
@@ -548,6 +548,30 @@ get_version() { |
21 |
return 1 |
22 |
fi |
23 |
|
24 |
+ # Grab the kernel release from the output directory. |
25 |
+ # TODO: we MUST detect kernel.release being out of date, and 'return 1' from |
26 |
+ # this function. |
27 |
+ if [ -s "${KV_DIR}"/include/config/kernel.release ]; then |
28 |
+ KV_LOCAL=$(<"${KV_DIR}"/include/config/kernel.release) |
29 |
+ elif [ -s "${KV_DIR}"/.kernelrelease ]; then |
30 |
+ KV_LOCAL=$(<"${KV_DIR}"/.kernelrelease) |
31 |
+ else |
32 |
+ KV_LOCAL= |
33 |
+ fi |
34 |
+ |
35 |
+ # KV_LOCAL currently contains the full release; discard the first bits. |
36 |
+ tmplocal=${KV_LOCAL#${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}} |
37 |
+ |
38 |
+ # If the updated local version was not changed, the tree is not prepared. |
39 |
+ # Clear out KV_LOCAL in that case. |
40 |
+ # TODO: this does not detect a change in the localversion part between |
41 |
+ # kernel.release and the value that would be generated. |
42 |
+ if [ "$KV_LOCAL" = "$tmplocal" ]; then |
43 |
+ KV_LOCAL= |
44 |
+ else |
45 |
+ KV_LOCAL=$tmplocal |
46 |
+ fi |
47 |
+ |
48 |
# and in newer versions we can also pull LOCALVERSION if it is set. |
49 |
# but before we do this, we need to find if we use a different object directory. |
50 |
# This *WILL* break if the user is using localversions, but we assume it was |
51 |
@@ -555,7 +579,7 @@ get_version() { |
52 |
if [[ -z ${OUTPUT_DIR} ]] ; then |
53 |
# Try to locate a kernel that is most relevant for us. |
54 |
for OUTPUT_DIR in "${SYSROOT}" "${ROOT%/}" "" ; do |
55 |
- OUTPUT_DIR+="/lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}/build" |
56 |
+ OUTPUT_DIR+="/lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}${KV_LOCAL}/build" |
57 |
if [[ -e ${OUTPUT_DIR} ]] ; then |
58 |
break |
59 |
fi |
60 |
@@ -571,30 +595,6 @@ get_version() { |
61 |
# and if we STILL have not got it, then we better just set it to KV_DIR |
62 |
KV_OUT_DIR="${KV_OUT_DIR:-${KV_DIR}}" |
63 |
|
64 |
- # Grab the kernel release from the output directory. |
65 |
- # TODO: we MUST detect kernel.release being out of date, and 'return 1' from |
66 |
- # this function. |
67 |
- if [ -s "${KV_OUT_DIR}"/include/config/kernel.release ]; then |
68 |
- KV_LOCAL=$(<"${KV_OUT_DIR}"/include/config/kernel.release) |
69 |
- elif [ -s "${KV_OUT_DIR}"/.kernelrelease ]; then |
70 |
- KV_LOCAL=$(<"${KV_OUT_DIR}"/.kernelrelease) |
71 |
- else |
72 |
- KV_LOCAL= |
73 |
- fi |
74 |
- |
75 |
- # KV_LOCAL currently contains the full release; discard the first bits. |
76 |
- tmplocal=${KV_LOCAL#${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}} |
77 |
- |
78 |
- # If the updated local version was not changed, the tree is not prepared. |
79 |
- # Clear out KV_LOCAL in that case. |
80 |
- # TODO: this does not detect a change in the localversion part between |
81 |
- # kernel.release and the value that would be generated. |
82 |
- if [ "$KV_LOCAL" = "$tmplocal" ]; then |
83 |
- KV_LOCAL= |
84 |
- else |
85 |
- KV_LOCAL=$tmplocal |
86 |
- fi |
87 |
- |
88 |
# And we should set KV_FULL to the full expanded version |
89 |
KV_FULL="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}${KV_LOCAL}" |