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:58:55
Message-Id: 20180713235723.32617-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 1: https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-113001r7
8 ---
9 eclass/linux-info.eclass | 18 +++++++++---------
10 1 file changed, 9 insertions(+), 9 deletions(-)
11
12 diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
13 index 96f94e4072a..31464766038 100644
14 --- a/eclass/linux-info.eclass
15 +++ b/eclass/linux-info.eclass
16 @@ -115,7 +115,7 @@ IUSE="kernel_linux"
17
18 # Overwritable environment Var's
19 # ---------------------------------------
20 -KERNEL_DIR="${KERNEL_DIR:-${ROOT}usr/src/linux}"
21 +KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
22
23
24 # Bug fixes
25 @@ -554,7 +554,7 @@ get_version() {
26 # caught before this if they are.
27 if [[ -z ${OUTPUT_DIR} ]] ; then
28 # Try to locate a kernel that is most relevant for us.
29 - for OUTPUT_DIR in "${SYSROOT}" "${ROOT}" "" ; do
30 + for OUTPUT_DIR in "${SYSROOT}" "${ROOT%/}/" "" ; do
31 OUTPUT_DIR+="/lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}/build"
32 if [[ -e ${OUTPUT_DIR} ]] ; then
33 break
34 @@ -615,19 +615,19 @@ get_running_version() {
35
36 KV_FULL=$(uname -r)
37
38 - if [[ -f ${ROOT}/lib/modules/${KV_FULL}/source/Makefile && -f ${ROOT}/lib/modules/${KV_FULL}/build/Makefile ]]; then
39 - KERNEL_DIR=$(readlink -f ${ROOT}/lib/modules/${KV_FULL}/source)
40 - KBUILD_OUTPUT=$(readlink -f ${ROOT}/lib/modules/${KV_FULL}/build)
41 + if [[ -f ${ROOT%/}/lib/modules/${KV_FULL}/source/Makefile && -f ${ROOT%/}/lib/modules/${KV_FULL}/build/Makefile ]]; then
42 + KERNEL_DIR=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/source)
43 + KBUILD_OUTPUT=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/build)
44 unset KV_FULL
45 get_version
46 return $?
47 - elif [[ -f ${ROOT}/lib/modules/${KV_FULL}/source/Makefile ]]; then
48 - KERNEL_DIR=$(readlink -f ${ROOT}/lib/modules/${KV_FULL}/source)
49 + elif [[ -f ${ROOT%/}/lib/modules/${KV_FULL}/source/Makefile ]]; then
50 + KERNEL_DIR=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/source)
51 unset KV_FULL
52 get_version
53 return $?
54 - elif [[ -f ${ROOT}/lib/modules/${KV_FULL}/build/Makefile ]]; then
55 - KERNEL_DIR=$(readlink -f ${ROOT}/lib/modules/${KV_FULL}/build)
56 + elif [[ -f ${ROOT%/}/lib/modules/${KV_FULL}/build/Makefile ]]; then
57 + KERNEL_DIR=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/build)
58 unset KV_FULL
59 get_version
60 return $?
61 --
62 2.18.0

Replies