From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.77)
	(envelope-from <gentoo-dev+bounces-53240-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1Sp2pB-0002yM-Pd
	for garchives@archives.gentoo.org; Wed, 11 Jul 2012 19:43:50 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id D4C3DE0790;
	Wed, 11 Jul 2012 19:43:35 +0000 (UTC)
Received: from mail-ob0-f181.google.com (mail-ob0-f181.google.com [209.85.214.181])
	by pigeon.gentoo.org (Postfix) with ESMTP id 95E30E073E
	for <gentoo-dev@lists.gentoo.org>; Wed, 11 Jul 2012 19:42:55 +0000 (UTC)
Received: by obbup19 with SMTP id up19so2138803obb.40
        for <gentoo-dev@lists.gentoo.org>; Wed, 11 Jul 2012 12:42:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=sender:date:from:to:subject:message-id:mail-followup-to
         :mime-version:content-type:content-disposition:user-agent;
        bh=J/aIgJN8J7tdCY9BRMSAy5GqSnXofzyFfKezJZB8Veo=;
        b=hUbnJ67PWWqsQ1PKle6JUxHuNpPjyKBR6hGqpRsFEQcNh4rzu+NdmzszfHwDRTz2PX
         hSeaWhrSBXSCo/3XYK9WwroO1lsldYNn6lHhqvfF9APTXGkljFPLUu/o1z9fI2TbkkYa
         Kr4PxhKj7u9U/5zf/y1PUiMDunAm/pzpMvg8qUljH06082AhxdEMXoJeWCkpWtN9woIe
         QjaWmBMNWpgOOLd5zJNoaNLpAmvsszQddjcncPzI99KgQKl80FcsV9L72+FMSZG8wwtL
         HozuWwiNFaO0ITM7pM4YcCeNyZMtCgTxb2cGpYb4vhRzN2j2tPxijw4KiTMYT0ZxLN/R
         n7dg==
Received: by 10.60.2.34 with SMTP id 2mr52169798oer.71.1342033905365;
        Wed, 11 Jul 2012 12:11:45 -0700 (PDT)
Received: from linux1 (cpe-76-187-77-158.tx.res.rr.com. [76.187.77.158])
        by mx.google.com with ESMTPS id m7sm1578490oef.1.2012.07.11.12.11.43
        (version=SSLv3 cipher=OTHER);
        Wed, 11 Jul 2012 12:11:44 -0700 (PDT)
Sender: William Hubbs <w.d.hubbs@gmail.com>
Received: by linux1 (sSMTP sendmail emulation); Wed, 11 Jul 2012 14:11:42 -0500
Date: Wed, 11 Jul 2012 14:11:42 -0500
From: William Hubbs <williamh@gentoo.org>
To: gentoo development <gentoo-dev@lists.gentoo.org>
Subject: [gentoo-dev] rfc: udev-rules.eclass
Message-ID: <20120711191142.GA26844@linux1>
Mail-Followup-To: gentoo development <gentoo-dev@lists.gentoo.org>
Precedence: bulk
List-Post: <mailto:gentoo-dev@lists.gentoo.org>
List-Help: <mailto:gentoo-dev+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-dev+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-dev+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-dev.gentoo.org>
X-BeenThere: gentoo-dev@lists.gentoo.org
Reply-to: gentoo-dev@lists.gentoo.org
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="xgyAXRrhYN0wYx8y"
Content-Disposition: inline
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Archives-Salt: f7abdf5c-fd47-4e0d-990a-fa7a5eb37a64
X-Archives-Hash: b6e2fdefb1e36725537b844d7c976c40


--xgyAXRrhYN0wYx8y
Content-Type: multipart/mixed; boundary="7AUc2qLy4jB3hD7Z"
Content-Disposition: inline


--7AUc2qLy4jB3hD7Z
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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


--7AUc2qLy4jB3hD7Z
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="udev-rules.eclass"

# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/systemd.eclass,v 1.11 2012/01/07 17:53:47 mgorny Exp $

# @ECLASS: udev-rules.eclass
# @MAINTAINER:
# udev-bugs@gentoo.org
# @BLURB: helper functions to install udev rules
# @DESCRIPTION:
# This eclass provides a set of functions to install udev rules.
# With versions of udev prior to 186, udev rules for extra packages were
# installed in /lib/udev/rules.d, but with newer versions they are installed in
# /usr/lib/udev/rules.d.
# @EXAMPLE:
#
# @CODE
# inherit udev-rules
#
# src_install() {
#     udev_dorules "${FILESDIR}"/foo.rules "${FILESDIR}"/bar.rules
#     udev_newrules "${FILESDIR}"/old.rules.name baz.rules
# }
# @CODE

case ${EAPI:-0} in
	0|1|2|3|4) ;;
	*) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
esac

# @FUNCTION: _udev_get_rulesdir
# @INTERNAL
# @DESCRIPTION:
# Get unprefixed udev rules directory.
_udev_get_rulesdir() {
	local dir
	if has_version '<sys-fs/udev-186-r1'; then
		dir=/lib/udev/rules.d
	else
		dir=/usr/lib/udev/rules.d
	fi
	echo -n $dir
}

# @FUNCTION: udev_get_rulesdir
# @DESCRIPTION:
# Output the path for the udev rules directory (not including ${D}).
udev_get_rulesdir() {
	has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
	debug-print-function ${FUNCNAME} "${@}"

	echo -n "${EPREFIX}$(_udev_get_rulesdir)"
}

# @FUNCTION: udev_dorules
# @USAGE: rulesfile [...]
# @DESCRIPTION:
# Install udev rule(s). Uses doins, thus it is fatal in EAPI 4
# and non-fatal in earlier EAPIs.
udev_dorules() {
	debug-print-function ${FUNCNAME} "${@}"

	(
		insinto "$(_udev_get_rulesdir)"
		doins "${@}"
	)
}

# @FUNCTION: udev_newrules
# @USAGE: oldname newname
# @DESCRIPTION:
# Install udev rules file with a new name. Uses newins, thus it is fatal
# in EAPI 4 and non-fatal in earlier EAPIs.
udev_newrules() {
	debug-print-function ${FUNCNAME} "${@}"

	(
		insinto "$(_udev_get_rulesdir)"
		newins "${@}"
	)
}

--7AUc2qLy4jB3hD7Z--

--xgyAXRrhYN0wYx8y
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iEYEARECAAYFAk/9z+4ACgkQblQW9DDEZTje7gCfcu/5TF/LRcQ3Dkxmfv3Jl41M
eP8AoLATDD0nyikjrCJlXyPaJStug8ID
=D8LV
-----END PGP SIGNATURE-----

--xgyAXRrhYN0wYx8y--