guix-devel
[Top][All Lists]
Advanced

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

Re: Replacing polkit by polkit-duktape on core-updates-frozen ?


From: Maxim Cournoyer
Subject: Re: Replacing polkit by polkit-duktape on core-updates-frozen ?
Date: Mon, 22 Nov 2021 15:41:43 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hello again,

I've now tried this:

--8<---------------cut here---------------start------------->8---
gnu: polkit: Define polkit package variable based on architecture.

* gnu/packages/polkit.scm (polkit): Rename to...
(polkit*): ... this.
(polkit-duktape): Adjust to inherit from polkit*.
(polkit-for-system): New procedure.
(polkit): New variable.

1 file changed, 44 insertions(+), 27 deletions(-)
gnu/packages/polkit.scm | 71 
++++++++++++++++++++++++++++++++++++++++++++---------------------------

modified   gnu/packages/polkit.scm
@@ -48,7 +48,7 @@ (define-module (gnu packages polkit)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages xml))
 
-(define-public polkit
+(define-public polkit*
   (package
     (name "polkit")
     (version "0.120")
@@ -151,32 +151,49 @@ (define-public polkit
 ;;; Variant of polkit built with Duktape, a lighter JavaScript engine compared
 ;;; to mozjs.
 (define-public polkit-duktape
-  (package/inherit polkit
-    (name "polkit-duktape")
-    (source
-     (origin
-       (inherit (package-source polkit))
-       (patches
-        (append
-            (search-patches "polkit-use-duktape.patch")
-            (origin-patches (package-source polkit))))))
-    (arguments
-     (substitute-keyword-arguments (package-arguments polkit)
-       ((#:configure-flags flags)
-        `(cons "--with-duktape" ,flags))
-       ((#:phases phases)
-        `(modify-phases ,phases
-           (add-after 'unpack 'force-gnu-build-system-bootstrap
-             (lambda _
-               (delete-file "configure")))))))
-    (native-inputs
-     (append `(("autoconf" ,autoconf)
-               ("automake" ,automake)
-               ("libtool" ,libtool)
-               ("pkg-config" ,pkg-config))
-         (package-native-inputs polkit)))
-    (inputs (alist-replace "mozjs" `(,duktape)
-                           (package-inputs polkit)))))
+  (let ((base polkit*))
+    (package/inherit base
+      (name "polkit-duktape")
+      (source
+       (origin
+         (inherit (package-source base))
+         (patches
+          (append
+              (search-patches "polkit-use-duktape.patch")
+              (origin-patches (package-source base))))))
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:configure-flags flags)
+          `(cons "--with-duktape" ,flags))
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-after 'unpack 'force-gnu-build-system-bootstrap
+               (lambda _
+                 (delete-file "configure")))))))
+      (native-inputs
+       (append `(("autoconf" ,autoconf)
+                 ("automake" ,automake)
+                 ("libtool" ,libtool)
+                 ("pkg-config" ,pkg-config))
+           (package-native-inputs base)))
+      (inputs (alist-replace "mozjs" `(,duktape)
+                             (package-inputs base))))))
+
+
+(define (polkit-for-system 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*
+      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-system) (%current-target-system)))))
 
 (define-public polkit-qt
   (package
--8<---------------cut here---------------end--------------->8---

But my "test" fails the same:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix build --system=aarch64-linux \
    -e '(@ (gnu packages polkit) polkit)' -n |& grep polkit
/gnu/store/dw11y85xfsb8hcg7w2cw57f1xfs4i74m-polkit-0.120.drv
/gnu/store/ric7yf4ra2p14p29fwsh18m1nakciakv-polkit-0.120.tar.xz
--8<---------------cut here---------------end--------------->8---

I'd have expected to see 'polkit-duktape' as the name of the package in
the output.

Thanks,

Maxim



reply via email to

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