all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Herman Rimm via Guix-patches via <guix-patches@gnu.org>
To: 75283@debbugs.gnu.org
Cc: Efraim Flashner <efraim@flashner.co.il>
Subject: [bug#75283] [PATCH rust-team] gnu: rust-xremap: Use output for each feature.
Date: Thu,  2 Jan 2025 14:06:09 +0100	[thread overview]
Message-ID: <940b18daf5a018d28047b31ff0585893530e5c2a.1735823152.git.herman@rimm.ee> (raw)

* gnu/packages/rust-apps.scm (output-features): Add procedure.
(rust-xremap)[outputs]: Add.
[arguments]: Remove features, add modules and output-features phases.
(xremap-gnome, xremap-kde, xremap-wlroots, xremap-hyprland, xremap-sway,
xremap-x11): Deprecate.

Change-Id: I9cf6a27f908a0fa42e89daba12fba3615d05ad4e
---
 gnu/packages/rust-apps.scm | 79 +++++++++++++++++++++-----------------
 1 file changed, 44 insertions(+), 35 deletions(-)

diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index 2182daa2f30..074c1f56408 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -28,7 +28,7 @@
 ;;; Copyright © 2023, 2024 Jaeme Sifat <jaeme@runbox.com>
 ;;; Copyright © 2023 Steve George <steve@futurile.net>
 ;;; Copyright © 2024 Troy Figiel <troy@troyfigiel.com>
-;;; Copyright © 2024 Herman Rimm <herman@rimm.ee>
+;;; Copyright © 2024-2025 Herman Rimm <herman@rimm.ee>
 ;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz>
 ;;; Copyright © 2024 Suhail Singh <suhail@bayesians.ca>
 ;;; Copyright © 2024 Jordan Moore <lockbox@struct.foo>
@@ -113,7 +113,8 @@ (define-module (gnu packages rust-apps)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages webkit)
-  #:use-module (gnu packages xorg))
+  #:use-module (gnu packages xorg)
+  #:use-module (srfi srfi-1))
 
 (define-public aardvark-dns
   (package
@@ -4244,6 +4245,34 @@ (define-public git-delta
 @command{grep} and a stylized box presentation.")
     (license license:expat)))
 
+(define* (output-features output #:optional (features (list output)))
+  (define (phase-name prefix)
+    (string->symbol (string-append prefix "-" output)))
+
+  (define set-args
+   `(let loop ((lst    args)
+               (result '()))
+      (match lst
+        (() (reverse result))
+        ((#:outputs outputs rest ...)
+         ;; XXX: Make give output the default.
+         (loop rest (cons* `(("out" . ,(assoc-ref outputs ,output)))
+                           #:outputs result)))
+        ((#:features _ rest ...)
+         (loop rest (cons* ',features #:features result)))
+        ((kw value rest ...)
+         (loop rest (cons* value kw result))))))
+  ;; XXX: Run after previous install-output phase.
+  `((add-after 'install ',(phase-name "build")
+      (lambda args
+        (apply (assoc-ref %standard-phases 'build) ,set-args)))
+    (add-after ',(phase-name "build") ',(phase-name "check")
+      (lambda args
+        (apply (assoc-ref %standard-phases 'check) ,set-args)))
+    (add-after ',(phase-name "check") ',(phase-name "install")
+      (lambda args
+        (apply (assoc-ref %standard-phases 'install) ,set-args)))))
+
 (define-public rust-xremap
   (package
     (name "rust-xremap")
@@ -4257,9 +4286,9 @@ (define-public rust-xremap
         (base32
          "0whvw9bbgjf5znb3025iqkj2aijasg6fcx9q1jy97kb0s4m996q2"))))
     (build-system cargo-build-system)
+    (outputs '("out" "hyprland" "gnome" "kde" "wlroots" "x11"))
     (arguments
-     `(#:features '()
-       #:install-source? #f
+     `(#:install-source? #f
        #:cargo-inputs
        (("rust-anyhow" ,rust-anyhow-1)
         ("rust-clap" ,rust-clap-4)
@@ -4283,8 +4312,13 @@ (define-public rust-xremap
         ("rust-wayland-protocols-wlr" ,rust-wayland-protocols-wlr-0.1)
         ("rust-x11rb" ,rust-x11rb-0.13)
         ("rust-zbus" ,rust-zbus-1))
+       #:modules ((guix build cargo-build-system)
+                  (guix build utils)
+                  (ice-9 match))
        #:phases
        (modify-phases %standard-phases
+         ,@(concatenate (map output-features (drop outputs 1)))
+         ;; XXX: Separately output default xremap and completions?
          (add-after 'install 'install-completions
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
@@ -4312,47 +4346,22 @@ (define-public rust-xremap
     (license license:expat)))
 
 (define-public xremap-gnome
-  (package
-    (inherit rust-xremap)
-    (name "xremap-gnome")
-    (arguments
-     (substitute-keyword-arguments (package-arguments rust-xremap)
-       ((#:features _) '(list "gnome"))))))
+  (deprecated-package "xremap-gnome" rust-xremap))
 
 (define-public xremap-kde
-  (package
-    (inherit rust-xremap)
-    (name "xremap-kde")
-    (arguments
-     (substitute-keyword-arguments (package-arguments rust-xremap)
-       ((#:features _) '(list "kde"))))))
+  (deprecated-package "xremap-kde" rust-xremap))
 
 (define-public xremap-wlroots
-  (package
-    (inherit rust-xremap)
-    (name "xremap-wlroots")
-    (arguments
-     (substitute-keyword-arguments (package-arguments rust-xremap)
-       ((#:features _) '(list "wlroots"))))))
+  (deprecated-package "xremap-wlroots" rust-xremap))
 
 (define-public xremap-hyprland
-  (package
-    (inherit rust-xremap)
-    (name "xremap-hyprland")
-    (arguments
-     (substitute-keyword-arguments (package-arguments rust-xremap)
-       ((#:features _) '(list "hyprland"))))))
+  (deprecated-package "xremap-hyprland" rust-xremap))
 
 (define-public xremap-sway
-  (deprecated-package "xremap-sway" xremap-wlroots))
+  (deprecated-package "xremap-sway" rust-xremap))
 
 (define-public xremap-x11
-  (package
-    (inherit rust-xremap)
-    (name "xremap-x11")
-    (arguments
-     (substitute-keyword-arguments (package-arguments rust-xremap)
-       ((#:features _) '(list "x11"))))))
+  (deprecated-package "xremap-x11" rust-xremap))
 
 (define-public xsv
   (package

base-commit: 5f92f009a19c1a5a8b7df5a7bcb1e1f283a953f8
-- 
2.45.2





             reply	other threads:[~2025-01-02 13:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-02 13:06 Herman Rimm via Guix-patches via [this message]
2025-01-05  8:56 ` [bug#75283] [PATCH rust-team] gnu: rust-xremap: Use output for each feature Efraim Flashner
2025-01-06 19:42   ` Herman Rimm via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=940b18daf5a018d28047b31ff0585893530e5c2a.1735823152.git.herman@rimm.ee \
    --to=guix-patches@gnu.org \
    --cc=75283@debbugs.gnu.org \
    --cc=efraim@flashner.co.il \
    --cc=herman@rimm.ee \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.