unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#75283] [PATCH rust-team] gnu: rust-xremap: Use output for each feature.
@ 2025-01-02 13:06 Herman Rimm via Guix-patches via
  2025-01-05  8:56 ` Efraim Flashner
  0 siblings, 1 reply; 3+ messages in thread
From: Herman Rimm via Guix-patches via @ 2025-01-02 13:06 UTC (permalink / raw)
  To: 75283; +Cc: Efraim Flashner

* 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





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#75283] [PATCH rust-team] gnu: rust-xremap: Use output for each feature.
  2025-01-02 13:06 [bug#75283] [PATCH rust-team] gnu: rust-xremap: Use output for each feature Herman Rimm via Guix-patches via
@ 2025-01-05  8:56 ` Efraim Flashner
  2025-01-06 19:42   ` Herman Rimm via Guix-patches via
  0 siblings, 1 reply; 3+ messages in thread
From: Efraim Flashner @ 2025-01-05  8:56 UTC (permalink / raw)
  To: Herman Rimm; +Cc: 75283

[-- Attachment #1: Type: text/plain, Size: 1023 bytes --]

Do we actually need a separate output/package for each desktop type? Or
can we just add in all the features and provide just one package for all
of them?

I compared the outputs of xremap-wlroots and xremap-gnome and the shell
completions are the same between them.

On Thu, Jan 02, 2025 at 02:06:09PM +0100, Herman Rimm wrote:
> * 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(-)
> 

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [bug#75283] [PATCH rust-team] gnu: rust-xremap: Use output for each feature.
  2025-01-05  8:56 ` Efraim Flashner
@ 2025-01-06 19:42   ` Herman Rimm via Guix-patches via
  0 siblings, 0 replies; 3+ messages in thread
From: Herman Rimm via Guix-patches via @ 2025-01-06 19:42 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: 75283

Hello,

On Sun, Jan 05, 2025 at 10:56:46AM +0200, Efraim Flashner wrote:
> Do we actually need a separate output/package for each desktop type? Or
> can we just add in all the features and provide just one package for all
> of them?

In .../xremap/src/client/mod.rs, each feature (e.g. wlroots) is used
like:

#[cfg(feature = "wlroots")]
pub fn build_client() -> WMClient { ... }

Enabling multiple features would define multiple build_client in the
module, which would not compile I think.

Cheers,
Herman




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-06 19:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-02 13:06 [bug#75283] [PATCH rust-team] gnu: rust-xremap: Use output for each feature Herman Rimm via Guix-patches via
2025-01-05  8:56 ` Efraim Flashner
2025-01-06 19:42   ` Herman Rimm via Guix-patches via

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).