summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /eclass/udev.eclass
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'eclass/udev.eclass')
-rw-r--r--eclass/udev.eclass115
1 files changed, 115 insertions, 0 deletions
diff --git a/eclass/udev.eclass b/eclass/udev.eclass
new file mode 100644
index 000000000000..203d1426c88a
--- /dev/null
+++ b/eclass/udev.eclass
@@ -0,0 +1,115 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# @ECLASS: udev.eclass
+# @MAINTAINER:
+# udev-bugs@gentoo.org
+# @BLURB: Default eclass for determining udev directories.
+# @DESCRIPTION:
+# Default eclass for determining udev directories.
+# @EXAMPLE:
+#
+# @CODE
+# inherit udev
+#
+# # Example of the eclass usage:
+# RDEPEND="virtual/udev"
+# DEPEND="${RDEPEND}"
+#
+# src_configure() {
+# econf --with-rulesdir="$(get_udevdir)"/rules.d
+# }
+#
+# src_install() {
+# default
+# # udev_dorules contrib/99-foomatic
+# # udev_newrules contrib/98-foomatic 99-foomatic
+# }
+# @CODE
+
+inherit toolchain-funcs
+
+case ${EAPI:-0} in
+ 0|1|2|3|4|5) ;;
+ *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
+esac
+
+RDEPEND=""
+DEPEND="virtual/pkgconfig"
+
+# @FUNCTION: _udev_get_udevdir
+# @INTERNAL
+# @DESCRIPTION:
+# Get unprefixed udevdir.
+_udev_get_udevdir() {
+ if $($(tc-getPKG_CONFIG) --exists udev); then
+ echo "$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
+ else
+ echo /lib/udev
+ fi
+}
+
+# @FUNCTION: udev_get_udevdir
+# @DESCRIPTION:
+# Use the short version $(get_udevdir) instead!
+udev_get_udevdir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ eerror "This ebuild should be using the get_udevdir() function instead of the deprecated udev_get_udevdir()"
+ die "Deprecated function call: udev_get_udevdir(), please report to (overlay) maintainers."
+}
+
+# @FUNCTION: get_udevdir
+# @DESCRIPTION:
+# Output the path for the udev directory (not including ${D}).
+# This function always succeeds, even if udev is not installed.
+# The fallback value is set to /lib/udev
+get_udevdir() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ echo "$(_udev_get_udevdir)"
+}
+
+# @FUNCTION: udev_dorules
+# @USAGE: rules [...]
+# @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_udevdir)"/rules.d
+ doins "${@}"
+ )
+}
+
+# @FUNCTION: udev_newrules
+# @USAGE: oldname newname
+# @DESCRIPTION:
+# Install udev rule 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_udevdir)"/rules.d
+ newins "${@}"
+ )
+}
+
+# @FUNCTION: udev_reload
+# @DESCRIPTION:
+# Run udevadm control --reload to refresh rules and databases
+udev_reload() {
+ if [[ ${ROOT} != "" ]] && [[ ${ROOT} != "/" ]]; then
+ return 0
+ fi
+
+ if [[ -d ${ROOT}/run/udev ]]; then
+ ebegin "Running udev control --reload for reloading rules and databases"
+ udevadm control --reload
+ eend $?
+ fi
+}