public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/3] udev.eclass: rework _udev_get_udevdir
@ 2021-01-03 16:59 Mike Gilbert
  2021-01-03 16:59 ` [gentoo-dev] [PATCH 2/3] systemd.eclass: rework prefix logic for EAPI 7 Mike Gilbert
  2021-01-03 16:59 ` [gentoo-dev] [PATCH 3/3] udev.eclass: copy sysroot/prefix logic from systemd.eclass Mike Gilbert
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Gilbert @ 2021-01-03 16:59 UTC (permalink / raw
  To: gentoo-dev; +Cc: Mike Gilbert

Rewrite logic to resemble _systemd_get_dir from systemd.eclass.

Remove incorrect command substitution: pkg-config --exists does not
write to stdout.

Die when pkg-config --variable fails.

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
 eclass/udev.eclass | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/eclass/udev.eclass b/eclass/udev.eclass
index 2873ae9a92c3..9a65b080f171 100644
--- a/eclass/udev.eclass
+++ b/eclass/udev.eclass
@@ -50,12 +50,12 @@ fi
 # @DESCRIPTION:
 # Get unprefixed udevdir.
 _udev_get_udevdir() {
-	if $($(tc-getPKG_CONFIG) --exists udev); then
-		local udevdir="$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
-		echo "${udevdir#${EPREFIX%/}}"
-	else
-		echo /lib/udev
+	local udevdir="/lib/udev"
+	if $(tc-getPKG_CONFIG) --exists udev; then
+		udevdir="$($(tc-getPKG_CONFIG) --variable=udevdir udev)" || die
+		udevdir="${udevdir#${EPREFIX}}"
 	fi
+	echo "${udevdir}"
 }
 
 # @FUNCTION: udev_get_udevdir
-- 
2.30.0



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

* [gentoo-dev] [PATCH 2/3] systemd.eclass: rework prefix logic for EAPI 7
  2021-01-03 16:59 [gentoo-dev] [PATCH 1/3] udev.eclass: rework _udev_get_udevdir Mike Gilbert
@ 2021-01-03 16:59 ` Mike Gilbert
  2021-01-03 16:59 ` [gentoo-dev] [PATCH 3/3] udev.eclass: copy sysroot/prefix logic from systemd.eclass Mike Gilbert
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Gilbert @ 2021-01-03 16:59 UTC (permalink / raw
  To: gentoo-dev; +Cc: Mike Gilbert

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
 eclass/systemd.eclass | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass
index f6d1fa2d92d6..9f439238fe6c 100644
--- a/eclass/systemd.eclass
+++ b/eclass/systemd.eclass
@@ -46,12 +46,23 @@ fi
 # instead.
 _systemd_get_dir() {
 	[[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <variable-name> <fallback-directory>"
-	local variable=${1} fallback=${2} d
+	local variable=${1} fallback=${2} d eprefix
+
+	if [[ ${EAPI:-0} == [0123456] ]]; then
+		eprefix=${EPREFIX}
+	else
+		# Derive from ESYSROOT due to weird PMS logic.
+		eprefix=${ESYSROOT#${SYSROOT}}
+	fi
 
 	if $(tc-getPKG_CONFIG) --exists systemd; then
 		d=$($(tc-getPKG_CONFIG) --variable="${variable}" systemd) || die
+
+		# Remove SYSROOT in case PKG_CONFIG_SYSROOT_DIR is set by cross-pkg-config.
 		d=${d#${SYSROOT}}
-		d=${d#${EPREFIX}}
+
+		# Remove any offset prefix.
+		d=${d#${eprefix}}
 	else
 		d=${fallback}
 	fi
-- 
2.30.0



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

* [gentoo-dev] [PATCH 3/3] udev.eclass: copy sysroot/prefix logic from systemd.eclass
  2021-01-03 16:59 [gentoo-dev] [PATCH 1/3] udev.eclass: rework _udev_get_udevdir Mike Gilbert
  2021-01-03 16:59 ` [gentoo-dev] [PATCH 2/3] systemd.eclass: rework prefix logic for EAPI 7 Mike Gilbert
@ 2021-01-03 16:59 ` Mike Gilbert
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Gilbert @ 2021-01-03 16:59 UTC (permalink / raw
  To: gentoo-dev; +Cc: Mike Gilbert

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
 eclass/udev.eclass | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/eclass/udev.eclass b/eclass/udev.eclass
index 9a65b080f171..8e256385f8ef 100644
--- a/eclass/udev.eclass
+++ b/eclass/udev.eclass
@@ -50,11 +50,25 @@ fi
 # @DESCRIPTION:
 # Get unprefixed udevdir.
 _udev_get_udevdir() {
-	local udevdir="/lib/udev"
+	local udevdir="/lib/udev" eprefix
+
+	if [[ ${EAPI:-0} == [0123456] ]]; then
+		eprefix=${EPREFIX}
+	else
+		# Derive from ESYSROOT due to weird PMS logic.
+		eprefix=${ESYSROOT#${SYSROOT}}
+	fi
+
 	if $(tc-getPKG_CONFIG) --exists udev; then
 		udevdir="$($(tc-getPKG_CONFIG) --variable=udevdir udev)" || die
-		udevdir="${udevdir#${EPREFIX}}"
+
+		# Remove SYSROOT in case PKG_CONFIG_SYSROOT_DIR is set by cross-pkg-config.
+		d=${udevdir#${SYSROOT}}
+
+		# Remove any offset prefix.
+		d=${udevdir#${eprefix}}
 	fi
+
 	echo "${udevdir}"
 }
 
-- 
2.30.0



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

end of thread, other threads:[~2021-01-03 17:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-03 16:59 [gentoo-dev] [PATCH 1/3] udev.eclass: rework _udev_get_udevdir Mike Gilbert
2021-01-03 16:59 ` [gentoo-dev] [PATCH 2/3] systemd.eclass: rework prefix logic for EAPI 7 Mike Gilbert
2021-01-03 16:59 ` [gentoo-dev] [PATCH 3/3] udev.eclass: copy sysroot/prefix logic from systemd.eclass Mike Gilbert

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