Gentoo Archives: gentoo-commits

From: Jory Pratt <anarchy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: sys-auth/polkit/, sys-auth/polkit/files/
Date: Thu, 17 Sep 2020 15:19:45
Message-Id: 1600355954.b690de43759b5869bfc3af925094a0485d323b41.anarchy@gentoo
1 commit: b690de43759b5869bfc3af925094a0485d323b41
2 Author: stefson <herrtimson <AT> yahoo <DOT> de>
3 AuthorDate: Wed Sep 9 07:18:15 2020 +0000
4 Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 17 15:19:14 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=b690de43
7
8 sys-auth/polkit: add upstream fix for mozjs-78
9
10 taken from upstream: https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/64
11
12 Keywords are dropped, to allow testing for others.
13
14 Signed-off-by: Steffen Kuhn <nielson2 <AT> yandex.com>
15 Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org>
16
17 sys-auth/polkit/files/polkit-0.117-mozjs-78.patch | 104 ++++++++++++++++
18 sys-auth/polkit/polkit-0.117-r1.ebuild | 138 ++++++++++++++++++++++
19 2 files changed, 242 insertions(+)
20
21 diff --git a/sys-auth/polkit/files/polkit-0.117-mozjs-78.patch b/sys-auth/polkit/files/polkit-0.117-mozjs-78.patch
22 new file mode 100644
23 index 0000000..f64a7bf
24 --- /dev/null
25 +++ b/sys-auth/polkit/files/polkit-0.117-mozjs-78.patch
26 @@ -0,0 +1,104 @@
27 +From 3e1d61868fa8bfc586099302e931433270e5d17d Mon Sep 17 00:00:00 2001
28 +From: Jan Rybar <jrybar@××××××.com>
29 +Date: Tue, 25 Aug 2020 16:38:34 +0000
30 +Subject: [PATCH] Port polkit to mozjs78
31 +
32 +---
33 + configure.ac | 4 ++--
34 + src/polkitbackend/polkitbackendjsauthority.cpp | 15 ++++++---------
35 + 2 files changed, 8 insertions(+), 11 deletions(-)
36 +
37 +diff --git a/configure.ac b/configure.ac
38 +index eea70fc7..c4569f10 100644
39 +--- a/configure.ac
40 ++++ b/configure.ac
41 +@@ -34,7 +34,7 @@ AC_PROG_LN_S
42 + AC_SYS_LARGEFILE
43 + AM_PROG_CC_C_O
44 + AC_PROG_CXX
45 +-AX_CXX_COMPILE_STDCXX([14], [], [mandatory])
46 ++AX_CXX_COMPILE_STDCXX([17], [], [mandatory])
47 +
48 + # Taken from dbus
49 + AC_ARG_ENABLE(ansi, [ --enable-ansi enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
50 +@@ -80,7 +80,7 @@ PKG_CHECK_MODULES(GLIB, [gmodule-2.0 gio-unix-2.0 >= 2.30.0])
51 + AC_SUBST(GLIB_CFLAGS)
52 + AC_SUBST(GLIB_LIBS)
53 +
54 +-PKG_CHECK_MODULES(LIBJS, [mozjs-68])
55 ++PKG_CHECK_MODULES(LIBJS, [mozjs-78])
56 +
57 + AC_SUBST(LIBJS_CFLAGS)
58 + AC_SUBST(LIBJS_CXXFLAGS)
59 +diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp
60 +index 25bd1f93..ca171083 100644
61 +--- a/src/polkitbackend/polkitbackendjsauthority.cpp
62 ++++ b/src/polkitbackend/polkitbackendjsauthority.cpp
63 +@@ -49,6 +49,7 @@
64 + #include <js/Realm.h>
65 + #include <js/SourceText.h>
66 + #include <js/Warnings.h>
67 ++#include <js/Array.h>
68 + #include <jsapi.h>
69 +
70 + #include "initjs.h" /* init.js */
71 +@@ -367,7 +368,7 @@ load_scripts (PolkitBackendJsAuthority *authority)
72 + static void
73 + reload_scripts (PolkitBackendJsAuthority *authority)
74 + {
75 +- JS::AutoValueArray<1> args(authority->priv->cx);
76 ++ JS::RootedValueArray<1> args(authority->priv->cx);
77 + JS::RootedValue rval(authority->priv->cx);
78 +
79 + JS::RootedObject js_polkit(authority->priv->cx, authority->priv->js_polkit->get ());
80 +@@ -482,10 +483,6 @@ polkit_backend_js_authority_constructed (GObject *object)
81 + if (!JS::InitSelfHostedCode (authority->priv->cx))
82 + goto fail;
83 +
84 +- JS::ContextOptionsRef (authority->priv->cx)
85 +- .setIon (TRUE)
86 +- .setBaseline (TRUE)
87 +- .setAsmJS (TRUE);
88 + JS::SetWarningReporter(authority->priv->cx, report_error);
89 + JS_SetContextPrivate (authority->priv->cx, authority);
90 +
91 +@@ -720,7 +717,7 @@ set_property_strv (PolkitBackendJsAuthority *authority,
92 + elems[n].setNull ();
93 + }
94 +
95 +- JS::RootedObject array_object(authority->priv->cx, JS_NewArrayObject (authority->priv->cx, elems));
96 ++ JS::RootedObject array_object(authority->priv->cx, JS::NewArrayObject (authority->priv->cx, elems));
97 +
98 + value_jsval = JS::ObjectValue (*array_object);
99 + JS_SetProperty (authority->priv->cx, obj, name, value_jsval);
100 +@@ -1114,7 +1111,7 @@ polkit_backend_js_authority_get_admin_auth_identities (PolkitBackendInteractiveA
101 + {
102 + PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority);
103 + GList *ret = NULL;
104 +- JS::AutoValueArray<2> args(authority->priv->cx);
105 ++ JS::RootedValueArray<2> args(authority->priv->cx);
106 + JS::RootedValue rval(authority->priv->cx);
107 + guint n;
108 + GError *error = NULL;
109 +@@ -1218,7 +1215,7 @@ polkit_backend_js_authority_check_authorization_sync (PolkitBackendInteractiveAu
110 + {
111 + PolkitBackendJsAuthority *authority = POLKIT_BACKEND_JS_AUTHORITY (_authority);
112 + PolkitImplicitAuthorization ret = implicit;
113 +- JS::AutoValueArray<2> args(authority->priv->cx);
114 ++ JS::RootedValueArray<2> args(authority->priv->cx);
115 + JS::RootedValue rval(authority->priv->cx);
116 + GError *error = NULL;
117 + JS::RootedString ret_jsstr (authority->priv->cx);
118 +@@ -1409,7 +1406,7 @@ js_polkit_spawn (JSContext *cx,
119 + JS::CallArgs args = JS::CallArgsFromVp (js_argc, vp);
120 + array_object = &args[0].toObject();
121 +
122 +- if (!JS_GetArrayLength (cx, array_object, &array_len))
123 ++ if (!JS::GetArrayLength (cx, array_object, &array_len))
124 + {
125 + JS_ReportErrorUTF8 (cx, "Failed to get array length");
126 + goto out;
127 +--
128 +GitLab
129 +
130 +
131
132 diff --git a/sys-auth/polkit/polkit-0.117-r1.ebuild b/sys-auth/polkit/polkit-0.117-r1.ebuild
133 new file mode 100644
134 index 0000000..4adbf55
135 --- /dev/null
136 +++ b/sys-auth/polkit/polkit-0.117-r1.ebuild
137 @@ -0,0 +1,138 @@
138 +# Copyright 1999-2020 Gentoo Authors
139 +# Distributed under the terms of the GNU General Public License v2
140 +
141 +EAPI=7
142 +
143 +inherit autotools pam pax-utils systemd xdg-utils
144 +
145 +DESCRIPTION="Policy framework for controlling privileges for system-wide services"
146 +HOMEPAGE="https://www.freedesktop.org/wiki/Software/polkit https://gitlab.freedesktop.org/polkit/polkit"
147 +SRC_URI="https://www.freedesktop.org/software/${PN}/releases/${P}.tar.gz"
148 +
149 +LICENSE="LGPL-2"
150 +SLOT="0"
151 +#KEYWORDS="~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 x86"
152 +IUSE="consolekit elogind examples gtk +introspection jit kde nls pam selinux systemd test"
153 +RESTRICT="!test? ( test )"
154 +
155 +REQUIRED_USE="^^ ( consolekit elogind systemd )"
156 +
157 +BDEPEND="
158 + acct-user/polkitd
159 + app-text/docbook-xml-dtd:4.1.2
160 + app-text/docbook-xsl-stylesheets
161 + dev-libs/gobject-introspection-common
162 + dev-libs/libxslt
163 + dev-util/glib-utils
164 + dev-util/gtk-doc-am
165 + dev-util/intltool
166 + sys-devel/gettext
167 + virtual/pkgconfig
168 + introspection? ( dev-libs/gobject-introspection )
169 +"
170 +DEPEND="
171 + dev-lang/spidermonkey:78[-debug]
172 + dev-libs/glib:2
173 + dev-libs/expat
174 + elogind? ( sys-auth/elogind )
175 + pam? (
176 + sys-auth/pambase
177 + sys-libs/pam
178 + )
179 + systemd? ( sys-apps/systemd:0=[policykit] )
180 +"
181 +RDEPEND="${DEPEND}
182 + acct-user/polkitd
183 + selinux? ( sec-policy/selinux-policykit )
184 +"
185 +PDEPEND="
186 + consolekit? ( sys-auth/consolekit[policykit] )
187 + gtk? ( || (
188 + >=gnome-extra/polkit-gnome-0.105
189 + >=lxde-base/lxsession-0.5.2
190 + ) )
191 + kde? ( kde-plasma/polkit-kde-agent )
192 +"
193 +
194 +DOCS=( docs/TODO HACKING NEWS README )
195 +
196 +PATCHES=(
197 + # bug 660880
198 + "${FILESDIR}"/polkit-0.115-elogind.patch
199 +
200 + # https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/64
201 + "${FILESDIR}"/polkit-0.117-mozjs-78.patch
202 +
203 + # locally rebased patch
204 + "${FILESDIR}"/polkit-0.116-make-netgroup-support-optional-2.patch
205 +)
206 +
207 +QA_MULTILIB_PATHS="
208 + usr/lib/polkit-1/polkit-agent-helper-1
209 + usr/lib/polkit-1/polkitd"
210 +
211 +src_prepare() {
212 + default
213 +
214 + sed -i -e 's|unix-group:wheel|unix-user:0|' src/polkitbackend/*-default.rules || die #401513
215 +
216 + # Workaround upstream hack around standard gtk-doc behavior, bug #552170
217 + sed -i -e 's/@ENABLE_GTK_DOC_TRUE@\(TARGET_DIR\)/\1/' \
218 + -e '/install-data-local:/,/uninstall-local:/ s/@ENABLE_GTK_DOC_TRUE@//' \
219 + -e 's/@ENABLE_GTK_DOC_FALSE@install-data-local://' \
220 + docs/polkit/Makefile.in || die
221 +
222 + # disable broken test - bug #624022
223 + sed -i -e "/^SUBDIRS/s/polkitbackend//" test/Makefile.am || die
224 +
225 + # Fix cross-building, bug #590764, elogind patch, bug #598615
226 + eautoreconf
227 +}
228 +
229 +src_configure() {
230 + xdg_environment_reset
231 +
232 + local myeconfargs=(
233 + --localstatedir="${EPREFIX}"/var
234 + --disable-static
235 + --enable-man-pages
236 + --disable-gtk-doc
237 + --disable-examples
238 + $(use_enable elogind libelogind)
239 + $(use_enable introspection)
240 + $(use_enable nls)
241 + $(usex pam "--with-pam-module-dir=$(getpam_mod_dir)" '')
242 + --with-authfw=$(usex pam pam shadow)
243 + $(use_enable systemd libsystemd-login)
244 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
245 + $(use_enable test)
246 + --with-os-type=gentoo
247 + )
248 + econf "${myeconfargs[@]}"
249 +}
250 +
251 +src_compile() {
252 + default
253 +
254 + # Required for polkitd on hardened/PaX due to spidermonkey's JIT
255 + pax-mark mr src/polkitbackend/.libs/polkitd test/polkitbackend/.libs/polkitbackendjsauthoritytest
256 +}
257 +
258 +src_install() {
259 + default
260 +
261 + if use examples; then
262 + insinto /usr/share/doc/${PF}/examples
263 + doins src/examples/{*.c,*.policy*}
264 + fi
265 +
266 + diropts -m 0700 -o polkitd
267 + keepdir /usr/share/polkit-1/rules.d
268 +
269 + find "${ED}" -name '*.la' -delete || die
270 +}
271 +
272 +pkg_postinst() {
273 + chmod 0700 "${EROOT}"/{etc,usr/share}/polkit-1/rules.d
274 + chown polkitd "${EROOT}"/{etc,usr/share}/polkit-1/rules.d
275 +}