From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 2/8] systemd.eclass: systemd_get_unitdir -> *systemunitdir for consistency
Date: Mon, 30 Nov 2015 16:01:16 +0100 [thread overview]
Message-ID: <1448895682-19312-3-git-send-email-mgorny@gentoo.org> (raw)
In-Reply-To: <1448895682-19312-1-git-send-email-mgorny@gentoo.org>
Rename systemd_get_unitdir to systemd_get_systemunitdir for consistency
with other functions. Ban the old name in EAPI 6 onwards.
---
eclass/systemd.eclass | 34 ++++++++++++++++++++++------------
1 file changed, 22 insertions(+), 12 deletions(-)
diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass
index 245e803..7dd914a 100644
--- a/eclass/systemd.eclass
+++ b/eclass/systemd.eclass
@@ -58,19 +58,29 @@ _systemd_get_dir() {
# @INTERNAL
# @DESCRIPTION:
# Get unprefixed unitdir.
-_systemd_get_unitdir() {
+_systemd_get_systemunitdir() {
_systemd_get_dir systemdsystemunitdir /usr/lib/systemd/system
}
-# @FUNCTION: systemd_get_unitdir
+# @FUNCTION: systemd_get_systemunitdir
# @DESCRIPTION:
-# Output the path for the systemd unit directory (not including ${D}).
-# This function always succeeds, even if systemd is not installed.
-systemd_get_unitdir() {
+# Output the path for the systemd system unit directory (not including
+# ${D}). This function always succeeds, even if systemd is not
+# installed.
+systemd_get_systemunitdir() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
debug-print-function ${FUNCNAME} "${@}"
- echo "${EPREFIX}$(_systemd_get_unitdir)"
+ echo "${EPREFIX}$(_systemd_get_systemunitdir)"
+}
+
+# @FUNCTION: systemd_get_unitdir
+# @DESCRIPTION:
+# Deprecated alias for systemd_get_systemunitdir.
+systemd_get_unitdir() {
+ [[ ${EAPI} == [012345] ]] || die "${FUNCNAME} is banned in EAPI 6, use systemd_get_systemunitdir instead"
+
+ systemd_get_systemunitdir
}
# @FUNCTION: _systemd_get_userunitdir
@@ -122,7 +132,7 @@ systemd_dounit() {
debug-print-function ${FUNCNAME} "${@}"
(
- insinto "$(_systemd_get_unitdir)"
+ insinto "$(_systemd_get_systemunitdir)"
doins "${@}"
)
}
@@ -136,7 +146,7 @@ systemd_newunit() {
debug-print-function ${FUNCNAME} "${@}"
(
- insinto "$(_systemd_get_unitdir)"
+ insinto "$(_systemd_get_systemunitdir)"
newins "${@}"
)
}
@@ -247,7 +257,7 @@ systemd_enable_service() {
local target=${1}
local service=${2}
- local ud=$(_systemd_get_unitdir)
+ local ud=$(_systemd_get_systemunitdir)
local destname=${service##*/}
dodir "${ud}"/"${target}".wants && \
@@ -281,7 +291,7 @@ systemd_enable_ntpunit() {
die "The .list suffix is appended implicitly to ntpunit.d name."
fi
- local unitdir=$(systemd_get_unitdir)
+ local unitdir=$(systemd_get_systemunitdir)
local s
for s in "${services[@]}"; do
if [[ ! -f "${D}${unitdir}/${s}" ]]; then
@@ -317,7 +327,7 @@ systemd_with_unitdir() {
debug-print-function ${FUNCNAME} "${@}"
local optname=${1:-systemdsystemunitdir}
- echo --with-${optname}="$(systemd_get_unitdir)"
+ echo --with-${optname}="$(systemd_get_systemunitdir)"
}
# @FUNCTION: systemd_with_utildir
@@ -344,7 +354,7 @@ systemd_to_myeconfargs() {
myeconfargs=(
"${myeconfargs[@]}"
- --with-systemdsystemunitdir="$(systemd_get_unitdir)"
+ --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
)
}
--
2.6.3
next prev parent reply other threads:[~2015-11-30 15:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-27 14:53 [gentoo-dev] [PATCHES] systemd.eclass: Clean up & EAPI 6 support Michał Górny
2015-11-27 14:53 ` [gentoo-dev] [PATCH 1/7] systemd.eclass: Introduce a common getter for systemd directories Michał Górny
2015-11-27 14:53 ` [gentoo-dev] [PATCH 2/7] systemd.eclass: Update the example for best practices Michał Górny
2015-11-27 14:53 ` [gentoo-dev] [PATCH 3/7] systemd.eclass: Remove long-deprecated systemd_to_myeconfargs Michał Górny
2015-11-27 14:53 ` [gentoo-dev] [PATCH 4/7] systemd.eclass: Add missing ||die on ntp file writes Michał Górny
2015-11-27 14:53 ` [gentoo-dev] [PATCH 5/7] systemd.eclass: Ban systemd_with_* in EAPI 6 Michał Górny
2015-11-27 14:53 ` [gentoo-dev] [PATCH 6/7] systemd.eclass: Allow systemd_update_catalog only during pkg_post* Michał Górny
2015-11-27 14:53 ` [gentoo-dev] [PATCH 7/7] systemd.eclass: Enable EAPI=6 Michał Górny
2015-11-30 15:01 ` [gentoo-dev] [v2] systemd.eclass cleanup & EAPI 6 support Michał Górny
2015-11-30 15:01 ` [gentoo-dev] [PATCH 1/8] systemd.eclass: Introduce a common getter for systemd directories Michał Górny
2015-11-30 15:01 ` Michał Górny [this message]
2015-11-30 15:01 ` [gentoo-dev] [PATCH 3/8] systemd.eclass: Update the example for best practices Michał Górny
2015-11-30 15:01 ` [gentoo-dev] [PATCH 4/8] systemd.eclass: Remove long-deprecated systemd_to_myeconfargs Michał Górny
2015-11-30 15:01 ` [gentoo-dev] [PATCH 5/8] systemd.eclass: Add missing ||die on ntp file writes Michał Górny
2015-11-30 15:01 ` [gentoo-dev] [PATCH 6/8] systemd.eclass: Ban systemd_with_* in EAPI 6 Michał Górny
2015-11-30 15:01 ` [gentoo-dev] [PATCH 7/8] systemd.eclass: Allow systemd_update_catalog only during pkg_post* Michał Górny
2015-11-30 15:01 ` [gentoo-dev] [PATCH 8/8] systemd.eclass: Enable EAPI=6 Michał Górny
2015-12-01 22:08 ` [gentoo-dev] [v2] systemd.eclass cleanup & EAPI 6 support Michał Górny
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=1448895682-19312-3-git-send-email-mgorny@gentoo.org \
--to=mgorny@gentoo.org \
--cc=gentoo-dev@lists.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