public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] linux-info.eclass: account for lack of trailing slash
@ 2018-07-13 23:49 Marty E. Plummer
  0 siblings, 0 replies; 6+ messages in thread
From: Marty E. Plummer @ 2018-07-13 23:49 UTC (permalink / raw
  To: gentoo-dev; +Cc: Marty E. Plummer

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.
---
 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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-dev] [PATCH] linux-info.eclass: account for lack of trailing slash
@ 2018-07-13 23:57 Marty E. Plummer
  2018-07-14  6:21 ` Ulrich Mueller
  0 siblings, 1 reply; 6+ messages in thread
From: Marty E. Plummer @ 2018-07-13 23:57 UTC (permalink / raw
  To: gentoo-dev; +Cc: Marty E. Plummer

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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] [PATCH] linux-info.eclass: account for lack of trailing slash
  2018-07-13 23:57 [gentoo-dev] [PATCH] linux-info.eclass: account for lack of trailing slash Marty E. Plummer
@ 2018-07-14  6:21 ` Ulrich Mueller
  2018-07-14  7:46   ` Marty E. Plummer
  2018-07-14  7:52   ` [gentoo-dev] [PATCH v2] " Marty E. Plummer
  0 siblings, 2 replies; 6+ messages in thread
From: Ulrich Mueller @ 2018-07-14  6:21 UTC (permalink / raw
  To: gentoo-dev; +Cc: Marty E. Plummer

[-- Attachment #1: Type: text/plain, Size: 1026 bytes --]

>>>>> On Fri, 13 Jul 2018, Marty E Plummer wrote:

> 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

Please use https://projects.gentoo.org/pms/7/pms.html if you want the
fragment identifier to be stable (which is not guaranteed for the
version in my home directory).

> @@ -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

Shouldn't it be "${ROOT%/}" here? Otherwise OUTPUT_DIR may begin with
a double slash.

>  			OUTPUT_DIR+="/lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}/build"
>  			if [[ -e ${OUTPUT_DIR} ]] ; then
>  				break

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] [PATCH] linux-info.eclass: account for lack of trailing slash
  2018-07-14  6:21 ` Ulrich Mueller
@ 2018-07-14  7:46   ` Marty E. Plummer
  2018-07-14  7:52   ` [gentoo-dev] [PATCH v2] " Marty E. Plummer
  1 sibling, 0 replies; 6+ messages in thread
From: Marty E. Plummer @ 2018-07-14  7:46 UTC (permalink / raw
  To: Ulrich Mueller; +Cc: gentoo-dev

On Sat, Jul 14, 2018 at 08:21:42AM +0200, Ulrich Mueller wrote:
> >>>>> On Fri, 13 Jul 2018, Marty E Plummer wrote:
> 
> > 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
> 
> Please use https://projects.gentoo.org/pms/7/pms.html if you want the
> fragment identifier to be stable (which is not guaranteed for the
> version in my home directory).
> 
Ok, will do.
> > @@ -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
> 
> Shouldn't it be "${ROOT%/}" here? Otherwise OUTPUT_DIR may begin with
> a double slash.
> 
Ah, good point. I didn't check that well enough, will fix it up.
> >  			OUTPUT_DIR+="/lib/modules/${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}/build"
> >  			if [[ -e ${OUTPUT_DIR} ]] ; then
> >  				break




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gentoo-dev] [PATCH v2] linux-info.eclass: account for lack of trailing slash
  2018-07-14  6:21 ` Ulrich Mueller
  2018-07-14  7:46   ` Marty E. Plummer
@ 2018-07-14  7:52   ` Marty E. Plummer
  2018-07-17 18:06     ` [gentoo-dev] [PATCH] linux-info.eclass: fix for prematurely merged patch Marty E. Plummer
  1 sibling, 1 reply; 6+ messages in thread
From: Marty E. Plummer @ 2018-07-14  7:52 UTC (permalink / raw
  To: gentoo-dev

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://projects.gentoo.org/pms/7/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..6cd64457edd 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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-dev] [PATCH] linux-info.eclass: fix for prematurely merged patch
  2018-07-14  7:52   ` [gentoo-dev] [PATCH v2] " Marty E. Plummer
@ 2018-07-17 18:06     ` Marty E. Plummer
  0 siblings, 0 replies; 6+ messages in thread
From: Marty E. Plummer @ 2018-07-17 18:06 UTC (permalink / raw
  To: gentoo-dev

https://github.com/gentoo/gentoo/pull/9222 was merged prematurely, and
included the first iteration of my linux-info EAPI 7 patch, and requires
this patch on top to avoid a double slash.
---
 eclass/linux-info.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
index 31464766038..6cd64457edd 100644
--- a/eclass/linux-info.eclass
+++ b/eclass/linux-info.eclass
@@ -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
-- 
2.18.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-07-17 18:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-13 23:57 [gentoo-dev] [PATCH] linux-info.eclass: account for lack of trailing slash Marty E. Plummer
2018-07-14  6:21 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox