* [gentoo-dev] [RFC] systemd.eclass: Patch for new function systemd_get_udevdir()
@ 2012-08-06 10:00 99% Samuli Suominen
0 siblings, 0 replies; 1+ results
From: Samuli Suominen @ 2012-08-06 10:00 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 197 bytes --]
Patch to avoid duplicating this code to every ebuild.
The second attachment is an example use case for the function.
Soon as this is in, I'll start mass converting the tree for this...
- Samuli
[-- Attachment #2: systemd.eclass.patch --]
[-- Type: text/x-patch, Size: 1146 bytes --]
--- systemd.eclass 2012-08-06 12:49:20.532528219 +0300
+++ /tmp/systemd.eclass 2012-08-06 12:57:28.333542735 +0300
@@ -25,6 +25,8 @@
# }
# @CODE
+inherit toolchain-funcs
+
case ${EAPI:-0} in
0|1|2|3|4) ;;
*) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
@@ -34,6 +36,31 @@
DEPEND="!<sys-apps/systemd-29-r4
!=sys-apps/systemd-37-r1"
+# @FUNCTION: _systemd_get_udevdir
+# @INTERNAL
+# @DESCRIPTION:
+# Get unprefixed udevdir.
+_systemd_get_udevdir() {
+ if $($(tc-getPKG_CONFIG) --exists udev); then
+ echo -n "$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
+ else
+ echo -n /lib/udev
+ fi
+}
+
+# @FUNCTION: systemd_get_udevdir
+# @DESCRIPTION:
+# Output the path for the udev directory (not including ${D}).
+# This function always succeeds, even if udev is not installed.
+# Dependencies need to include sys-fs/udev or otherwise
+# the fallback return value is /lib/udev.
+systemd_get_udevdir() {
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
+ debug-print-function ${FUNCNAME} "${@}"
+
+ echo -n "${EPREFIX}$(_systemd_get_udevdir)"
+}
+
# @FUNCTION: _systemd_get_unitdir
# @INTERNAL
# @DESCRIPTION:
[-- Attachment #3: usb_modeswitch-1.2.3_p20120531-r2.ebuild.patch --]
[-- Type: text/x-patch, Size: 965 bytes --]
--- usb_modeswitch-1.2.3_p20120531-r2.ebuild 2012-08-06 12:59:07.308545675 +0300
+++ /tmp/usb_modeswitch-1.2.3_p20120531-r2.ebuild 2012-08-06 12:46:17.556522775 +0300
@@ -3,7 +3,7 @@
# $Header: /var/cvsroot/gentoo-x86/sys-apps/usb_modeswitch/usb_modeswitch-1.2.3_p20120531-r2.ebuild,v 1.2 2012/08/06 08:22:44 ssuominen Exp $
EAPI=4
-inherit linux-info toolchain-funcs
+inherit linux-info toolchain-funcs systemd
MY_PN=${PN/_/-}
MY_P=${MY_PN}-${PV/_p*}
@@ -42,7 +42,7 @@
src_install() {
emake \
DESTDIR="${D}" \
- UDEVDIR="${D}/$($(tc-getPKG_CONFIG) --variable=udevdir udev)" \
+ UDEVDIR="${D}/$(systemd_get_udevdir)" \
install
dodoc ChangeLog README
@@ -50,7 +50,7 @@
pushd ../${MY_PN}-data-${DATA_VER} >/dev/null
emake \
DESTDIR="${D}" \
- RULESDIR="${D}/$($(tc-getPKG_CONFIG) --variable=udevdir udev)/rules.d" \
+ RULESDIR="${D}/$(systemd_get_udevdir)/rules.d" \
files-install db-install
docinto data
dodoc ChangeLog README
^ permalink raw reply [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2012-08-06 10:00 99% [gentoo-dev] [RFC] systemd.eclass: Patch for new function systemd_get_udevdir() Samuli Suominen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox