Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-auth/polkit/, sys-auth/polkit/files/
Date: Tue, 26 Mar 2019 08:58:57
Message-Id: 1553590720.3593d9638f4876e8540afb40012856ebe6d257b5.polynomial-c@gentoo
1 commit: 3593d9638f4876e8540afb40012856ebe6d257b5
2 Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
3 AuthorDate: Mon Mar 25 00:49:59 2019 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Tue Mar 26 08:58:40 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3593d963
7
8 sys-auth/polkit: Use dev-lang/spidermonkey:60.
9
10 Port to EAPI="7".
11 Improve HOMEPAGE.
12
13 Fixes: https://bugs.gentoo.org/681692
14 Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>
15 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
16
17 .../files/polkit-0.115-spidermonkey-60.patch | 180 +++++++++++++++++++++
18 sys-auth/polkit/polkit-0.115-r4.ebuild | 143 ++++++++++++++++
19 2 files changed, 323 insertions(+)
20
21 diff --git a/sys-auth/polkit/files/polkit-0.115-spidermonkey-60.patch b/sys-auth/polkit/files/polkit-0.115-spidermonkey-60.patch
22 new file mode 100644
23 index 00000000000..8a4510ad205
24 --- /dev/null
25 +++ b/sys-auth/polkit/files/polkit-0.115-spidermonkey-60.patch
26 @@ -0,0 +1,180 @@
27 +From c9cd7024140b837b5693d7c1bbaad1b0cd31cce6 Mon Sep 17 00:00:00 2001
28 +From: Emmanuele Bassi <ebassi@×××××.org>
29 +Date: Fri, 31 Aug 2018 13:32:16 +0100
30 +Subject: [PATCH] Depend on mozjs-60
31 +
32 +This is the new ESR version of the Mozilla JS engine, superceding
33 +mozjs-52.
34 +---
35 + configure.ac | 2 +-
36 + 1 file changed, 1 insertion(+), 1 deletion(-)
37 +
38 +diff --git a/configure.ac b/configure.ac
39 +index 5c37e48..5cedb4e 100644
40 +--- a/configure.ac
41 ++++ b/configure.ac
42 +@@ -79,7 +79,7 @@ PKG_CHECK_MODULES(GLIB, [gmodule-2.0 gio-unix-2.0 >= 2.30.0])
43 + AC_SUBST(GLIB_CFLAGS)
44 + AC_SUBST(GLIB_LIBS)
45 +
46 +-PKG_CHECK_MODULES(LIBJS, [mozjs-52])
47 ++PKG_CHECK_MODULES(LIBJS, [mozjs-60])
48 +
49 + AC_SUBST(LIBJS_CFLAGS)
50 + AC_SUBST(LIBJS_CXXFLAGS)
51 +
52 +
53 +From dd00683e8781d230a45781d509d86ad676138564 Mon Sep 17 00:00:00 2001
54 +From: Emmanuele Bassi <ebassi@×××××.org>
55 +Date: Fri, 31 Aug 2018 13:33:20 +0100
56 +Subject: [PATCH] Port the JS authority to mozjs-60
57 +
58 +API changes in mozjs that need to be reflected in the JS authority:
59 +
60 + - the JS::CompileOptions constructor and the JS::CompartmentOptions
61 + do not allow setting a JS version any more
62 +
63 + - do not use NULL comparisons for C++ objects
64 +
65 + - the resize() method for a vector has a return value that needs
66 + to be handled
67 +
68 + - JSClassOps has different fields
69 +---
70 + .../polkitbackendjsauthority.cpp | 65 +++++++++----------
71 + 1 file changed, 32 insertions(+), 33 deletions(-)
72 +
73 +diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp
74 +index 7602714..984a0f0 100644
75 +--- a/src/polkitbackend/polkitbackendjsauthority.cpp
76 ++++ b/src/polkitbackend/polkitbackendjsauthority.cpp
77 +@@ -150,18 +150,17 @@ G_DEFINE_TYPE (PolkitBackendJsAuthority, polkit_backend_js_authority, POLKIT_BAC
78 + /* ---------------------------------------------------------------------------------------------------- */
79 +
80 + static const struct JSClassOps js_global_class_ops = {
81 +- NULL,
82 +- NULL,
83 +- NULL,
84 +- NULL,
85 +- NULL,
86 +- NULL,
87 +- NULL,
88 +- NULL,
89 +- NULL,
90 +- NULL,
91 +- NULL,
92 +- NULL
93 ++ nullptr, // addProperty
94 ++ nullptr, // deleteProperty
95 ++ nullptr, // enumerate
96 ++ nullptr, // newEnumerate
97 ++ nullptr, // resolve
98 ++ nullptr, // mayResolve
99 ++ nullptr, // finalize
100 ++ nullptr, // call
101 ++ nullptr, // hasInstance
102 ++ nullptr, // construct
103 ++ JS_GlobalObjectTraceHook
104 + };
105 +
106 + static JSClass js_global_class = {
107 +@@ -172,18 +171,17 @@ static JSClass js_global_class = {
108 +
109 + /* ---------------------------------------------------------------------------------------------------- */
110 + static const struct JSClassOps js_polkit_class_ops = {
111 +- NULL,
112 +- NULL,
113 +- NULL,
114 +- NULL,
115 +- NULL,
116 +- NULL,
117 +- NULL,
118 +- NULL,
119 +- NULL,
120 +- NULL,
121 +- NULL,
122 +- NULL
123 ++ nullptr, // addProperty
124 ++ nullptr, // deleteProperty
125 ++ nullptr, // enumerate
126 ++ nullptr, // newEnumerate
127 ++ nullptr, // resolve
128 ++ nullptr, // mayResolve
129 ++ nullptr, // finalize
130 ++ nullptr, // call
131 ++ nullptr, // hasInstance
132 ++ nullptr, // construct
133 ++ nullptr // trace
134 + };
135 +
136 + static JSClass js_polkit_class = {
137 +@@ -469,19 +467,18 @@ polkit_backend_js_authority_constructed (GObject *object)
138 +
139 + {
140 + JS::CompartmentOptions compart_opts;
141 +- compart_opts.behaviors().setVersion(JSVERSION_LATEST);
142 ++
143 + JS::RootedObject global(authority->priv->cx);
144 +
145 + authority->priv->js_global = new JS::Heap<JSObject*> (JS_NewGlobalObject (authority->priv->cx, &js_global_class, NULL, JS::FireOnNewGlobalHook, compart_opts));
146 +
147 + global = authority->priv->js_global->get ();
148 +-
149 +- if (global == NULL)
150 ++ if (!global)
151 + goto fail;
152 +
153 + authority->priv->ac = new JSAutoCompartment(authority->priv->cx, global);
154 +
155 +- if (authority->priv->ac == NULL)
156 ++ if (!authority->priv->ac)
157 + goto fail;
158 +
159 + if (!JS_InitStandardClasses (authority->priv->cx, global))
160 +@@ -493,7 +490,7 @@ polkit_backend_js_authority_constructed (GObject *object)
161 +
162 + polkit = authority->priv->js_polkit->get ();
163 +
164 +- if (polkit == NULL)
165 ++ if (!polkit)
166 + goto fail;
167 +
168 + if (!JS_DefineProperty(authority->priv->cx, global, "polkit", polkit, JSPROP_ENUMERATE))
169 +@@ -504,7 +501,7 @@ polkit_backend_js_authority_constructed (GObject *object)
170 + js_polkit_functions))
171 + goto fail;
172 +
173 +- JS::CompileOptions options(authority->priv->cx, JSVERSION_UNKNOWN);
174 ++ JS::CompileOptions options(authority->priv->cx);
175 + JS::RootedValue rval(authority->priv->cx);
176 + if (!JS::Evaluate (authority->priv->cx,
177 + options,
178 +@@ -684,7 +681,9 @@ set_property_strv (PolkitBackendJsAuthority *authority,
179 + JS::AutoValueVector elems(authority->priv->cx);
180 + guint n;
181 +
182 +- elems.resize(value->len);
183 ++ if (!elems.resize(value->len))
184 ++ g_error ("Unable to resize vector");
185 ++
186 + for (n = 0; n < value->len; n++)
187 + {
188 + const char *c_string = (const char *) g_ptr_array_index(value, n);
189 +@@ -741,7 +740,7 @@ subject_to_jsval (PolkitBackendJsAuthority *authority,
190 + GError **error)
191 + {
192 + gboolean ret = FALSE;
193 +- JS::CompileOptions options(authority->priv->cx, JSVERSION_UNKNOWN);
194 ++ JS::CompileOptions options(authority->priv->cx);
195 + const char *src;
196 + JS::RootedObject obj(authority->priv->cx);
197 + pid_t pid;
198 +@@ -868,7 +867,7 @@ action_and_details_to_jsval (PolkitBackendJsAuthority *authority,
199 + GError **error)
200 + {
201 + gboolean ret = FALSE;
202 +- JS::CompileOptions options(authority->priv->cx, JSVERSION_UNKNOWN);
203 ++ JS::CompileOptions options(authority->priv->cx);
204 + const char *src;
205 + JS::RootedObject obj(authority->priv->cx);
206 + gchar **keys;
207
208 diff --git a/sys-auth/polkit/polkit-0.115-r4.ebuild b/sys-auth/polkit/polkit-0.115-r4.ebuild
209 new file mode 100644
210 index 00000000000..ecc024a27d3
211 --- /dev/null
212 +++ b/sys-auth/polkit/polkit-0.115-r4.ebuild
213 @@ -0,0 +1,143 @@
214 +# Copyright 1999-2019 Gentoo Authors
215 +# Distributed under the terms of the GNU General Public License v2
216 +
217 +EAPI=7
218 +
219 +inherit autotools pam pax-utils systemd user xdg-utils
220 +
221 +DESCRIPTION="Policy framework for controlling privileges for system-wide services"
222 +HOMEPAGE="https://www.freedesktop.org/wiki/Software/polkit https://gitlab.freedesktop.org/polkit/polkit"
223 +SRC_URI="https://www.freedesktop.org/software/${PN}/releases/${P}.tar.gz"
224 +
225 +LICENSE="LGPL-2"
226 +SLOT="0"
227 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
228 +IUSE="elogind examples gtk +introspection jit kde nls pam selinux systemd test"
229 +
230 +REQUIRED_USE="?? ( elogind systemd )"
231 +
232 +BDEPEND="
233 + app-text/docbook-xml-dtd:4.1.2
234 + app-text/docbook-xsl-stylesheets
235 + dev-libs/gobject-introspection-common
236 + dev-libs/libxslt
237 + dev-util/glib-utils
238 + dev-util/gtk-doc-am
239 + dev-util/intltool
240 + sys-devel/gettext
241 + virtual/pkgconfig
242 + introspection? ( dev-libs/gobject-introspection )
243 +"
244 +DEPEND="
245 + dev-lang/spidermonkey:60[-debug]
246 + dev-libs/glib:2
247 + dev-libs/expat
248 + elogind? ( sys-auth/elogind )
249 + pam? (
250 + sys-auth/pambase
251 + virtual/pam
252 + )
253 + systemd? ( sys-apps/systemd:0=[policykit] )
254 +"
255 +RDEPEND="${DEPEND}
256 + selinux? ( sec-policy/selinux-policykit )
257 +"
258 +PDEPEND="
259 + gtk? ( || (
260 + >=gnome-extra/polkit-gnome-0.105
261 + >=lxde-base/lxsession-0.5.2
262 + ) )
263 + kde? ( kde-plasma/polkit-kde-agent )
264 + !systemd? ( !elogind? ( sys-auth/consolekit[policykit] ) )
265 +"
266 +
267 +DOCS=( docs/TODO HACKING NEWS README )
268 +
269 +PATCHES=(
270 + # bug 660880
271 + "${FILESDIR}"/polkit-0.115-elogind.patch
272 + "${FILESDIR}"/CVE-2018-19788.patch
273 + "${FILESDIR}"/polkit-0.115-spidermonkey-60.patch
274 +)
275 +
276 +QA_MULTILIB_PATHS="
277 + usr/lib/polkit-1/polkit-agent-helper-1
278 + usr/lib/polkit-1/polkitd"
279 +
280 +pkg_setup() {
281 + local u=polkitd
282 + local g=polkitd
283 + local h=/var/lib/polkit-1
284 +
285 + enewgroup ${g}
286 + enewuser ${u} -1 -1 ${h} ${g}
287 + esethome ${u} ${h}
288 +}
289 +
290 +src_prepare() {
291 + default
292 +
293 + sed -i -e 's|unix-group:wheel|unix-user:0|' src/polkitbackend/*-default.rules || die #401513
294 +
295 + # Workaround upstream hack around standard gtk-doc behavior, bug #552170
296 + sed -i -e 's/@ENABLE_GTK_DOC_TRUE@\(TARGET_DIR\)/\1/' \
297 + -e '/install-data-local:/,/uninstall-local:/ s/@ENABLE_GTK_DOC_TRUE@//' \
298 + -e 's/@ENABLE_GTK_DOC_FALSE@install-data-local://' \
299 + docs/polkit/Makefile.in || die
300 +
301 + # disable broken test - bug #624022
302 + sed -i -e "/^SUBDIRS/s/polkitbackend//" test/Makefile.am || die
303 +
304 + # Fix cross-building, bug #590764, elogind patch, bug #598615
305 + eautoreconf
306 +}
307 +
308 +src_configure() {
309 + xdg_environment_reset
310 +
311 + local myeconfargs=(
312 + --localstatedir="${EPREFIX}"/var
313 + --disable-static
314 + --enable-man-pages
315 + --disable-gtk-doc
316 + --disable-examples
317 + $(use_enable elogind libelogind)
318 + $(use_enable introspection)
319 + $(use_enable nls)
320 + $(usex pam "--with-pam-module-dir=$(getpam_mod_dir)" '')
321 + --with-authfw=$(usex pam pam shadow)
322 + $(use_enable systemd libsystemd-login)
323 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
324 + $(use_enable test)
325 + --with-os-type=gentoo
326 + )
327 + econf "${myeconfargs[@]}"
328 +}
329 +
330 +src_compile() {
331 + default
332 +
333 + # Required for polkitd on hardened/PaX due to spidermonkey's JIT
334 + pax-mark mr src/polkitbackend/.libs/polkitd test/polkitbackend/.libs/polkitbackendjsauthoritytest
335 +}
336 +
337 +src_install() {
338 + default
339 +
340 + fowners -R polkitd:root /{etc,usr/share}/polkit-1/rules.d
341 +
342 + diropts -m0700 -o polkitd -g polkitd
343 + keepdir /var/lib/polkit-1
344 +
345 + if use examples; then
346 + insinto /usr/share/doc/${PF}/examples
347 + doins src/examples/{*.c,*.policy*}
348 + fi
349 +
350 + find "${ED}" -name '*.la' -delete || die
351 +}
352 +
353 +pkg_postinst() {
354 + chown -R polkitd:root "${EROOT}"/{etc,usr/share}/polkit-1/rules.d
355 + chown -R polkitd:polkitd "${EROOT}"/var/lib/polkit-1
356 +}