This also drops EAPIs < 5 to match toolchain-funcs.eclass. (Its support for EAPI 0 is an implementation detail so crossdev can source it, which is not relevant here.)
Signed-off-by: David Michael <fedora....@gmail.com> --- Hi, Here is a simple eclass EAPI cleanup with no dependencies. There are also small tweaks for style consistency. Maybe the deprecated tmpfiles functions ( https://bugs.gentoo.org/740638 ) could be dropped since they have no removal date, unless they're waiting for the big EAPI 5 cleanup. Thanks. David eclass/systemd.eclass | 56 ++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 33 deletions(-) diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass index ab0d6561984..860ba35b35a 100644 --- a/eclass/systemd.eclass +++ b/eclass/systemd.eclass @@ -4,7 +4,7 @@ # @ECLASS: systemd.eclass # @MAINTAINER: # syst...@gentoo.org -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7 +# @SUPPORTED_EAPIS: 5 6 7 8 # @BLURB: helper functions to install systemd units # @DESCRIPTION: # This eclass provides a set of functions to install unit files for @@ -24,14 +24,14 @@ # } # @CODE -inherit toolchain-funcs - -case ${EAPI:-0} in - 0|1|2|3|4|5|6|7) ;; - *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established." +case ${EAPI} in + 5|6|7|8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; esac -if [[ ${EAPI:-0} == [0123456] ]]; then +inherit toolchain-funcs + +if [[ ${EAPI} == [56] ]]; then DEPEND="virtual/pkgconfig" else BDEPEND="virtual/pkgconfig" @@ -72,7 +72,6 @@ _systemd_get_systemunitdir() { # ${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_systemunitdir)" @@ -82,7 +81,7 @@ systemd_get_systemunitdir() { # @DESCRIPTION: # Deprecated alias for systemd_get_systemunitdir. systemd_get_unitdir() { - [[ ${EAPI} == [012345] ]] || die "${FUNCNAME} is banned in EAPI 6, use systemd_get_systemunitdir instead" + [[ ${EAPI} == 5 ]] || die "${FUNCNAME} is banned in EAPI 6, use systemd_get_systemunitdir instead" systemd_get_systemunitdir } @@ -101,7 +100,6 @@ _systemd_get_userunitdir() { # ${D}). This function always succeeds, even if systemd is not # installed. systemd_get_userunitdir() { - has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= debug-print-function ${FUNCNAME} "${@}" echo "${EPREFIX}$(_systemd_get_userunitdir)" @@ -121,7 +119,6 @@ _systemd_get_utildir() { # ${D}). This function always succeeds, even if systemd is not # installed. systemd_get_utildir() { - has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= debug-print-function ${FUNCNAME} "${@}" echo "${EPREFIX}$(_systemd_get_utildir)" @@ -138,10 +135,8 @@ _systemd_get_systemgeneratordir() { # @FUNCTION: systemd_get_systemgeneratordir # @DESCRIPTION: # Output the path for the systemd system generator directory (not including -# ${D}). This function always succeeds, even if systemd is not -# installed. +# ${D}). This function always succeeds, even if systemd is not installed. systemd_get_systemgeneratordir() { - has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= debug-print-function ${FUNCNAME} "${@}" echo "${EPREFIX}$(_systemd_get_systemgeneratordir)" @@ -150,8 +145,7 @@ systemd_get_systemgeneratordir() { # @FUNCTION: systemd_dounit # @USAGE: <unit>... # @DESCRIPTION: -# Install systemd unit(s). Uses doins, thus it is fatal in EAPI 4 -# and non-fatal in earlier EAPIs. +# Install systemd unit(s). Uses doins, thus it is fatal. systemd_dounit() { debug-print-function ${FUNCNAME} "${@}" @@ -165,8 +159,7 @@ systemd_dounit() { # @FUNCTION: systemd_newunit # @USAGE: <old-name> <new-name> # @DESCRIPTION: -# Install systemd unit with a new name. Uses newins, thus it is fatal -# in EAPI 4 and non-fatal in earlier EAPIs. +# Install systemd unit with a new name. Uses newins, thus it is fatal. systemd_newunit() { debug-print-function ${FUNCNAME} "${@}" @@ -180,8 +173,7 @@ systemd_newunit() { # @FUNCTION: systemd_douserunit # @USAGE: <unit>... # @DESCRIPTION: -# Install systemd user unit(s). Uses doins, thus it is fatal in EAPI 4 -# and non-fatal in earlier EAPIs. +# Install systemd user unit(s). Uses doins, thus it is fatal. systemd_douserunit() { debug-print-function ${FUNCNAME} "${@}" @@ -196,7 +188,7 @@ systemd_douserunit() { # @USAGE: <old-name> <new-name> # @DESCRIPTION: # Install systemd user unit with a new name. Uses newins, thus it -# is fatal in EAPI 4 and non-fatal in earlier EAPIs. +# is fatal. systemd_newuserunit() { debug-print-function ${FUNCNAME} "${@}" @@ -242,11 +234,11 @@ systemd_install_serviced() { # @DESCRIPTION: # Deprecated in favor of tmpfiles.eclass. # -# Install systemd tmpfiles.d files. Uses doins, thus it is fatal -# in EAPI 4 and non-fatal in earlier EAPIs. +# Install systemd tmpfiles.d files. Uses doins, thus it is fatal. systemd_dotmpfilesd() { debug-print-function ${FUNCNAME} "${@}" + local f for f; do [[ ${f} == *.conf ]] \ || die 'tmpfiles.d files need to have .conf suffix.' @@ -254,7 +246,7 @@ systemd_dotmpfilesd() { ( insopts -m 0644 - insinto /usr/lib/tmpfiles.d/ + insinto /usr/lib/tmpfiles.d doins "${@}" ) } @@ -265,7 +257,7 @@ systemd_dotmpfilesd() { # Deprecated in favor of tmpfiles.eclass. # # Install systemd tmpfiles.d file under a new name. Uses newins, thus it -# is fatal in EAPI 4 and non-fatal in earlier EAPIs. +# is fatal. systemd_newtmpfilesd() { debug-print-function ${FUNCNAME} "${@}" @@ -274,7 +266,7 @@ systemd_newtmpfilesd() { ( insopts -m 0644 - insinto /usr/lib/tmpfiles.d/ + insinto /usr/lib/tmpfiles.d newins "${@}" ) } @@ -283,8 +275,7 @@ systemd_newtmpfilesd() { # @USAGE: <target> <service> # @DESCRIPTION: # Enable service in desired target, e.g. install a symlink for it. -# Uses dosym, thus it is fatal in EAPI 4 and non-fatal in earlier -# EAPIs. +# Uses dosym, thus it is fatal. systemd_enable_service() { debug-print-function ${FUNCNAME} "${@}" @@ -307,8 +298,7 @@ systemd_enable_service() { # and name, while the remaining arguments list service units that will # be added to that file. # -# Uses doins, thus it is fatal in EAPI 4 and non-fatal in earlier -# EAPIs. +# Uses doins, thus it is fatal. # # Doc: https://www.freedesktop.org/wiki/Software/systemd/timedated/ systemd_enable_ntpunit() { @@ -363,7 +353,7 @@ systemd_enable_ntpunit() { # argument to this function (`$(systemd_with_unitdir systemdunitdir)'). Please # remember to report a bug upstream as well. systemd_with_unitdir() { - [[ ${EAPI:-0} != [012345] ]] && die "${FUNCNAME} is banned in EAPI ${EAPI}, use --with-${1:-systemdsystemunitdir}=\"\$(systemd_get_systemunitdir)\" instead" + [[ ${EAPI} == 5 ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use --with-${1:-systemdsystemunitdir}=\"\$(systemd_get_systemunitdir)\" instead" debug-print-function ${FUNCNAME} "${@}" local optname=${1:-systemdsystemunitdir} @@ -380,7 +370,7 @@ systemd_with_unitdir() { # systemd helpers. This function always succeeds. Its output may be quoted # in order to preserve whitespace in paths. systemd_with_utildir() { - [[ ${EAPI:-0} != [012345] ]] && die "${FUNCNAME} is banned in EAPI ${EAPI}, use --with-systemdutildir=\"\$(systemd_get_utildir)\" instead" + [[ ${EAPI} == 5 ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use --with-systemdutildir=\"\$(systemd_get_utildir)\" instead" debug-print-function ${FUNCNAME} "${@}" @@ -455,7 +445,7 @@ systemd_tmpfiles_create() { [[ ${EBUILD_PHASE} == postinst ]] || die "${FUNCNAME}: Only valid in pkg_postinst" [[ ${#} -gt 0 ]] || die "${FUNCNAME}: Must specify at least one filename" [[ ${ROOT:-/} == / ]] || return 0 - type systemd-tmpfiles &> /dev/null || return 0 + type systemd-tmpfiles &>/dev/null || return 0 systemd-tmpfiles --create "${@}" } -- 2.31.1