1 |
Add a KV_FULL variable that defaults to the kernel version derived |
2 |
from PV, and can be used by ebuilds to override the version |
3 |
if necessary. |
4 |
|
5 |
Signed-off-by: Michał Górny <mgorny@g.o> |
6 |
--- |
7 |
eclass/kernel-install.eclass | 40 +++++++++++++++++++++--------------- |
8 |
1 file changed, 23 insertions(+), 17 deletions(-) |
9 |
|
10 |
diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass |
11 |
index dc77cb514b1a..06260ed61f23 100644 |
12 |
--- a/eclass/kernel-install.eclass |
13 |
+++ b/eclass/kernel-install.eclass |
14 |
@@ -14,20 +14,13 @@ |
15 |
# kinds of Distribution Kernel packages, including both kernels built |
16 |
# from source and distributed as binaries. The eclass relies on the |
17 |
# ebuild installing a subset of built kernel tree into |
18 |
-# /usr/src/linux-${PV} containing the kernel image in its standard |
19 |
-# location and System.map. |
20 |
+# /usr/src/linux-${KV_FULL}${KV_LOCALVERSION} containing the kernel |
21 |
+# image in its standard location and System.map. |
22 |
# |
23 |
# The eclass exports src_test, pkg_postinst and pkg_postrm. |
24 |
# Additionally, the inherited mount-boot eclass exports pkg_pretend. |
25 |
# It also stubs out pkg_preinst and pkg_prerm defined by mount-boot. |
26 |
|
27 |
-# @ECLASS_VARIABLE: KV_LOCALVERSION |
28 |
-# @DEFAULT_UNSET |
29 |
-# @DESCRIPTION: |
30 |
-# A string containing the kernel LOCALVERSION, e.g. '-gentoo'. |
31 |
-# Needs to be set only when installing binary kernels, |
32 |
-# kernel-build.eclass obtains it from kernel config. |
33 |
- |
34 |
if [[ ! ${_KERNEL_INSTALL_ECLASS} ]]; then |
35 |
|
36 |
case ${EAPI} in |
37 |
@@ -37,6 +30,19 @@ esac |
38 |
|
39 |
inherit dist-kernel-utils mount-boot toolchain-funcs |
40 |
|
41 |
+# @ECLASS_VARIABLE: KV_FULL |
42 |
+# @DESCRIPTION: |
43 |
+# The "x.y.z[-rcN]" kernel version. The default is derived from PV |
44 |
+# following upstream kernel versioning rules. |
45 |
+: "${KV_FULL:=$(dist-kernel_PV_to_KV "${PV}")}" |
46 |
+ |
47 |
+# @ECLASS_VARIABLE: KV_LOCALVERSION |
48 |
+# @DEFAULT_UNSET |
49 |
+# @DESCRIPTION: |
50 |
+# A string containing the kernel LOCALVERSION, e.g. '-gentoo'. |
51 |
+# Needs to be set only when installing binary kernels, |
52 |
+# kernel-build.eclass obtains it from kernel config. |
53 |
+ |
54 |
SLOT="${PV}" |
55 |
IUSE="+initramfs test" |
56 |
RESTRICT+=" |
57 |
@@ -403,18 +409,18 @@ kernel-install_src_test() { |
58 |
kernel-install_pkg_preinst() { |
59 |
debug-print-function ${FUNCNAME} "${@}" |
60 |
|
61 |
- local ver="${PV}${KV_LOCALVERSION}" |
62 |
+ local ver="${KV_FULL}${KV_LOCALVERSION}" |
63 |
local kdir="${ED}/usr/src/linux-${ver}" |
64 |
local relfile="${kdir}/include/config/kernel.release" |
65 |
[[ ! -d ${kdir} ]] && die "Kernel directory ${kdir} not installed!" |
66 |
[[ ! -f ${relfile} ]] && die "Release file ${relfile} not installed!" |
67 |
local release="$(<"${relfile}")" |
68 |
- if [[ ${release} != ${PV}* ]]; then |
69 |
+ if [[ ${release} != ${KV_FULL}* ]]; then |
70 |
eerror "Kernel release mismatch!" |
71 |
- eerror " expected (PV): ${PV}*" |
72 |
- eerror " found: ${release}" |
73 |
+ eerror " expected (KV_FULL): ${KV_FULL}*" |
74 |
+ eerror " found: ${release}" |
75 |
eerror "Please verify that you are applying the correct patches." |
76 |
- die "Kernel release mismatch (${release} instead of ${PV}*)" |
77 |
+ die "Kernel release mismatch (${release} instead of ${KV_FULL}*)" |
78 |
fi |
79 |
if [[ -L ${EROOT}/lib && ${EROOT}/lib -ef ${EROOT}/usr/lib ]]; then |
80 |
# Adjust symlinks for merged-usr. |
81 |
@@ -476,7 +482,7 @@ kernel-install_install_all() { |
82 |
kernel-install_pkg_postinst() { |
83 |
debug-print-function ${FUNCNAME} "${@}" |
84 |
|
85 |
- local ver="${PV}${KV_LOCALVERSION}" |
86 |
+ local ver="${KV_FULL}${KV_LOCALVERSION}" |
87 |
kernel-install_update_symlink "${EROOT}/usr/src/linux" "${ver}" |
88 |
|
89 |
if [[ -z ${ROOT} ]]; then |
90 |
@@ -500,7 +506,7 @@ kernel-install_pkg_postrm() { |
91 |
debug-print-function ${FUNCNAME} "${@}" |
92 |
|
93 |
if [[ -z ${ROOT} ]] && use initramfs; then |
94 |
- local ver="${PV}${KV_LOCALVERSION}" |
95 |
+ local ver="${KV_FULL}${KV_LOCALVERSION}" |
96 |
local image_path=$(dist-kernel_get_image_path) |
97 |
ebegin "Removing initramfs" |
98 |
rm -f "${EROOT}/usr/src/linux-${ver}/${image_path%/*}"/initrd{,.uefi} && |
99 |
@@ -515,7 +521,7 @@ kernel-install_pkg_postrm() { |
100 |
kernel-install_pkg_config() { |
101 |
[[ -z ${ROOT} ]] || die "ROOT!=/ not supported currently" |
102 |
|
103 |
- kernel-install_install_all "${PV}${KV_LOCALVERSION}" |
104 |
+ kernel-install_install_all "${KV_FULL}${KV_LOCALVERSION}" |
105 |
} |
106 |
|
107 |
_KERNEL_INSTALL_ECLASS=1 |
108 |
-- |
109 |
2.38.0 |