commit:     9b93721339840ee78f87dd8a855164154e0d3c32
Author:     Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  5 23:56:27 2022 +0000
Commit:     Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
CommitDate: Sat Feb  5 23:57:33 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9b937213

media-video/wireplumber: add masked USE=system-service

Closes: https://github.com/gentoo/gentoo/pull/23972
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Jason A. Donenfeld <zx2c4 <AT> gentoo.org>

 media-video/wireplumber/metadata.xml               |  3 +++
 .../wireplumber/wireplumber-0.4.7-r1.ebuild        | 23 ++++++++++++++++++----
 media-video/wireplumber/wireplumber-9999.ebuild    | 23 ++++++++++++++++++----
 profiles/base/package.use.mask                     |  1 +
 4 files changed, 42 insertions(+), 8 deletions(-)

diff --git a/media-video/wireplumber/metadata.xml 
b/media-video/wireplumber/metadata.xml
index 6c8e29d33878..d0319b1689c5 100644
--- a/media-video/wireplumber/metadata.xml
+++ b/media-video/wireplumber/metadata.xml
@@ -14,4 +14,7 @@
                
<changelog>https://gitlab.freedesktop.org/pipewire/wireplumber/-/releases</changelog>
                
<!--doc>https://gitlab.freedesktop.org/pipewire/wireplumber/-/wikis/home</doc-->
        </upstream>
+       <use>
+               <flag name="system-service">Install systemd unit files for 
running as a system service. Not recommended.</flag>
+       </use>
 </pkgmetadata>

diff --git a/media-video/wireplumber/wireplumber-0.4.7-r1.ebuild 
b/media-video/wireplumber/wireplumber-0.4.7-r1.ebuild
index a071b5b2b18f..6c3ec05b1b1c 100644
--- a/media-video/wireplumber/wireplumber-0.4.7-r1.ebuild
+++ b/media-video/wireplumber/wireplumber-0.4.7-r1.ebuild
@@ -21,11 +21,12 @@ 
HOMEPAGE="https://gitlab.freedesktop.org/pipewire/wireplumber";
 
 LICENSE="MIT"
 SLOT="0/0.4"
-IUSE="elogind systemd test"
+IUSE="elogind system-service systemd test"
 
 REQUIRED_USE="
        ${LUA_REQUIRED_USE}
        ?? ( elogind systemd )
+       system-service? ( systemd )
 "
 
 RESTRICT="!test? ( test )"
@@ -50,7 +51,12 @@ DEPEND="
 #      $(lua_gen_cond_dep '
 #              dev-lua/<NAME>[${LUA_USEDEP}]
 #      ')
-RDEPEND="${DEPEND}"
+RDEPEND="${DEPEND}
+       system-service? (
+               acct-user/pipewire
+               acct-group/pipewire
+       )
+"
 
 DOCS=( {NEWS,README}.rst )
 
@@ -66,7 +72,7 @@ src_configure() {
                -Dsystem-lua-version=$(ver_cut 1-2 $(lua_get_version))
                $(meson_feature elogind)
                $(meson_feature systemd)
-               -Dsystemd-system-service=false # Matches upstream
+               $(meson_use system-service systemd-system-service)
                $(meson_use systemd systemd-user-service)
                -Dsystemd-system-unit-dir=$(systemd_get_systemunitdir)
                -Dsystemd-user-unit-dir=$(systemd_get_userunitdir)
@@ -90,5 +96,14 @@ pkg_postinst() {
                ewarn "or, if it does exist, that any reference to"
                ewarn "${EROOT}/usr/bin/pipewire-media-session is commented out 
(begins with a #)."
        fi
-       ewarn
+       if use system-service; then
+               ewarn
+               ewarn "WARNING: you have enabled the system-service USE flag, 
which installs"
+               ewarn "the system-wide systemd units that enable WirePlumber to 
run as a system"
+               ewarn "service. This is more than likely NOT what you want. You 
are strongly"
+               ewarn "advised not to enable this mode and instead stick with 
systemd user"
+               ewarn "units. The default configuration files will likely not 
work out of"
+               ewarn "box, and you are on your own with configuration."
+               ewarn
+       fi
 }

diff --git a/media-video/wireplumber/wireplumber-9999.ebuild 
b/media-video/wireplumber/wireplumber-9999.ebuild
index 2e6c068b1ee9..f377227e2460 100644
--- a/media-video/wireplumber/wireplumber-9999.ebuild
+++ b/media-video/wireplumber/wireplumber-9999.ebuild
@@ -21,11 +21,12 @@ 
HOMEPAGE="https://gitlab.freedesktop.org/pipewire/wireplumber";
 
 LICENSE="MIT"
 SLOT="0/0.4"
-IUSE="elogind systemd test"
+IUSE="elogind system-service systemd test"
 
 REQUIRED_USE="
        ${LUA_REQUIRED_USE}
        ?? ( elogind systemd )
+       system-service? ( systemd )
 "
 
 RESTRICT="!test? ( test )"
@@ -50,7 +51,12 @@ DEPEND="
 #      $(lua_gen_cond_dep '
 #              dev-lua/<NAME>[${LUA_USEDEP}]
 #      ')
-RDEPEND="${DEPEND}"
+RDEPEND="${DEPEND}
+       system-service? (
+               acct-user/pipewire
+               acct-group/pipewire
+       )
+"
 
 DOCS=( {NEWS,README}.rst )
 
@@ -62,7 +68,7 @@ src_configure() {
                -Dsystem-lua-version=$(ver_cut 1-2 $(lua_get_version))
                $(meson_feature elogind)
                $(meson_feature systemd)
-               -Dsystemd-system-service=false # Matches upstream
+               $(meson_use system-service systemd-system-service)
                $(meson_use systemd systemd-user-service)
                -Dsystemd-system-unit-dir=$(systemd_get_systemunitdir)
                -Dsystemd-user-unit-dir=$(systemd_get_userunitdir)
@@ -86,5 +92,14 @@ pkg_postinst() {
                ewarn "or, if it does exist, that any reference to"
                ewarn "${EROOT}/usr/bin/pipewire-media-session is commented out 
(begins with a #)."
        fi
-       ewarn
+       if use system-service; then
+               ewarn
+               ewarn "WARNING: you have enabled the system-service USE flag, 
which installs"
+               ewarn "the system-wide systemd units that enable WirePlumber to 
run as a system"
+               ewarn "service. This is more than likely NOT what you want. You 
are strongly"
+               ewarn "advised not to enable this mode and instead stick with 
systemd user"
+               ewarn "units. The default configuration files will likely not 
work out of"
+               ewarn "box, and you are on your own with configuration."
+               ewarn
+       fi
 }

diff --git a/profiles/base/package.use.mask b/profiles/base/package.use.mask
index ce62e749c618..22b5b3da0336 100644
--- a/profiles/base/package.use.mask
+++ b/profiles/base/package.use.mask
@@ -10,6 +10,7 @@
 # We're still ironing out some kinks and writing documentation for
 # this feature, so keep masked for now.
 media-video/pipewire system-service
+media-video/wireplumber system-service
 
 # Sam James <s...@gentoo.org> (2021-01-24)
 # USE=custom-cflags is _particularly_ dangerous on sys-libs/glibc and

Reply via email to