public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Marty E. Plummer" <hanetzer@startmail.com>
To: gentoo-dev@lists.gentoo.org
Cc: "Marty E. Plummer" <hanetzer@startmail.com>
Subject: [gentoo-dev] [PATCH] linux-info.eclass: account for lack of trailing slash
Date: Fri, 13 Jul 2018 18:57:23 -0500	[thread overview]
Message-ID: <20180713235723.32617-1-hanetzer@startmail.com> (raw)

In EAPI 7, D, ED, ROOT, EROOT no longer have a trailing slash[1]. This
makes finding /usr/src/linux not work properly as it currently stands.

Use the form "${ROOT%/}/" where apropos in order to unify behavior across
EAPIs.

1: https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-113001r7
---
 eclass/linux-info.eclass | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
index 96f94e4072a..31464766038 100644
--- a/eclass/linux-info.eclass
+++ b/eclass/linux-info.eclass
@@ -115,7 +115,7 @@ IUSE="kernel_linux"
 
 # Overwritable environment Var's
 # ---------------------------------------
-KERNEL_DIR="${KERNEL_DIR:-${ROOT}usr/src/linux}"
+KERNEL_DIR="${KERNEL_DIR:-${ROOT%/}/usr/src/linux}"
 
 
 # Bug fixes
@@ -554,7 +554,7 @@ get_version() {
 	# caught before this if they are.
 	if [[ -z ${OUTPUT_DIR} ]] ; then
 		# Try to locate a kernel that is most relevant for us.
-		for OUTPUT_DIR in "${SYSROOT}" "${ROOT}" "" ; do
+		for OUTPUT_DIR in "${SYSROOT}" "${ROOT%/}/" "" ; do
 			OUTPUT_DIR+="/lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}/build"
 			if [[ -e ${OUTPUT_DIR} ]] ; then
 				break
@@ -615,19 +615,19 @@ get_running_version() {
 
 	KV_FULL=$(uname -r)
 
-	if [[ -f ${ROOT}/lib/modules/${KV_FULL}/source/Makefile && -f ${ROOT}/lib/modules/${KV_FULL}/build/Makefile ]]; then
-		KERNEL_DIR=$(readlink -f ${ROOT}/lib/modules/${KV_FULL}/source)
-		KBUILD_OUTPUT=$(readlink -f ${ROOT}/lib/modules/${KV_FULL}/build)
+	if [[ -f ${ROOT%/}/lib/modules/${KV_FULL}/source/Makefile && -f ${ROOT%/}/lib/modules/${KV_FULL}/build/Makefile ]]; then
+		KERNEL_DIR=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/source)
+		KBUILD_OUTPUT=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/build)
 		unset KV_FULL
 		get_version
 		return $?
-	elif [[ -f ${ROOT}/lib/modules/${KV_FULL}/source/Makefile ]]; then
-		KERNEL_DIR=$(readlink -f ${ROOT}/lib/modules/${KV_FULL}/source)
+	elif [[ -f ${ROOT%/}/lib/modules/${KV_FULL}/source/Makefile ]]; then
+		KERNEL_DIR=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/source)
 		unset KV_FULL
 		get_version
 		return $?
-	elif [[ -f ${ROOT}/lib/modules/${KV_FULL}/build/Makefile ]]; then
-		KERNEL_DIR=$(readlink -f ${ROOT}/lib/modules/${KV_FULL}/build)
+	elif [[ -f ${ROOT%/}/lib/modules/${KV_FULL}/build/Makefile ]]; then
+		KERNEL_DIR=$(readlink -f ${ROOT%/}/lib/modules/${KV_FULL}/build)
 		unset KV_FULL
 		get_version
 		return $?
-- 
2.18.0



             reply	other threads:[~2018-07-13 23:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-13 23:57 Marty E. Plummer [this message]
2018-07-14  6:21 ` [gentoo-dev] [PATCH] linux-info.eclass: account for lack of trailing slash Ulrich Mueller
2018-07-14  7:46   ` Marty E. Plummer
2018-07-14  7:52   ` [gentoo-dev] [PATCH v2] " Marty E. Plummer
2018-07-17 18:06     ` [gentoo-dev] [PATCH] linux-info.eclass: fix for prematurely merged patch Marty E. Plummer
  -- strict thread matches above, loose matches on Subject: below --
2018-07-13 23:49 [gentoo-dev] [PATCH] linux-info.eclass: account for lack of trailing slash Marty E. Plummer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180713235723.32617-1-hanetzer@startmail.com \
    --to=hanetzer@startmail.com \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox