public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] rfc: udev-rules.eclass
@ 2012-07-11 19:11 William Hubbs
  2012-07-11 19:57 ` W. Trevor King
                   ` (7 more replies)
  0 siblings, 8 replies; 39+ messages in thread
From: William Hubbs @ 2012-07-11 19:11 UTC (permalink / raw
  To: gentoo development


[-- Attachment #1.1: Type: text/plain, Size: 502 bytes --]

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


[-- Attachment #1.2: udev-rules.eclass --]
[-- Type: text/plain, Size: 2010 bytes --]

# 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 "${@}"
	)
}

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

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

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

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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