On 07/13/2012 12:04 AM, Michał Górny wrote:
On Thu, 12 Jul 2012 22:58:29 +0300
Samuli Suominen <ssuomi...@gentoo.org> wrote:

On 07/11/2012 10:11 PM, William Hubbs wrote:
All,
I am about to release udev-186-r1, which will move everything
currently in /lib/udev to /usr/lib/udev.

For packages that install udev rules in ${FILESDIR}, we need an
eclass that tests the version of udev installed on the user's
system and installs the udev rules in the proper place. I'm not
sure how many packages do this, so if it is a very small number of
packages, it may not be worth the eclass. It would be good to
discuss that as well as reviewing the proposed eclass.

Thanks,

William


Please don't hardcode the path like this, use pkg-config instead:

inherit toolchain-funcs

dir="$($(tc-getPKG_CONFIG) --variable=udevdir udev)/rules.d"

Don't forget to add udev to DEPEND of every package using the eclass
then. Oh wait...


Obviously the pkg-config should be only the primary method and there should be a fallback, like what has already been posted.

See attachment.



--- udev-rules.eclass.orig	2012-07-12 23:59:40.465838370 +0300
+++ udev-rules.eclass	2012-07-13 00:01:12.921831177 +0300
@@ -22,6 +22,8 @@
 # }
 # @CODE
 
+inherit toolchain-funcs
+
 case ${EAPI:-0} in
 	0|1|2|3|4) ;;
 	*) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
@@ -33,10 +35,14 @@
 # Get unprefixed udev rules directory.
 _udev_get_rulesdir() {
 	local dir
-	if has_version '<sys-fs/udev-186-r1'; then
-		dir=/lib/udev/rules.d
+	if has_version virtual/pkgconfig; then
+		dir="$($(tc-getPKG_CONFIG) --variable=udevdir udev)/rules.d"
 	else
-		dir=/usr/lib/udev/rules.d
+		if has_version '<sys-fs/udev-186-r1'; then
+			dir=/lib/udev/rules.d
+		else
+			dir=/usr/lib/udev/rules.d
+		fi
 	fi
 	echo -n $dir
 }

Reply via email to