summaryrefslogtreecommitdiff
path: root/gnu/packages/polkit.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/polkit.scm')
-rw-r--r--gnu/packages/polkit.scm202
1 files changed, 105 insertions, 97 deletions
diff --git a/gnu/packages/polkit.scm b/gnu/packages/polkit.scm
index a5c1b0dc98..6fe7824a57 100644
--- a/gnu/packages/polkit.scm
+++ b/gnu/packages/polkit.scm
@@ -8,9 +8,9 @@
;;; Copyright © 2018 Tobias Geerinckx-Rice <[email protected]>
;;; Copyright © 2018 Ricardo Wurmus <[email protected]>
;;; Copyright © 2021 Morgan Smith <[email protected]>
-;;; Copyright © 2021 Maxim Cournoyer <[email protected]>
;;; Copyright © 2022 Jean-Pierre De Jesus DIAZ <[email protected]>
;;; Copyright © 2022 Marius Bakke <[email protected]>
+;;; Copyright © 2021, 2022 Maxim Cournoyer <[email protected]>
;;;
;;; 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,92 +40,130 @@
#: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)
#:use-module (gnu packages docbook)
- #:use-module (gnu packages gnuzilla)
#:use-module (gnu packages javascript)
#:use-module (gnu packages linux)
#: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))
+ #:use-module (gnu packages xml))
-(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"))
- (patches (search-patches "polkit-disable-systemd.patch"))
- (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'\\)")
- ""))
- ;; Look up actions and rules from /etc/polkit ...
- (substitute* "src/polkitbackend/meson.build"
- (("'-DPACKAGE_SYSCONF_DIR=.*,")
- "'-DPACKAGE_SYSCONF_DIR=\"/etc\"',"))
- (substitute* "src/polkitbackend/polkitbackendinteractiveauthority.c"
- (("PACKAGE_DATA_DIR \"/polkit-1/actions\"")
- "PACKAGE_SYSCONF_DIR \"/polkit-1/actions\""))
- ;; ... but install package files below the prefix.
- (substitute* "meson.build"
- (("pk_sysconfdir = get_option\\('sysconfdir'\\)")
- "pk_sysconfdir = get_option('prefix') + '/etc'"))
- ;; 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"))
+ (patches (search-patches "polkit-disable-systemd.patch"))
+ (sha256
+ (base32
+ "1apz3bh7nbpmlp1cr00pb8z8wp0c7yb23ninb959jz3r38saxiwx"))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ ;; 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.
+ ;; Look up actions and rules from /etc/polkit ...
+ (substitute* "src/polkitbackend/meson.build"
+ (("'-DPACKAGE_SYSCONF_DIR=.*,")
+ "'-DPACKAGE_SYSCONF_DIR=\"/etc\"',"))
+ (substitute* "src/polkitbackend/polkitbackendinteractiveauthority.c"
+ (("PACKAGE_DATA_DIR \"/polkit-1/actions\"")
+ "PACKAGE_SYSCONF_DIR \"/polkit-1/actions\""))
+ ;; ... but install package files below the prefix.
+ (substitute* "meson.build"
+ (("pk_sysconfdir = get_option\\('sysconfdir'\\)")
+ "pk_sysconfdir = get_option('prefix') + '/etc'"))
+ ;; 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\""))))))
(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"
+ "-Dsession_tracking=libelogind"
+ "-Dman=true"
+ "-Dtests=true"
+ ;; Work around cross-compilation failure. 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")
+ '()))
+ #:phases
+ #~(modify-phases %standard-phases
+ (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
+ (list gettext-minimal
`(,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
- #~'("--sysconfdir=/etc"
- "-Dsession_tracking=libelogind"
- "-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
@@ -135,36 +173,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")