guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

09/19: gnu: polkit-mozjs: Rename to polkit and remove obsolete polkit-du


From: guix-commits
Subject: 09/19: gnu: polkit-mozjs: Rename to polkit and remove obsolete polkit-duktape.
Date: Sun, 28 Aug 2022 21:09:44 -0400 (EDT)

apteryx pushed a commit to branch core-updates
in repository guix.

commit e8f4e1808563eb3c1cd28d419a1f349412af4a0d
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Sun Aug 21 20:40:39 2022 -0400

    gnu: polkit-mozjs: Rename to polkit and remove obsolete polkit-duktape.
    
    Polkit 121 now uses duktape as the default JavaScript engine.
    
    * gnu/packages/polkit.scm (polkit-mozjs): Rename to...
    (polkit): ... this.
    [import-modules, modules]: New arguments.
    [configure-flags]: Drop non-default "js_engine=mozjs" option.
    [phases]{adjust-install-time-etc-directory, patch-bash}: New phases.
    {check}: New override.
    [inputs]: Replace mozjs-91 with duktape.
    [native-inputs]: Add python, python-dbusmock and tini.
    (polkit-duktape): Delete variable.
    (polkit-for-system): Delete procedure.
    (polkit) Delete syntax.
    * gnu/services/dbus.scm (%default-polkit): Delete variable.
    (<polkit-configuration>): Adjust accordingly.
---
 gnu/packages/polkit.scm | 173 ++++++++++++++++++++++++------------------------
 gnu/services/dbus.scm   |  11 +--
 2 files changed, 88 insertions(+), 96 deletions(-)

diff --git a/gnu/packages/polkit.scm b/gnu/packages/polkit.scm
index 18d299bbd1..5ef84ca730 100644
--- a/gnu/packages/polkit.scm
+++ b/gnu/packages/polkit.scm
@@ -8,9 +8,9 @@
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2021 Morgan Smith <Morgan.J.Smith@outlook.com>
-;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2022 Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
 ;;; Copyright © 2022 Marius Bakke <marius@gnu.org>
+;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -28,11 +28,11 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages polkit)
-  #:use-module ((guix licenses) #:select (lgpl2.0+))
-  #:use-module (guix packages)
-  #:use-module (guix gexp)
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix memoization)
+  #:use-module ((guix licenses) #:select (lgpl2.0+))
+  #:use-module (guix packages)
   #:use-module (guix utils)
   #:use-module (guix build utils)
   #:use-module (guix build-system cmake)
@@ -40,6 +40,7 @@
   #:use-module (guix build-system meson)
   #:use-module (gnu packages)
   #:use-module (gnu packages gettext)
+  #:use-module (gnu packages docker)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gtk)
@@ -50,73 +51,103 @@
   #:use-module (gnu packages nss)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages xml)
   #:export (polkit))
 
