Subject: [bug#46995] [PATCH staging] gnu: polkit: Update to 0.118.

From: [email-masked]
Date: Sun, 7 Mar 2021 16:23:51 -0500

From: Morgan Smith <[email-masked]>

* gnu/packages/polkit.scm (polkit): Update to 0.118.
[origin]: Update url and remove libsystemd-login substitution
[inputs]: Update mozjs-60 to mozjs-78
[native-inputs]: Add libxslt and docbook-xsl for manpage generation
[arguments]: Add phase to fix manpage generation
---

I think this belongs in the staging branch. I'm really not sure.

Also I'm not sure how to test packages that go in a system configuration
without risking my system, so I didn't test this at all.

The only reason I decided to package this was because the previous package
didn't have man pages.

The libsystemd-login substitution was removed because the configure script
seems to have good automatic detection.

---
 gnu/packages/polkit.scm | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/polkit.scm b/gnu/packages/polkit.scm
index d868aceec2..1a705712a9 100644
--- a/gnu/packages/polkit.scm
+++ b/gnu/packages/polkit.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2017 Huang Ying <[email-masked]>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2018 Ricardo Wurmus <[email-masked]>
+;;; Copyright © 2021 Morgan Smith <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -32,6 +33,7 @@ (define-module (gnu packages polkit)
   #: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 linux)
   #:use-module (gnu packages nss)
@@ -43,15 +45,15 @@ (define-module (gnu packages polkit)
 (define-public polkit
   (package
     (name "polkit")
-    (version "0.116")
+    (version "0.118")
     (source (origin
              (method url-fetch)
              (uri (string-append
-                   "https://www.freedesktop.org/software/polkit/releases/"
+                   "https://gitlab.freedesktop.org/polkit/polkit/releases/"
                    name "-" version ".tar.gz"))
              (sha256
               (base32
-               "1c9lbpndh5zis22f154vjrhnqw65z8s85nrgl42v738yf6g0q5w8"))
+               "0swmg37jsxsxfsd2b3qm0l3zxr9ldvhpjw8lsgq3j8q7wy2fjm3d"))
              (modules '((guix build utils)))
              (snippet
               '(begin
@@ -60,18 +62,6 @@ (define-public polkit
                  (substitute* "test/Makefile.in"
                    (("SUBDIRS = mocklibc . polkit polkitbackend")
                     "SUBDIRS = mocklibc . polkit"))
-                 (substitute* "configure"
-                   ;; Replace libsystemd-login with libelogind.
-                   (("libsystemd-login") "libelogind")
-                   ;; Skip the sanity check that the current system runs
-                   ;; systemd.
-                   (("test ! -d /sys/fs/cgroup/systemd/") "false"))
-                 (substitute* "src/polkit/polkitunixsession-systemd.c"
-                   (("systemd") "elogind"))
-                 (substitute* "src/polkitbackend/polkitbackendsessionmonitor-systemd.c"
-                   (("systemd") "elogind"))
-                 (substitute* "src/polkitbackend/polkitbackendjsauthority.cpp"
-                   (("systemd") "elogind"))
 
                  ;; Guix System's polkit service stores actions under
                  ;; /etc/polkit-1/actions.
@@ -89,7 +79,7 @@ (define-public polkit
      `(("expat" ,expat)
        ("linux-pam" ,linux-pam)
        ("elogind" ,elogind)
-       ("mozjs" ,mozjs-60)
+       ("mozjs" ,mozjs-78)
        ("nspr" ,nspr)))
     (propagated-inputs
      `(("glib" ,glib))) ; required by polkit-gobject-1.pc
@@ -97,7 +87,9 @@ (define-public polkit
      `(("pkg-config" ,pkg-config)
        ("glib:bin" ,glib "bin") ; for glib-mkenums
        ("intltool" ,intltool)
-       ("gobject-introspection" ,gobject-introspection)))
+       ("gobject-introspection" ,gobject-introspection)
+       ("libxslt" ,libxslt) ; for man page generation
+       ("docbook-xsl" ,docbook-xsl))) ; for man page generation
     (arguments
      `(#:configure-flags '("--sysconfdir=/etc"
                            "--enable-man-pages")
@@ -113,6 +105,15 @@ (define-public polkit
                 (("@INTROSPECTION_TYPELIBDIR@")
                  (string-append out "/lib/girepository-1.0/")))
               #t)))
+         (add-after 'unpack 'fix-manpage-generation
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((xsldoc (string-append (assoc-ref inputs "docbook-xsl")
+                                          "/xml/xsl/docbook-xsl-"
+                                          ,(package-version docbook-xsl))))
+               (substitute* '("docs/man/Makefile.am" "docs/man/Makefile.in")
+                 (("http://docbook.sourceforge.net/release/xsl/current")
+                  xsldoc)))
+             #t))
          (replace
           'install
           (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
-- 
2.30.1