Gentoo Archives: gentoo-dev

From: "Marty E. Plummer" <hanetzer@×××××××××.com>
To: gentoo-dev@l.g.o
Cc: "Marty E. Plummer" <hanetzer@×××××××××.com>
Subject: [gentoo-dev] [PATCH] linux-info.eclass: account for lack of trailing slash
Date: Fri, 13 Jul 2018 23:51:30
Message-Id: 20180713234958.32367-1-hanetzer@startmail.com
1 In EAPI 7, D, ED, ROOT, EROOT no longer have a trailing slash[1]. This
2 makes finding /usr/src/linux not work properly as it currently stands.
3
4 Use the form "${ROOT%}/" where apropos in order to unify behavior across
5 EAPIs.
6 ---
7 eclass/linux-info.eclass | 18 +++++++++---------
8 1 file changed, 9 insertions(+), 9 deletions(-)
9
10 diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
11 index 96f94e4072a..31464766038 100644
12 --- a/eclass/linux-info.eclass
13 +++ b/eclass/linux-info.eclass
14 @@ -115,7 +115,7 @@ IUSE="kernel_linux"
15
16 # Overwritable environment Var's
17 # ---------------------------------------
18 -KERNEL_DIR="${KERNEL_DIR:-${ROOT}usr/src/linux}"
19 +KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
20
21
22 # Bug fixes
23 @@ -554,7 +554,7 @@ get_version() {
24 # caught before this if they are.
25 if [[ -z ${OUTPUT_DIR} ]] ; then
26 # Try to locate a kernel that is most relevant for us.
27 - for OUTPUT_DIR in "${SYSROOT}" "${ROOT}" "" ; do
28 + for OUTPUT_DIR in "${SYSROOT}" "${ROOT%/}/" "" ; do
29 OUTPUT_DIR+="/lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}/build"
30 if [[ -e ${OUTPUT_DIR} ]] ; then
31 break
32 @@ -615,19 +615,19 @@ get_running_version() {
33
34 KV_FULL=$(uname -r)
35
36 - if [[ -f ${ROOT}/lib/modules/${KV_FULL}/source/Makefile && -f ${ROOT}/lib/modules/${KV_FULL}/build/Makefile ]]; then
37 - KERNEL_DIR=$(readlink -f ${ROOT}/lib/modules/${KV_FULL}/source)
38 - KBUILD_OUTPUT=$(readlink -f ${ROOT}/lib/modules/${KV_FULL}/build)
39 + if [[ -f ${ROOT%/}/lib/modules/${KV_FULL}/source/Makefile && -f ${ROOT%/}/lib/modules/${KV_FULL}/build/Makefile ]]; then
40 + KERNEL_DIR=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/source)
41 + KBUILD_OUTPUT=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/build)
42 unset KV_FULL
43 get_version
44 return $?
45 - elif [[ -f ${ROOT}/lib/modules/${KV_FULL}/source/Makefile ]]; then
46 - KERNEL_DIR=$(readlink -f ${ROOT}/lib/modules/${KV_FULL}/source)
47 + elif [[ -f ${ROOT%/}/lib/modules/${KV_FULL}/source/Makefile ]]; then
48 + KERNEL_DIR=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/source)
49 unset KV_FULL
50 get_version
51 return $?
52 - elif [[ -f ${ROOT}/lib/modules/${KV_FULL}/build/Makefile ]]; then
53 - KERNEL_DIR=$(readlink -f ${ROOT}/lib/modules/${KV_FULL}/build)
54 + elif [[ -f ${ROOT%/}/lib/modules/${KV_FULL}/build/Makefile ]]; then
55 + KERNEL_DIR=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/build)
56 unset KV_FULL
57 get_version
58 return $?
59 --
60 2.18.0