Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 2/8] systemd.eclass: systemd_get_unitdir -> *systemunitdir for consistency
Date: Mon, 30 Nov 2015 15:02:47
Message-Id: 1448895682-19312-3-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [v2] systemd.eclass cleanup & EAPI 6 support by "Michał Górny"
1 Rename systemd_get_unitdir to systemd_get_systemunitdir for consistency
2 with other functions. Ban the old name in EAPI 6 onwards.
3 ---
4 eclass/systemd.eclass | 34 ++++++++++++++++++++++------------
5 1 file changed, 22 insertions(+), 12 deletions(-)
6
7 diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass
8 index 245e803..7dd914a 100644
9 --- a/eclass/systemd.eclass
10 +++ b/eclass/systemd.eclass
11 @@ -58,19 +58,29 @@ _systemd_get_dir() {
12 # @INTERNAL
13 # @DESCRIPTION:
14 # Get unprefixed unitdir.
15 -_systemd_get_unitdir() {
16 +_systemd_get_systemunitdir() {
17 _systemd_get_dir systemdsystemunitdir /usr/lib/systemd/system
18 }
19
20 -# @FUNCTION: systemd_get_unitdir
21 +# @FUNCTION: systemd_get_systemunitdir
22 # @DESCRIPTION:
23 -# Output the path for the systemd unit directory (not including ${D}).
24 -# This function always succeeds, even if systemd is not installed.
25 -systemd_get_unitdir() {
26 +# Output the path for the systemd system unit directory (not including
27 +# ${D}). This function always succeeds, even if systemd is not
28 +# installed.
29 +systemd_get_systemunitdir() {
30 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
31 debug-print-function ${FUNCNAME} "${@}"
32
33 - echo "${EPREFIX}$(_systemd_get_unitdir)"
34 + echo "${EPREFIX}$(_systemd_get_systemunitdir)"
35 +}
36 +
37 +# @FUNCTION: systemd_get_unitdir
38 +# @DESCRIPTION:
39 +# Deprecated alias for systemd_get_systemunitdir.
40 +systemd_get_unitdir() {
41 + [[ ${EAPI} == [012345] ]] || die "${FUNCNAME} is banned in EAPI 6, use systemd_get_systemunitdir instead"
42 +
43 + systemd_get_systemunitdir
44 }
45
46 # @FUNCTION: _systemd_get_userunitdir
47 @@ -122,7 +132,7 @@ systemd_dounit() {
48 debug-print-function ${FUNCNAME} "${@}"
49
50 (
51 - insinto "$(_systemd_get_unitdir)"
52 + insinto "$(_systemd_get_systemunitdir)"
53 doins "${@}"
54 )
55 }
56 @@ -136,7 +146,7 @@ systemd_newunit() {
57 debug-print-function ${FUNCNAME} "${@}"
58
59 (
60 - insinto "$(_systemd_get_unitdir)"
61 + insinto "$(_systemd_get_systemunitdir)"
62 newins "${@}"
63 )
64 }
65 @@ -247,7 +257,7 @@ systemd_enable_service() {
66
67 local target=${1}
68 local service=${2}
69 - local ud=$(_systemd_get_unitdir)
70 + local ud=$(_systemd_get_systemunitdir)
71 local destname=${service##*/}
72
73 dodir "${ud}"/"${target}".wants && \
74 @@ -281,7 +291,7 @@ systemd_enable_ntpunit() {
75 die "The .list suffix is appended implicitly to ntpunit.d name."
76 fi
77
78 - local unitdir=$(systemd_get_unitdir)
79 + local unitdir=$(systemd_get_systemunitdir)
80 local s
81 for s in "${services[@]}"; do
82 if [[ ! -f "${D}${unitdir}/${s}" ]]; then
83 @@ -317,7 +327,7 @@ systemd_with_unitdir() {
84 debug-print-function ${FUNCNAME} "${@}"
85 local optname=${1:-systemdsystemunitdir}
86
87 - echo --with-${optname}="$(systemd_get_unitdir)"
88 + echo --with-${optname}="$(systemd_get_systemunitdir)"
89 }
90
91 # @FUNCTION: systemd_with_utildir
92 @@ -344,7 +354,7 @@ systemd_to_myeconfargs() {
93
94 myeconfargs=(
95 "${myeconfargs[@]}"
96 - --with-systemdsystemunitdir="$(systemd_get_unitdir)"
97 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
98 )
99 }
100
101 --
102 2.6.3