-(define-public polkit-mozjs
+(define-public polkit
   (package
     (name "polkit")
     (version "121")
     (source (origin
-             (method url-fetch)
-             (uri (string-append
-                   "https://www.freedesktop.org/software/polkit/releases/";
-                   name "-" version ".tar.gz"))
-             (sha256
-              (base32
-               "1apz3bh7nbpmlp1cr00pb8z8wp0c7yb23ninb959jz3r38saxiwx"))
-             (modules '((guix build utils)))
-             (snippet
-              '(begin
-                 ;; Disable a test that requires Python, D-Bus and a few
-                 ;; libraries and fails with "ERROR: timed out waiting for bus
-                 ;; process to terminate".
-                 (substitute* "test/meson.build"
-                   (("subdir\\('polkitbackend'\\)")
-                    ""))
-                 ;; Guix System's polkit
-                 ;; service stores actions under /etc/polkit-1/actions.
-                 (substitute* 
"src/polkitbackend/polkitbackendinteractiveauthority.c"
-                   (("PACKAGE_DATA_DIR \"/polkit-1/actions\"")
-                    "PACKAGE_SYSCONF_DIR \"/polkit-1/actions\""))
-                 ;; Set the setuid helper's real location.
-                 (substitute* "src/polkitagent/polkitagentsession.c"
-                   (("PACKAGE_PREFIX \"/lib/polkit-1/polkit-agent-helper-1\"")
-                    "\"/run/setuid-programs/polkit-agent-helper-1\""))))))
+              (method url-fetch)
+              (uri (string-append
+                    "https://www.freedesktop.org/software/polkit/releases/";
+                    name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "1apz3bh7nbpmlp1cr00pb8z8wp0c7yb23ninb959jz3r38saxiwx"))))
     (build-system meson-build-system)
+    (arguments
+     (list
+      #:imported-modules `(,@%meson-build-system-modules
+                           (guix build syscalls))
+      #:modules '((guix build meson-build-system)
+                  (guix build syscalls)
+                  (guix build utils)
+                  (ice-9 match))
+      #:configure-flags
+      #~(list "--sysconfdir=/etc"
+              "-Dman=true"
+              "-Dtests=true"
+              ;; ERROR: Pkg-config binary for machine
+              ;; MachineChoice.BUILD not found, giving up.  Just
+              ;; disable introspection for now.
+              #$@(if (%current-target-system)
+                     '("-Dos-type=unknown")
+                     '()))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'adjust-install-time-etc-directory
+            ;; This is so that the default example rules files can be
+            ;; installed along the package; otherwise it would fail attempting
+            ;; to write to /etc.  Unlike with GNU Autotools, Meson can't
+            ;; override the pkgsysconfdir value at install time; instead, we
+            ;; rewrite the pkgsysconfdir references in the build system to
+            ;; point to #$output/etc.
+            (lambda _
+              (substitute* "meson.build"
+                (("pk_sysconfdir = get_option\\('sysconfdir')")
+                 (format #f "pk_sysconfdir = '~a'"
+                         (string-append #$output "/etc"))))))
+          (add-before 'check 'patch-bash
+            (lambda _
+              (substitute* (list "subprojects/mocklibc-1.0/bin/mocklibc"
+                                 (string-append "../polkit-v." #$version
+                                                "/test/data/etc/passwd")
+                                 (string-append "../polkit-v." #$version
+                                                "/test/data/etc/polkit-1"
+                                                "/rules.d/10-testing.rules"))
+                (("/bin/(bash|false|true)" _ command)
+                 (which command)))))
+          (replace 'check
+            (lambda* (#:key tests? test-options #:allow-other-keys)
+              (when tests?
+                ;; Run the test suite through tini to ensure signals are
+                ;; properly handled and zombie processes reaped.
+                (match (primitive-fork)
+                  (0                    ;child process
+                   (set-child-subreaper!)
+                   ;; Use tini so that signals are properly handled and
+                   ;; doubly-forked processes get reaped; otherwise,
+                   ;; python-dbusmock would waste time polling for the dbus
+                   ;; processes it spawns to be reaped, in vain.
+                   (apply execlp "tini" "--"
+                          "meson" "--" "test" "-t" "0" "--print-errorlogs"
+                          test-options))
+                  (pid
+                   (match (waitpid pid)
+                     ((_ . status)
+                      (unless (zero? status)
+                        (error "`meson test' exited with status"
+                               status))))))))))))
     (inputs
-     (list elogind
-           expat
-           linux-pam
-           mozjs-91
-           nspr))
+     (list duktape expat elogind linux-pam nspr))
     (propagated-inputs
      (list glib))                       ;required by polkit-gobject-1.pc
     (native-inputs
-     (list pkg-config
-           gettext-minimal
-           perl
-           `(,glib "bin")               ;for glib-mkenums
+     (list `(,glib "bin")               ;for glib-mkenums
+           docbook-xsl                  ;for man page generation
            gobject-introspection
-           libxml2                      ;for man page generation
+           libxml2                      ;for XML_CATALOG_FILES
            libxslt                      ;for man page generation
-           docbook-xsl))                ;for man page generation
-    (arguments
-     (list #:configure-flags
-           #~'("-Dman=true"
-               "-Dtests=true"
-               "-Djs_engine=mozjs"
-               ;; Work around broken gobject-introspection detection when
-               ;; cross-compiling.  The build system probes for the _target_
-               ;; gobject-introspection, but if we change it to native, Meson
-               ;; fails with:
-               ;; ERROR: Pkg-config binary for machine MachineChoice.BUILD
-               ;; not found, giving up.
-               ;; Just disable introspection for now.
-               #$@(if (%current-target-system)
-                      '("-Dintrospection=false")
-                      '()))))
+           perl
+           pkg-config
+           python
+           python-dbusmock
+           tini))
     (home-page "https://www.freedesktop.org/wiki/Software/polkit/";)
     (synopsis "Authorization API for privilege management")
     (description "Polkit is an application-level toolkit for defining and
@@ -126,36 +157,6 @@ making process with respect to granting access to 
privileged operations
 for unprivileged applications.")
     (license lgpl2.0+)))
 
-;;; Variant of polkit built with Duktape, a lighter JavaScript engine compared
-;;; to mozjs.
-(define-public polkit-duktape
-  (let ((base polkit-mozjs))
-    (package/inherit base
-      (name "polkit-duktape")
-      (arguments
-       (substitute-keyword-arguments (package-arguments base)
-         ((#:configure-flags flags)
-          #~(delete "-Djs_engine=mozjs" #$flags))))
-      (inputs
-       (modify-inputs (package-inputs base)
-         (replace "mozjs" duktape))))))
-
-(define polkit-for-system
-  (mlambda (system)
-    "Return a polkit package that can be built for SYSTEM; that is, either the
-regular polkit that requires mozjs or its duktape variant."
-    (if (string-prefix? "x86_64" system)
-        polkit-mozjs
-        polkit-duktape)))
-
-;;; Define a top level polkit variable that can be built on any of the
-;;; supported platforms.  This is to work around the fact that our
-;;; mrustc-bootstrapped rust toolchain currently only supports the x86_64
-;;; architecture.
-(define-syntax polkit
-  (identifier-syntax (polkit-for-system
-                      (or (%current-target-system) (%current-system)))))
-
 (define-public polkit-qt
   (package
     (name "polkit-qt")
diff --git a/gnu/services/dbus.scm b/gnu/services/dbus.scm
index 52cb1e3a51..e4c719fe71 100644
--- a/gnu/services/dbus.scm
+++ b/gnu/services/dbus.scm
@@ -317,19 +317,10 @@ tuples, are all set as environment variables when the bus 
daemon launches it."
   polkit-configuration make-polkit-configuration
   polkit-configuration?
   (polkit   polkit-configuration-polkit           ;file-like
-            (default %default-polkit))
+            (default polkit))
   (actions  polkit-configuration-actions          ;list of file-like
             (default '())))
 
-(define %default-polkit
-  ;; The default polkit package.
-  (let-system (system target)
-    ;; Since mozjs depends on Rust, which is currently x86_64-only, use
-    ;; polkit-duktape on other systems.
-    (if (string-prefix? "x86_64-" (or target system))
-        polkit-mozjs
-        polkit-duktape)))
-
 (define %polkit-accounts
   (list (user-group (name "polkitd") (system? #t))
         (user-account



reply via email to

[Prev in Thread] Current Thread [Next in Thread]