public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Samuli Suominen <ssuominen@gentoo.org>
To: "Michał Górny" <mgorny@gentoo.org>
Cc: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] rfc: udev-rules.eclass
Date: Fri, 13 Jul 2012 00:01:34 +0300	[thread overview]
Message-ID: <4FFF3B2E.5010608@gentoo.org> (raw)
In-Reply-To: <20120712230405.18386d47@pomiocik.lan>

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

On 07/13/2012 12:04 AM, Michał Górny wrote:
> On Thu, 12 Jul 2012 22:58:29 +0300
> Samuli Suominen <ssuominen@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.




[-- Attachment #2: udev-rules.eclass.patch --]
[-- Type: text/x-patch, Size: 733 bytes --]

--- 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	other threads:[~2012-07-12 21:08 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-11 19:11 [gentoo-dev] rfc: udev-rules.eclass William Hubbs
2012-07-11 19:57 ` W. Trevor King
2012-07-11 20:57 ` Diego Elio Pettenò
2012-07-11 23:42   ` William Hubbs
2012-07-11 23:43     ` Diego Elio Pettenò
2012-07-12  5:01     ` Ben de Groot
2012-07-12  5:26       ` Zac Medico
2012-07-12  7:17       ` Michał Górny
2012-07-12  7:33         ` Zac Medico
2012-07-13  6:29           ` [gentoo-dev] " Duncan
2012-07-12 13:47         ` [gentoo-dev] " Ian Stakenvicius
2012-07-12 14:19           ` Michał Górny
2012-07-12 14:34             ` Ian Stakenvicius
2012-07-12 14:37               ` Ciaran McCreesh
2012-07-12 13:43       ` Ian Stakenvicius
2012-07-12 14:20         ` Michał Górny
2012-07-12 14:34           ` Ian Stakenvicius
2012-07-12 15:02             ` Michał Górny
2012-07-11 20:57 ` William Hubbs
2012-07-11 20:59 ` Alexis Ballier
2012-07-11 23:48   ` William Hubbs
2012-07-12  2:25     ` Rick "Zero_Chaos" Farina
2012-07-12  2:50       ` Zac Medico
2012-07-12  3:03         ` Rick "Zero_Chaos" Farina
2012-07-12 16:42         ` Alexis Ballier
2012-07-12  3:41     ` Brian Dolbec
2012-07-12 16:30       ` Alexis Ballier
2012-07-13  5:44         ` Brian Dolbec
2012-07-12 16:24     ` Alexis Ballier
2012-07-11 21:51 ` Rick "Zero_Chaos" Farina
2012-07-12 14:22 ` Michał Górny
2012-07-12 14:35   ` William Hubbs
2012-07-12 19:58 ` Samuli Suominen
2012-07-12 20:31   ` Mike Gilbert
2012-07-12 21:04   ` Michał Górny
2012-07-12 21:01     ` Samuli Suominen [this message]
2012-07-12 21:09       ` Samuli Suominen
2012-07-12 21:39         ` [gentoo-dev] " Jonathan Callen
2012-07-13 18:12 ` [gentoo-dev] " William Hubbs

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=4FFF3B2E.5010608@gentoo.org \
    --to=ssuominen@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=mgorny@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