Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-auth/elogind/, sys-auth/elogind/files/
Date: Sat, 29 May 2021 21:19:56
Message-Id: 1622322982.5f6b0a2e892790e3dfdb313fe5bb544753cb1133.asturm@gentoo
1 commit: 5f6b0a2e892790e3dfdb313fe5bb544753cb1133
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 29 20:15:39 2021 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Sat May 29 21:16:22 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5f6b0a2e
7
8 sys-auth/elogind: Revert polkit automagic
9
10 Thanks-to: Lars Wendler <polynomial-c <AT> gentoo.org>
11 Package-Manager: Portage-3.0.19, Repoman-3.0.3
12 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
13
14 sys-auth/elogind/elogind-246.10-r1.ebuild | 149 +++++++++++++++++++++
15 .../elogind-246.10-revert-polkit-automagic.patch | 38 ++++++
16 2 files changed, 187 insertions(+)
17
18 diff --git a/sys-auth/elogind/elogind-246.10-r1.ebuild b/sys-auth/elogind/elogind-246.10-r1.ebuild
19 new file mode 100644
20 index 00000000000..0a496b26e71
21 --- /dev/null
22 +++ b/sys-auth/elogind/elogind-246.10-r1.ebuild
23 @@ -0,0 +1,149 @@
24 +# Copyright 1999-2021 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI=7
28 +
29 +if [[ ${PV} = *9999* ]]; then
30 + EGIT_BRANCH="v241-stable"
31 + EGIT_REPO_URI="https://github.com/elogind/elogind.git"
32 + inherit git-r3
33 +else
34 + SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
35 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
36 +fi
37 +
38 +inherit linux-info meson pam udev xdg-utils
39 +
40 +DESCRIPTION="The systemd project's logind, extracted to a standalone package"
41 +HOMEPAGE="https://github.com/elogind/elogind"
42 +
43 +LICENSE="CC0-1.0 LGPL-2.1+ public-domain"
44 +SLOT="0"
45 +IUSE="+acl audit debug doc +pam +policykit selinux"
46 +
47 +BDEPEND="
48 + app-text/docbook-xml-dtd:4.2
49 + app-text/docbook-xml-dtd:4.5
50 + app-text/docbook-xsl-stylesheets
51 + dev-util/gperf
52 + dev-util/intltool
53 + virtual/pkgconfig
54 +"
55 +DEPEND="
56 + audit? ( sys-process/audit )
57 + sys-apps/util-linux
58 + sys-libs/libcap
59 + virtual/libudev:=
60 + acl? ( sys-apps/acl )
61 + pam? ( sys-libs/pam )
62 + selinux? ( sys-libs/libselinux )
63 +"
64 +RDEPEND="${DEPEND}
65 + !sys-apps/systemd
66 +"
67 +PDEPEND="
68 + sys-apps/dbus
69 + policykit? ( sys-auth/polkit )
70 +"
71 +
72 +DOCS=( README.md src/libelogind/sd-bus/GVARIANT-SERIALIZATION )
73 +
74 +PATCHES=(
75 + "${FILESDIR}/${PN}-243.7-nodocs.patch"
76 + "${FILESDIR}/${PN}-241.4-broken-test.patch" # bug 699116
77 + "${FILESDIR}/${P}-revert-polkit-automagic.patch"
78 +)
79 +
80 +pkg_setup() {
81 + local CONFIG_CHECK="~CGROUPS ~EPOLL ~INOTIFY_USER ~SIGNALFD ~TIMERFD"
82 +
83 + use kernel_linux && linux-info_pkg_setup
84 +}
85 +
86 +src_prepare() {
87 + default
88 + xdg_environment_reset
89 +}
90 +
91 +src_configure() {
92 + local rccgroupmode="$(grep rc_cgroup_mode ${EPREFIX}/etc/rc.conf | cut -d '"' -f 2)"
93 + local cgroupmode="legacy"
94 +
95 + if [[ "xhybrid" = "x${rccgroupmode}" ]] ; then
96 + cgroupmode="hybrid"
97 + elif [[ "xunified" = "x${rccgroupmode}" ]] ; then
98 + cgroupmode="unified"
99 + fi
100 +
101 + local emesonargs=(
102 + -Ddocdir="${EPREFIX}/usr/share/doc/${PF}"
103 + -Dhtmldir="${EPREFIX}/usr/share/doc/${PF}/html"
104 + -Dpamlibdir=$(getpam_mod_dir)
105 + -Dudevrulesdir="${EPREFIX}$(get_udevdir)"/rules.d
106 + --libdir="${EPREFIX}"/usr/$(get_libdir)
107 + -Drootlibdir="${EPREFIX}"/$(get_libdir)
108 + -Drootlibexecdir="${EPREFIX}"/$(get_libdir)/elogind
109 + -Drootprefix="${EPREFIX}/"
110 + -Dbashcompletiondir="${EPREFIX}/usr/share/bash-completion/completions"
111 + -Dman=auto
112 + -Dsmack=true
113 + -Dcgroup-controller=openrc
114 + -Ddefault-hierarchy=${cgroupmode}
115 + -Ddefault-kill-user-processes=false
116 + -Dacl=$(usex acl true false)
117 + -Daudit=$(usex audit true false)
118 + --buildtype $(usex debug debug release)
119 + -Dhtml=$(usex doc auto false)
120 + -Dpam=$(usex pam true false)
121 + -Dselinux=$(usex selinux true false)
122 + -Dutmp=$(usex elibc_musl false true)
123 + )
124 +
125 + meson_src_configure
126 +}
127 +
128 +src_install() {
129 + DOCS+=( src/libelogind/sd-bus/GVARIANT-SERIALIZATION )
130 +
131 + meson_src_install
132 +
133 + newinitd "${FILESDIR}"/${PN}.init-r1 ${PN}
134 +
135 + sed -e "s/@libdir@/$(get_libdir)/" "${FILESDIR}"/${PN}.conf.in > ${PN}.conf || die
136 + newconfd ${PN}.conf ${PN}
137 +}
138 +
139 +pkg_postinst() {
140 + if ! use pam; then
141 + ewarn "${PN} will not be managing user logins/seats without USE=\"pam\"!"
142 + ewarn "In other words, it will be useless for most applications."
143 + ewarn
144 + fi
145 + if ! use policykit; then
146 + ewarn "loginctl will not be able to perform privileged operations without"
147 + ewarn "USE=\"policykit\"! That means e.g. no suspend or hibernate."
148 + ewarn
149 + fi
150 + if [[ "$(rc-config list boot | grep elogind)" != "" ]]; then
151 + elog "elogind is currently started from boot runlevel."
152 + elif [[ "$(rc-config list default | grep elogind)" != "" ]]; then
153 + ewarn "elogind is currently started from default runlevel."
154 + ewarn "Please remove elogind from the default runlevel and"
155 + ewarn "add it to the boot runlevel by:"
156 + ewarn "# rc-update del elogind default"
157 + ewarn "# rc-update add elogind boot"
158 + else
159 + elog "elogind is currently not started from any runlevel."
160 + elog "You may add it to the boot runlevel by:"
161 + elog "# rc-update add elogind boot"
162 + elog
163 + elog "Alternatively, you can leave elogind out of any"
164 + elog "runlevel. It will then be started automatically"
165 + if use pam; then
166 + elog "when the first service calls it via dbus, or"
167 + elog "the first user logs into the system."
168 + else
169 + elog "when the first service calls it via dbus."
170 + fi
171 + fi
172 +}
173
174 diff --git a/sys-auth/elogind/files/elogind-246.10-revert-polkit-automagic.patch b/sys-auth/elogind/files/elogind-246.10-revert-polkit-automagic.patch
175 new file mode 100644
176 index 00000000000..5237b7abe72
177 --- /dev/null
178 +++ b/sys-auth/elogind/files/elogind-246.10-revert-polkit-automagic.patch
179 @@ -0,0 +1,38 @@
180 +From 715ce0a6459e418f92e74c7ce52df3244c18f383 Mon Sep 17 00:00:00 2001
181 +From: Sven Eden <sven.eden@×××××××××.com>
182 +Date: Mon, 8 Mar 2021 08:40:08 +0100
183 +Subject: [PATCH] Revert "Disable polkit support if libpolkit is not installed"
184 +
185 +This reverts commit 1194dec4f8f2d1b8bd14e1625f34418ecfce817e.
186 +
187 +Removing polkit support with -Dpolkit=auto when libpolkit is not
188 +installed, removes the whole interface. This makes it impossible to
189 +add polkit support as a runtime dependency.
190 +
191 +Bug: #167
192 +Closes: #206
193 +Signed-off-by: Sven Eden <sven.eden@×××××××××.com>
194 +---
195 + meson.build | 9 ---------
196 + 1 file changed, 9 deletions(-)
197 +
198 +diff --git a/meson.build b/meson.build
199 +index 2dd05db3c..f38551f55 100644
200 +--- a/meson.build
201 ++++ b/meson.build
202 +@@ -1157,15 +1157,6 @@ if want_polkit != 'false' and not skip_deps
203 + message('Old polkit detected, will install pkla files')
204 + install_polkit_pkla = true
205 + endif
206 +-#if 1 /// Disable polkit completely if libpolkit is not there. See elogind issue #167
207 +- if not libpolkit.found()
208 +- if want_polkit != 'auto'
209 +- error('Polkit requested but libpolkit was not found.')
210 +- endif
211 +- install_polkit = false
212 +- want_polkit = false
213 +- endif
214 +-#endif // 1
215 + endif
216 + conf.set10('ENABLE_POLKIT', install_polkit)
217 +