mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
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.
This commit is contained in:
parent
39fe13ee26
commit
e8f4e18085
2 changed files with 88 additions and 96 deletions
|
@ -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 download)
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (guix memoization)
|
||||
#:use-module ((guix licenses) #:select (lgpl2.0+))
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (guix download)
|
||||
#:use-module (guix memoization)
|
||||
#:use-module (guix utils)
|
||||
#:use-module (guix build utils)
|
||||
#:use-module (guix build-system cmake)
|
||||
|
@ -40,6 +40,7 @@ (define-module (gnu packages polkit)
|
|||
#: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 @@ (define-module (gnu packages polkit)
|
|||
#: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 @@ (define-public polkit-mozjs
|
|||
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")
|
||||
|
|
|
@ -317,19 +317,10 @@ (define-record-type* <polkit-configuration>
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue