package/polkit: bump version to 0.119 and use duktape
PATCH v2 1/4 package/polkit: bump version to 0.119 and use duktape
Unfortuantly, as of commit 3e1d61868fa8bfc586099302e931433270e5d17d, polkit requires mozjs >= 78, which means spidermonkey is too old. As such, this patch is larger than usual.
Spidermonkey has a few major issues:
- The source directory after compilation is enormous (2.7G!)
- The shared library is 24MB stripped!
- It requires python2 to build, which is EOLed, and Buildroot is working towards removing. See: https://elinux.org/Buildroot:Python2Packages
Instead of going through the arduous task of updating Spidermonkey, there is a better solution: use duktape.
There has been a pending patch for over a year that incorporates duktape as an optional backend for polkit found here:
https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/35
As Thomas Petazzoni put it:
"As I am subscribed to notifications on this merge request, I have been following the intermittent discussions taking place on this topic. And indeed, discussions have been sparse, and the polkit maintainer reaction has not been very supportive. It even feels like they are trying to find every possible argument or small issue not to merge the duktape integration."
Many people have come out to support using duktape, and many users, including myself, have used polkit with duktape for as long as the above merge request has been around without issues; merging in the above merge request is an acceptable exception to the typical Buildroot package policies.
As Thomas also suggested, I have forked polkit on Github
(https://github.com/aduskett/polkit-duktape), with the above duktape merge request applied, and a release made with the same tag as upstream (0.119).
I refrained from also adding 0001-make-netgroup-support-optional.patch as it is outside of the scope of why the fork exists.
Changes:
- refactor 0001-make-netgroup-support-optional.patch to work with 0.119 and duktape.
- Remove upstream incorporated 0002-jsauthority-memleak.patch
- Remove upstream 0003-polkit-0.116-pkttyagent-sigttou-bg-job.patch
- Remove any trace of spidermonkey from polkit, udisks, and systemd-polkit
- Add duktape as a dependency of polkit
- Change POLKIT_SITE to the above polkit-duktape GitHub repository.
---
Changes v1 -> v2:
- Extend 0001-make-netgroup-support-optional.patch to include duktape support instead of modifying the duktape merge request to make netgroup support optional. (Thomas)
.../0001-make-netgroup-support-optional.patch | 41 +++++++++++++++---- package/polkit/0002-jsauthority-memleak.patch | 28 ------------- ...lkit-0.116-pkttyagent-sigttou-bg-job.patch | 34 --------------- package/polkit/Config.in | 24 ++++------- package/polkit/polkit.hash | 4 +- package/polkit/polkit.mk | 12 +++--- package/systemd/Config.in | 17 +++----- package/udisks/Config.in | 23 ++++------- 8 files changed, 59 insertions(+), 124 deletions(-) delete mode 100644 package/polkit/0002-jsauthority-memleak.patch delete mode 100644 package/polkit/0003-polkit-0.116-pkttyagent-sigttou-bg-job.patch
package/polkit/0001-make-netgroup-support-optional.patch +32 -9
@@ -16,6 +16,7 @@ Fixes bug 50145. Signed-off-by: A. Wilcox <[email protected]> Signed-off-by: Khem Raj <[email protected]> +[Adam: Extend patch to work with duktape integration.] Signed-off-by: Adam Duskett <[email protected]> [Thomas: add introspection.m4.] Signed-off-by: Thomas Petazzoni <[email protected]>
@@ -24,12 +25,13 @@ Signed-off-by: Thomas Petazzoni <[email protected]> configure.ac | 2 +- src/polkit/polkitidentity.c | 16 ++ src/polkit/polkitunixnetgroup.c | 3 + + .../polkitbackendduktapeauthority.c | 2 + .../polkitbackendinteractiveauthority.c | 14 +- - .../polkitbackendjsauthority.cpp | 2 + + .../polkitbackendjsauthority.cpp | 3 +- test/polkit/polkitidentitytest.c | 9 +- test/polkit/polkitunixnetgrouptest.c | 3 + .../test-polkitbackendjsauthority.c | 2 + - 9 files changed, 185 insertions(+), 8 deletions(-) + 10 files changed, 187 insertions(+), 9 deletions(-) create mode 100644 buildutil/introspection.m4 diff --git a/buildutil/introspection.m4 b/buildutil/introspection.m4
@@ -184,7 +186,7 @@ diff --git a/configure.ac b/configure.ac index 5cedb4e..87aa0ad 100644 --- a/configure.ac +++ b/configure.ac -@@ -99,7 +99,7 @@ AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexpat"], +@@ -111,7 +111,7 @@ AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexpat"], [AC_MSG_ERROR([Can't find expat library. Please install expat.])]) AC_SUBST(EXPAT_LIBS)
@@ -249,6 +251,26 @@ index 8a2b369..83f8d4a 100644 g_return_val_if_fail (name != NULL, NULL); return POLKIT_IDENTITY (g_object_new (POLKIT_TYPE_UNIX_NETGROUP, "name", name, +diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c +index 4b4f8fd..e19b009 100644 +--- a/src/polkitbackend/polkitbackendduktapeauthority.c ++++ b/src/polkitbackend/polkitbackendduktapeauthority.c +@@ -1036,6 +1036,7 @@ js_polkit_user_is_in_netgroup (duk_context *cx) + const char *netgroup; + gboolean is_in_netgroup = FALSE; + ++#ifdef HAVE_SETNETGRENT + user = duk_require_string (cx, 0); + netgroup = duk_require_string (cx, 1); + +@@ -1046,6 +1047,7 @@ js_polkit_user_is_in_netgroup (duk_context *cx) + { + is_in_netgroup = TRUE; + } ++#endif + + duk_push_boolean (cx, is_in_netgroup); + return 1; diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c index 056d9a8..36c2f3d 100644 --- a/src/polkitbackend/polkitbackendinteractiveauthority.c
@@ -298,7 +320,7 @@ diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/ index 9b752d1..09b2878 100644 --- a/src/polkitbackend/polkitbackendjsauthority.cpp +++ b/src/polkitbackend/polkitbackendjsauthority.cpp -@@ -1502,6 +1502,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx, +@@ -1520,6 +1520,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx, JS::CallArgs args = JS::CallArgsFromVp (argc, vp);
@@ -306,14 +328,15 @@ index 9b752d1..09b2878 100644 JS::RootedString usrstr (authority->priv->cx); usrstr = args[0].toString(); user = JS_EncodeStringToUTF8 (cx, usrstr); -@@ -1519,6 +1520,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx, - - JS_free (cx, netgroup); - JS_free (cx, user); +@@ -1534,7 +1535,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx, + { + is_in_netgroup = true; + } +- +#endif - ret = true; + args.rval ().setBoolean (is_in_netgroup); diff --git a/test/polkit/polkitidentitytest.c b/test/polkit/polkitidentitytest.c index e91967b..e829aaa 100644 --- a/test/polkit/polkitidentitytest.c
package/polkit/0002-jsauthority-memleak.patch deleted +0 -28
@@ -1,28 +0,0 @@ -From 28e3a6653d8c3777b07e0128a0d97d46e586e311 Mon Sep 17 00:00:00 2001 -From: Jan Rybar <[email protected]> -Date: Tue, 8 Oct 2019 13:28:18 +0000 -Subject: [PATCH] jsauthority: Fix two minor memory leaks - -(cherry picked from commit 28e3a6653d8c3777b07e0128a0d97d46e586e311) -Signed-off-by: Jan Rybar <[email protected]> -Signed-off-by: Adam Duskett <[email protected]> ---- - src/polkitbackend/polkitbackendjsauthority.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp -index 9b752d1..e97b8aa 100644 ---- a/src/polkitbackend/polkitbackendjsauthority.cpp -+++ b/src/polkitbackend/polkitbackendjsauthority.cpp -@@ -567,6 +567,8 @@ polkit_backend_js_authority_finalize (GObject *object) - g_strfreev (authority->priv->rules_dirs); - - delete authority->priv->ac; -+ delete authority->priv->js_global; -+ delete authority->priv->js_polkit; - - JS_DestroyContext (authority->priv->cx); - /* JS_ShutDown (); */ --- -2.24.1 -
package/polkit/0003-polkit-0.116-pkttyagent-sigttou-bg-job.patch deleted +0 -34
@@ -1,34 +0,0 @@ -From 76aae4fce586b400f5fe08df31497db19d624609 Mon Sep 17 00:00:00 2001 -From: Jan Rybar <[email protected]> -Date: Thu, 1 Aug 2019 06:46:10 +0000 -Subject: [PATCH] pkttyagent: process stopped by SIGTTOU if run in background - job - - -(cherry picked from commit 76aae4fce586b400f5fe08df31497db19d624609) -Signed-off-by: Jan Rybar <[email protected]> -Signed-off-by: Adam Duskett <[email protected]> ---- - src/programs/pkttyagent.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/src/programs/pkttyagent.c b/src/programs/pkttyagent.c -index 3c8d502..13879a2 100644 ---- a/src/programs/pkttyagent.c -+++ b/src/programs/pkttyagent.c -@@ -264,6 +264,12 @@ main (int argc, char *argv[]) - - memset (&sa, 0, sizeof (sa)); - sa.sa_handler = &tty_handler; -+/* If tty_handler() resets terminal while pkttyagent is run in background job, -+ the process gets stopped by SIGTTOU. This impacts systemctl, hence it must -+ be blocked for a while and then the process gets killed anyway. -+ */ -+ sigemptyset(&sa.sa_mask); -+ sigaddset(&sa.sa_mask, SIGTTOU); - sigaction (SIGTERM, &sa, &savesigterm); - sigaction (SIGINT, &sa, &savesigint); - sigaction (SIGTSTP, &sa, &savesigtstp); --- -2.24.1 -
package/polkit/Config.in +7 -17
@@ -1,18 +1,14 @@ config BR2_PACKAGE_POLKIT bool "polkit" - depends on BR2_HOST_GCC_AT_LEAST_4_9 # spidermonkey - depends on BR2_INSTALL_LIBSTDCPP # spidermonkey - depends on BR2_PACKAGE_SPIDERMONKEY_ARCH_SUPPORTS # spidermonkey - depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # spidermonkey - depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL # spidermonkey + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_7 # C++17 + depends on BR2_TOOLCHAIN_HAS_THREADS # libglib2, dbus depends on BR2_USE_MMU # libglib2, dbus depends on BR2_USE_WCHAR # libglib2 - depends on !BR2_STATIC_LIBS # spidermonkey - depends on !BR2_TOOLCHAIN_USES_UCLIBC # spidermonkey + depends on !BR2_STATIC_LIBS # duktape select BR2_PACKAGE_DBUS # runtime + select BR2_PACKAGE_DUKTAPE select BR2_PACKAGE_EXPAT select BR2_PACKAGE_LIBGLIB2 - select BR2_PACKAGE_SPIDERMONKEY help PolicyKit is a toolkit for defining and handling authorizations. It is used for allowing unprivileged
@@ -20,13 +16,7 @@ config BR2_PACKAGE_POLKIT http://www.freedesktop.org/wiki/Software/polkit -comment "polkit needs a glibc or musl toolchain with C++, wchar, dynamic library, NPTL, gcc >= 4.9" +comment "polkit needs a toolchain with dynamic library, wchar, threads, gcc >= 7" depends on BR2_USE_MMU - depends on BR2_PACKAGE_SPIDERMONKEY_ARCH_SUPPORTS - depends on BR2_TOOLCHAIN_USES_UCLIBC || \ - !BR2_INSTALL_LIBSTDCPP || \ - BR2_STATIC_LIBS || \ - !BR2_TOOLCHAIN_HAS_THREADS_NPTL || \ - !BR2_HOST_GCC_AT_LEAST_4_9 || \ - !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \ - !BR2_USE_WCHAR + depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_GCC_AT_LEAST_7 || \ + BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS
package/polkit/polkit.hash +2 -2
@@ -1,5 +1,5 @@ # Locally calculated after checking pgp signature -sha256 88170c9e711e8db305a12fdb8234fac5706c61969b94e084d0f117d8ec5d34b1 polkit-0.116.tar.gz +sha256 88d078f1d1f653fd31fe42e46cc3d9b7dd468e70684075e32fe1766dc7ece517 polkit-0.119.tar.gz # Locally calculated -sha256 d2e2aa973e29c75e1b492e67ea7b7da9de2d501d49a934657971fd74f9a0b0a8 COPYING +sha256 d2e2aa973e29c75e1b492e67ea7b7da9de2d501d49a934657971fd74f9a0b0a8 COPYING
package/polkit/polkit.mk +6 -6
@@ -4,8 +4,8 @@ # ################################################################################ -POLKIT_VERSION = 0.116 -POLKIT_SITE = http://www.freedesktop.org/software/polkit/releases +POLKIT_VERSION = 0.119 +POLKIT_SITE = $(call github,aduskett,polkit-duktape,v$(POLKIT_VERSION)) POLKIT_LICENSE = GPL-2.0 POLKIT_LICENSE_FILES = COPYING POLKIT_CPE_ID_VENDOR = polkit_project
@@ -13,11 +13,10 @@ POLKIT_AUTORECONF = YES POLKIT_INSTALL_STAGING = YES POLKIT_DEPENDENCIES = \ - libglib2 host-intltool expat spidermonkey $(TARGET_NLS_DEPENDENCIES) + duktape libglib2 host-intltool expat $(TARGET_NLS_DEPENDENCIES) -# spidermonkey needs C++11 POLKIT_CONF_ENV = \ - CXXFLAGS="$(TARGET_CXXFLAGS) -std=c++11" \ + CXXFLAGS="$(TARGET_CXXFLAGS)" \ LIBS=$(TARGET_NLS_LIBS) POLKIT_CONF_OPTS = \
@@ -25,7 +24,8 @@ POLKIT_CONF_OPTS = \ --disable-man-pages \ --disable-examples \ --disable-libelogind \ - --disable-libsystemd-login + --disable-libsystemd-login \ + --with-duktape ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y) POLKIT_CONF_OPTS += --enable-introspection
package/systemd/Config.in +5 -12
@@ -329,11 +329,8 @@ config BR2_PACKAGE_SYSTEMD_OOMD config BR2_PACKAGE_SYSTEMD_POLKIT bool "enable polkit support" - depends on BR2_HOST_GCC_AT_LEAST_4_9 # polkit - depends on BR2_INSTALL_LIBSTDCPP # polkit - depends on BR2_PACKAGE_SPIDERMONKEY_ARCH_SUPPORTS # polkit - depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # polkit - depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL # polkit + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_7 # polkit -> c++17 + depends on BR2_TOOLCHAIN_HAS_THREADS # polkit depends on BR2_USE_WCHAR # libglib2 select BR2_PACKAGE_POLKIT help
@@ -344,13 +341,9 @@ config BR2_PACKAGE_SYSTEMD_POLKIT http://wiki.freedesktop.org/www/Software/polkit/ -comment "polkit support needs a toolchain with C++, wchar, NPTL, gcc >= 4.9" - depends on BR2_PACKAGE_SPIDERMONKEY_ARCH_SUPPORTS - depends on !BR2_INSTALL_LIBSTDCPP || \ - !BR2_TOOLCHAIN_HAS_THREADS_NPTL || \ - !BR2_HOST_GCC_AT_LEAST_4_9 || \ - !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \ - !BR2_USE_WCHAR +comment "polkit support needs a toolchain with threads, wchar, gcc >= 7" + depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_GCC_AT_LEAST_7 || \ + !BR2_TOOLCHAIN_HAS_THREADS config BR2_PACKAGE_SYSTEMD_PORTABLED bool "enable portable services"
package/udisks/Config.in +7 -16
@@ -1,16 +1,12 @@ config BR2_PACKAGE_UDISKS bool "udisks" depends on BR2_ENABLE_LOCALE # parted - depends on BR2_HOST_GCC_AT_LEAST_4_9 # spidermonkey - depends on BR2_INSTALL_LIBSTDCPP # spidermonkey depends on BR2_PACKAGE_HAS_UDEV - depends on BR2_PACKAGE_SPIDERMONKEY_ARCH_SUPPORTS # spidermonkey - depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # spidermonkey - depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL # polkit + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_7 # polkit -> C++17 + depends on BR2_TOOLCHAIN_HAS_THREADS # polkit depends on BR2_USE_WCHAR # dbus-glib -> glib2 depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libblockdev -> cryptsetup -> json-c - depends on !BR2_TOOLCHAIN_USES_UCLIBC # polkit - depends on !BR2_STATIC_LIBS # spidermonkey + depends on !BR2_STATIC_LIBS # polkit -> duktape select BR2_PACKAGE_DBUS select BR2_PACKAGE_DBUS_GLIB select BR2_PACKAGE_LIBATASMART
@@ -43,14 +39,9 @@ comment "udisks needs udev /dev management" depends on BR2_USE_MMU depends on !BR2_PACKAGE_HAS_UDEV -comment "udisks needs a glibc or musl toolchain with locale, C++, wchar, dynamic library, NPTL, gcc >= 4.9" +comment "udisks needs a toolchain with dynamic library, locale, wchar, threads, gcc >= 7" depends on BR2_USE_MMU - depends on BR2_PACKAGE_SPIDERMONKEY_ARCH_SUPPORTS depends on BR2_TOOLCHAIN_HAS_SYNC_4 - depends on !BR2_ENABLE_LOCALE || BR2_TOOLCHAIN_USES_UCLIBC || \ - !BR2_INSTALL_LIBSTDCPP || \ - BR2_STATIC_LIBS || \ - !BR2_TOOLCHAIN_HAS_THREADS_NPTL || \ - !BR2_HOST_GCC_AT_LEAST_4_9 || \ - !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || \ - !BR2_USE_WCHAR + depends on BR2_STATIC_LIBS || !BR2_ENABLE_LOCALE || \ + !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \ + !BR2_TOOLCHAIN_GCC_AT_LEAST_7
Signature · 6 lines
2.31.1 _______________________________________________ buildroot mailing list [email protected] http://lists.busybox.net/mailman/listinfo/buildroot
PATCH v2 2/4 package/polkit/S50polkit: new file
The Polkit source does not come with non-systemd init script. Add one that is modeled after package/busybox/S01syslogd.
--- package/polkit/S50polkit | 51 ++++++++++++++++++++++++++++++++++++++++ package/polkit/polkit.mk | 5 ++++ 2 files changed, 56 insertions(+) create mode 100755 package/polkit/S50polkit
package/polkit/S50polkit new file +51 -0
@@ -0,0 +1,51 @@ +#!/bin/sh + +DAEMON="polkitd" +DAEMON_PATH="/usr/lib/polkit-1/${DAEMON}" +PIDFILE="/var/run/${DAEMON}.pid" +POLKITD_ARGS="--no-debug" + +# polkitd does not create a pidfile, so pass "-n" in the command line +# and use "-m" to instruct start-stop-daemon to create one. +start() { + printf 'Starting %s: ' "${DAEMON}" + # shellcheck disable=SC2086 # we need the word splitting + start-stop-daemon -bmSqp "$PIDFILE" -x ${DAEMON_PATH} -- ${POLKITD_ARGS} + status=$? + if [ "$status" -eq 0 ]; then + echo "OK" + else + echo "FAIL" + fi + return "$status" +} + +stop() { + printf 'Stopping %s: ' "${DAEMON}" + start-stop-daemon -Kqp "$PIDFILE" + status=$? + if [ "$status" -eq 0 ]; then + rm -f "$PIDFILE" + echo "OK" + else + echo "FAIL" + fi + return "$status" +} + +restart() { + stop + sleep 1 + start +} + +case "$1" in + start|stop|restart|reload) + "$1";; + reload) + # Restart, since there is no true "reload" feature. + restart;; + *) + echo "Usage: $0 {start|stop|restart|reload}" + exit 1 +esac
package/polkit/polkit.mk +5 -0
@@ -57,4 +57,9 @@ define POLKIT_INSTALL_INIT_SYSTEMD endef +define POLKIT_INSTALL_INIT_SYSV + $(INSTALL) -D -m 0755 package/polkit/S50polkit \ + $(TARGET_DIR)/etc/init.d/S50polkit +endef + $(eval $(autotools-package))
Signature · 6 lines
2.31.1 _______________________________________________ buildroot mailing list [email protected] http://lists.busybox.net/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v2 2/4] package/polkit/S50polkit: new file
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Adam" == Adam Duskett <[email protected]> writes:
The Polkit source does not come with non-systemd init script. Add one that is modeled after package/busybox/S01syslogd.
Signed-off-by Adam Duskett <[email protected]>
Committed to 2021.02.x and 2021.05.x, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] http://lists.busybox.net/mailman/listinfo/buildroot
PATCH v2 3/4 support/testing: add polkit tests
In reply to Adam DuskettThis test script tests polkit with and without systemd.
The Systemd test does the following:
- The brtest user attempts to restart the systemd-timesyncd service and is denied.
- A systemd-timesyncd-restart.rules file provided by polkit-rules-test is copied from /root/ to /etc/polkit-1/rules.d
- The brtest user attempts to restart the systemd-timesyncd service and should now succeed.
The initd test does the following:
- The brtest user attempts to run the test application "hello-polkit" with the command "pkexec hello-polkit" and is denied.
- A hello-polkit.rules file provided by polkit-rules-test is copied from /root/ to /etc/polkit-1/rules.d
- The brtest user attempts to re-run the test hello-polkit binary with "pkexec hello-polkit" and succeeds.
--- .../package/br2-external/polkit/Config.in | 1 + .../package/br2-external/polkit/external.desc | 1 + .../package/br2-external/polkit/external.mk | 1 + .../package/polkit-rules-test/Config.in | 6 ++ .../polkit-rules-test/initd/hello-polkit.c | 6 ++ .../initd/hello-polkit.policy | 14 ++++ .../initd/hello-polkit.rules | 6 ++ .../polkit-rules-test/polkit-rules-test.mk | 38 ++++++++++ .../systemd/systemd-timesyncd-restart.rules | 7 ++ support/testing/tests/package/test_polkit.py | 70 +++++++++++++++++++ 10 files changed, 150 insertions(+) create mode 100644 support/testing/tests/package/br2-external/polkit/Config.in create mode 100644 support/testing/tests/package/br2-external/polkit/external.desc create mode 100644 support/testing/tests/package/br2-external/polkit/external.mk create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test/Config.in create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test/initd/hello-polkit.c create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test/initd/hello-polkit.policy create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test/initd/hello-polkit.rules create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test/polkit-rules-test.mk create mode 100644 support/testing/tests/package/br2-external/polkit/package/polkit-rules-test/systemd/systemd-timesyncd-restart.rules create mode 100644 support/testing/tests/package/test_polkit.py
support/testing/tests/package/br2-external/polkit/Config.in new file +1 -0
@@ -0,0 +1 @@ +source "$BR2_EXTERNAL_POLKIT_PATH/package/polkit-rules-test/Config.in"
support/testing/tests/package/br2-external/polkit/external.desc new file +1 -0
@@ -0,0 +1 @@ +name: POLKIT
support/testing/tests/package/br2-external/polkit/external.mk new file +1 -0
@@ -0,0 +1 @@ +include $(sort $(wildcard $(BR2_EXTERNAL_POLKIT_PATH)/package/*/*.mk))
support/testing/tests/package/br2-external/polkit/package/polkit-rules-test/Config.in new file +6 -0
@@ -0,0 +1,6 @@ +config BR2_PACKAGE_POLKIT_RULES_TEST + bool "polkit rules test" + depends on BR2_PACKAGE_POLKIT + help + Simple test to ensure polkit is loading and enforcing rules + correctly.
support/testing/tests/package/br2-external/polkit/package/polkit-rules-test/initd/hello-polkit.c new file +6 -0
@@ -0,0 +1,6 @@ +#include <stdio.h> + +int main (void ){ +printf ("Hello polkit!\n" ); +return 0 ; +}
support/testing/tests/package/br2-external/polkit/package/polkit-rules-test/initd/hello-polkit.policy new file +14 -0
@@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE policyconfig PUBLIC + "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" + "http://www.freedesktop.org/software/polkit/policyconfig-1.dtd"> +<policyconfig> + <action id="org.freedesktop.policykit.pkexec.hello-polkit"> + <message>Authentication is required to run the hello world test program</message> + <defaults> + <allow_inactive>no</allow_inactive> + <allow_active>no</allow_active> + </defaults> + <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/hello-polkit</annotate> + </action> +</policyconfig>
support/testing/tests/package/br2-external/polkit/package/polkit-rules-test/initd/hello-polkit.rules new file +6 -0
@@ -0,0 +1,6 @@ +polkit.addRule(function(action, subject) { + if (action.id == "org.freedesktop.policykit.pkexec.hello-polkit" && + subject.user == "brtest") { + return polkit.Result.YES; + } +});
support/testing/tests/package/br2-external/polkit/package/polkit-rules-test/polkit-rules-test.mk new file +38 -0
@@ -0,0 +1,38 @@ +################################################################################ +# +# polkit-rules-test +# +################################################################################ + +POLKIT_RULES_TEST_DEPENDENCIES = polkit + +define POLKIT_RULES_TEST_USERS + brtest -1 brtest -1 =password /home/brtest /bin/sh brtest +endef + +define POLKIT_RULES_TEST_BUILD_CMDS + $(INSTALL) -D $(POLKIT_RULES_TEST_PKGDIR)/initd/hello-polkit.c $(@D)/hello-polkit.c + $(TARGET_CC) $(@D)/hello-polkit.c -o $(@D)/hello-polkit +endef + +# Install the rules file to /root. Test_polkit.py first tests that restarting +# timesyncd as a user fails, then moves the rules file and confirmes restarting +# timesyncd as a user succeeds. +define POLKIT_RULES_TEST_INSTALL_INIT_SYSTEMD + mkdir -p $(TARGET_DIR)/etc/polkit-1/rules.d + $(INSTALL) -D $(POLKIT_RULES_TEST_PKGDIR)/systemd/systemd-timesyncd-restart.rules \ + $(TARGET_DIR)/root/systemd-timesyncd-restart.rules +endef + +define POLKIT_RULES_TEST_INSTALL_INIT_SYSV + mkdir -p $(TARGET_DIR)/usr/share/polkit-1/actions/ + $(INSTALL) -D $(@D)/hello-polkit $(TARGET_DIR)/usr/bin/hello-polkit + + $(INSTALL) -D $(POLKIT_RULES_TEST_PKGDIR)/initd/hello-polkit.policy \ + $(TARGET_DIR)/usr/share/polkit-1/actions/hello-polkit.policy + + $(INSTALL) -D $(POLKIT_RULES_TEST_PKGDIR)/initd/hello-polkit.rules \ + $(TARGET_DIR)/root/hello-polkit.rules +endef + +$(eval $(generic-package))
support/testing/tests/package/br2-external/polkit/package/polkit-rules-test/systemd/systemd-timesyncd-restart.rules new file +7 -0
@@ -0,0 +1,7 @@ +polkit.addRule(function(action, subject) { + if (action.id == "org.freedesktop.systemd1.manage-units" && + action.lookup("unit") == "systemd-timesyncd.service" && + subject.user == "brtest") { + return polkit.Result.YES; + } +});
support/testing/tests/package/test_polkit.py new file +70 -0
70 lines not on this page · raw message
Signature · 6 lines
2.31.1 _______________________________________________ buildroot mailing list [email protected] http://lists.busybox.net/mailman/listinfo/buildroot
PATCH v2 4/4 package/spidermonkey: drop package
In reply to Adam DuskettNow that Spidermonkey is no longer required to build the polkit package, and no other packages require Spidermonkey, and python2 is required to build the package, it is safe to drop the package.
--- Config.in.legacy | 9 ++ package/Config.in | 1 - .../0001-allow-newer-autoconf-versions.patch | 61 -------- .../0002-allow-building-in-tree.patch | 47 ------ ...-allow-unknown-configuration-options.patch | 35 ----- .../0004-fix-building-with-musl.patch | 133 ---------------- .../spidermonkey/0005-add-riscv-support.patch | 121 --------------- ...ers-on-install-instead-of-symlinking.patch | 34 ----- ...ng-on-64-bit-and-32-bit-be-platforms.patch | 144 ------------------ ...-on-ARM64-for-generated-unboxed-obje.patch | 66 -------- ...-clobbering-it-in-the-regex-compiler.patch | 100 ------------ ...lent-year-to-determine-the-time-zone.patch | 103 ------------- ....in-install-shell-only-if-it-s-built.patch | 28 ---- package/spidermonkey/Config.in | 60 -------- package/spidermonkey/spidermonkey.hash | 3 - package/spidermonkey/spidermonkey.mk | 64 -------- 16 files changed, 9 insertions(+), 1000 deletions(-) delete mode 100644 package/spidermonkey/0001-allow-newer-autoconf-versions.patch delete mode 100644 package/spidermonkey/0002-allow-building-in-tree.patch delete mode 100644 package/spidermonkey/0003-allow-unknown-configuration-options.patch delete mode 100644 package/spidermonkey/0004-fix-building-with-musl.patch delete mode 100644 package/spidermonkey/0005-add-riscv-support.patch delete mode 100644 package/spidermonkey/0006-copy-headers-on-install-instead-of-symlinking.patch delete mode 100644 package/spidermonkey/0007-ensure-proper-running-on-64-bit-and-32-bit-be-platforms.patch delete mode 100644 package/spidermonkey/0008-save-and-restore-non-volatile-x28-on-ARM64-for-generated-unboxed-obje.patch delete mode 100644 package/spidermonkey/0009-save-x28-before-clobbering-it-in-the-regex-compiler.patch delete mode 100644 package/spidermonkey/0010-always-use-the-equivalent-year-to-determine-the-time-zone.patch delete mode 100644 package/spidermonkey/0011-js-src-Makefile.in-install-shell-only-if-it-s-built.patch delete mode 100644 package/spidermonkey/Config.in delete mode 100644 package/spidermonkey/spidermonkey.hash delete mode 100644 package/spidermonkey/spidermonkey.mk
Config.in.legacy +9 -0
@@ -154,6 +154,15 @@ config BR2_PACKAGE_KODI_LIBVA the kodi-specific dependencies limiting libva support to non- OPENGLES platforms were removed including this option. +config BR2_PACKAGE_SPIDERMONKEY + bool "The spidermonkey package has been removed" + select BR2_LEGACY + help + The spidermonkey package was removed. The only package that + depended on spidermonkey was polkit. The spidermonkey + dependency is replaced with duktape, which saves 24~MB of + space on the target and 2.7G~ on the host. + config BR2_PACKAGE_PHP_EXT_XMLRPC bool "PHP XMLRPC extension removed" select BR2_LEGACY
package/Config.in +0 -1
@@ -1638,7 +1638,6 @@ endif source "package/jszip/Config.in" source "package/openlayers/Config.in" source "package/popperjs/Config.in" - source "package/spidermonkey/Config.in" source "package/vuejs/Config.in" endmenu
package/spidermonkey/0001-allow-newer-autoconf-versions.patch deleted +0 -61
61 lines not on this page · raw message
package/spidermonkey/0002-allow-building-in-tree.patch deleted +0 -47
47 lines not on this page · raw message
package/spidermonkey/0003-allow-unknown-configuration-options.patch deleted +0 -35
@@ -1,35 +0,0 @@ -From 4a06a1a6a71293decb83aee7adb74bc709493106 Mon Sep 17 00:00:00 2001 -From: Philip Chimento <[email protected]> -Date: Wed, 5 Jul 2017 22:57:09 -0700 -Subject: [PATCH] allow unknown configuration options - -By default, if an unknown parameter is passed to configure, an error is raised. -Replace the raise with a pass and continue. - -Fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1379540 - -Signed-off-by: Philip Chimento <[email protected]> -Signed-off-by: Adam Duskett <[email protected]> ---- - js/src/configure | 9 +++++++++ - python/mozbuild/mozbuild/configure/__init__.py | 2 +- - python/mozbuild/mozbuild/configure/options.py | 6 +++++- - 3 files changed, 15 insertions(+), 2 deletions(-) - create mode 100755 js/src/configure - -diff --git a/python/mozbuild/mozbuild/configure/__init__.py b/python/mozbuild/mozbuild/configure/__init__.py -index 0fe640ca..09b460d3 100644 ---- a/python/mozbuild/mozbuild/configure/__init__.py -+++ b/python/mozbuild/mozbuild/configure/__init__.py -@@ -421,7 +421,7 @@ def run(self, path=None): - # All options should have been removed (handled) by now. - for arg in self._helper: - without_value = arg.split('=', 1)[0] -- raise InvalidOptionError('Unknown option: %s' % without_value) -+ pass - - # Run the execution queue - for func, args in self._execution_queue: --- -2.23.0 -
package/spidermonkey/0004-fix-building-with-musl.patch deleted +0 -133
133 lines not on this page · raw message
package/spidermonkey/0005-add-riscv-support.patch deleted +0 -121
121 lines not on this page · raw message
package/spidermonkey/0006-copy-headers-on-install-instead-of-symlinking.patch deleted +0 -34
@@ -1,34 +0,0 @@ -From 903a79a1efff18fc7cc50db09a3fe5d768adc9a8 Mon 19 Mar 2018 09:58:06 +0100 -From: Rico Tzschichholz <[email protected]> -Date: Wed, 5 Jul 2017 22:45:59 -0700 -Subject: build: Copy headers on install instead of symlinking - -Patch ported from mozjs52 by Philip Chimento - -Signed-off-by: Rico Tzschichholz <[email protected]> -Signed-off-by: Adam Duskett <[email protected]> ---- - python/mozbuild/mozbuild/backend/recursivemake.py | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py -index dd9020d..6918ef8 100644 ---- a/python/mozbuild/mozbuild/backend/recursivemake.py -+++ b/python/mozbuild/mozbuild/backend/recursivemake.py -@@ -1427,11 +1427,11 @@ class RecursiveMakeBackend(CommonBackend): - raise Exception("Wildcards are only supported in the filename part of " - "srcdir-relative or absolute paths.") - -- install_manifest.add_pattern_link(basepath, wild, path) -+ install_manifest.add_pattern_copy(basepath, wild, path) - else: -- install_manifest.add_pattern_link(f.srcdir, f, path) -+ install_manifest.add_pattern_copy(f.srcdir, f, path) - else: -- install_manifest.add_link(f.full_path, dest) -+ install_manifest.add_copy(f.full_path, dest) - else: - install_manifest.add_optional_exists(dest) - backend_file.write('%s_FILES += %s\n' % ( --- -2.23.0
package/spidermonkey/0007-ensure-proper-running-on-64-bit-and-32-bit-be-platforms.patch deleted +0 -144
144 lines not on this page · raw message
package/spidermonkey/0008-save-and-restore-non-volatile-x28-on-ARM64-for-generated-unboxed-obje.patch deleted +0 -66
66 lines not on this page · raw message
package/spidermonkey/0009-save-x28-before-clobbering-it-in-the-regex-compiler.patch deleted +0 -100
100 lines not on this page · raw message
package/spidermonkey/0010-always-use-the-equivalent-year-to-determine-the-time-zone.patch deleted +0 -103
103 lines not on this page · raw message
package/spidermonkey/0011-js-src-Makefile.in-install-shell-only-if-it-s-built.patch deleted +0 -28
@@ -1,28 +0,0 @@ -From b5e4a9926cf50d12e9c5c05c6d1b161e5b662d62 Mon Sep 17 00:00:00 2001 -From: Carlos Santos <[email protected]> -Date: Sat, 7 Mar 2020 23:42:02 -0300 -Subject: [PATCH] js/src/Makefile.in: install shell only if it's built - -Prevents an installation error if we configure with --disable-js-shell. - -Signed-off-by: Carlos Santos <[email protected]> ---- - js/src/Makefile.in | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/js/src/Makefile.in b/js/src/Makefile.in -index 4ac9f48..9c8fb64 100644 ---- a/js/src/Makefile.in -+++ b/js/src/Makefile.in -@@ -136,7 +136,7 @@ endif - - install:: - $(MAKE) -C build install -- $(MAKE) -C shell install -+ if [ -d shell ]; then $(MAKE) -C shell install; fi - - ifdef HAVE_DTRACE - javascript-trace.h: $(srcdir)/devtools/javascript-trace.d --- -2.18.2 -
package/spidermonkey/Config.in deleted +0 -60
60 lines not on this page · raw message
package/spidermonkey/spidermonkey.hash deleted +0 -3
@@ -1,3 +0,0 @@ -# Locally computed -sha256 f51039c997415fd0f13f8e01966b4a8ff80cbf90deb8b14c18827104a369cc0d mozjs-60.5.2.tar.bz2 -sha256 aaac93a33bec26d5d1a9c5efc1e7dc6bd215d8a4f1e1a7fc5315a67adfd51338 moz.configure
package/spidermonkey/spidermonkey.mk deleted +0 -64
64 lines not on this page · raw message
Signature · 7 lines
2.31.1 _______________________________________________ buildroot mailing list [email protected] http://lists.busybox.net/mailman/listinfo/buildroot
Quoted 45 lines · On Wed, 21 Jul 2021 14:45:15 -0700 Adam Duskett <[email protected]> wrote:
Unfortuantly, as of commit
3e1d61868fa8bfc586099302e931433270e5d17d, polkit requires mozjs >= 78, which means spidermonkey is too old. As such, this patch is larger than usual.Spidermonkey has a few major issues:
- The source directory after compilation is enormous (2.7G!)
- The shared library is 24MB stripped!
- It requires python2 to build, which is EOLed, and Buildroot is working towards removing. See: https://elinux.org/Buildroot:Python2PackagesInstead of going through the arduous task of updating Spidermonkey, there is a better solution: use duktape.
There has been a pending patch for over a year that incorporates duktape as an optional backend for polkit found here:
https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/35As Thomas Petazzoni put it:
"As I am subscribed to notifications on this merge request, I have been following the intermittent discussions taking place on this topic. And indeed, discussions have been sparse, and the polkit maintainer reaction has not been very supportive. It even feels like they are trying to find every possible argument or small issue not to merge the duktape integration."Many people have come out to support using duktape, and many users, including myself, have used polkit with duktape for as long as the above merge request has been around without issues; merging in the above merge request is an acceptable exception to the typical Buildroot package policies.
As Thomas also suggested, I have forked polkit on Github
(https://github.com/aduskett/polkit-duktape), with the above duktape merge request applied, and a release made with the same tag as upstream (0.119).I refrained from also adding 0001-make-netgroup-support-optional.patch as it is outside of the scope of why the fork exists.
Changes:
- refactor 0001-make-netgroup-support-optional.patch to work with 0.119 and duktape.
- Remove upstream incorporated 0002-jsauthority-memleak.patch
- Remove upstream 0003-polkit-0.116-pkttyagent-sigttou-bg-job.patch
- Remove any trace of spidermonkey from polkit, udisks, and systemd-polkit
- Add duktape as a dependency of polkit
- ChangePOLKIT_SITEto the above polkit-duktape GitHub repository.
Quoted 1 line
Signed-off-by Adam Duskett <[email protected]>
Thanks a lot for this new iteration, I have applied the entire series to master. Thanks for this work, it's really great to have that in Buildroot now.
Thomas
Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list [email protected] http://lists.busybox.net/mailman/listinfo/buildroot