[PATCH rust-team] gnu: rust-xremap: Use output for each feature.

  • Open
  • quality assurance status badge
Details
2 participants
  • Efraim Flashner
  • Herman Rimm
Owner
unassigned
Submitted by
Herman Rimm
Severity
normal
H
H
Herman Rimm wrote on 2 Jan 14:06 +0100
(address . guix-patches@gnu.org)
940b18daf5a018d28047b31ff0585893530e5c2a.1735823152.git.herman@rimm.ee
* 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(-)

Toggle diff (142 lines)
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
E
E
Efraim Flashner wrote on 5 Jan 09:56 +0100
(name . Herman Rimm)(address . herman@rimm.ee)(address . 75283@debbugs.gnu.org)
Z3pJTnEc7Yg0544c@3900XT
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:
Toggle quote (12 lines)
> * 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
-----BEGIN PGP SIGNATURE-----

iQIyBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmd6SUoACgkQQarn3Mo9
g1E0zg/3TeaQmMxtxkomh3ob46ug2TVQb8YiCp9OZUda1hPNQjN1+9v7crYKduAS
yeMxsQ61UgXMKCOhYNJnX6/wQ8JYUG7OyDg+tyOyZLu9f3BRIf2AAO/qmr2XZRJm
DRB7R0RVgX8mpV88mS9ALc3cCcrjh16/ry5hjUT/7oWfRj7wVcnAZPFJ2obXnwvr
ElCoqJ/kf/hstw4BXiEy1VZEbSDftRo5xT0swgNXrOTHJAHYjWaQ5hk0nnmL06x2
zgM46DXgH2dZ4ul/bHD0vTxc/vRZxPH4tICHJaBjmXddeUrWNpAfYAqT33d8GFXk
4dnLflwXN4REelBbQo6UUiQ/iGzVPdgZD6OTWgjqwQlUzXXrxYdcLg8LvsUIOP9L
z4kH6pwe/jR81lroC8ie7iCld2ETUxM9KEAnWqsL8Z0e2a8xmkVum1uHwTUJqLuY
eYSYOJeCxSQl/NSTuUtA8lKjg+fdvErhoLEKZ1ISQWep+sxiYfgRhpR+HjIbQzvu
6lEcnhv0ZIWU+8/Xx5bCqEuoAkLwqQHP7AM+0o4BQ8kAunjiDfED7p2gkgE1Ivzf
WJJe+wTps3H5Xpw9NdyQ+AI5zGPYmQRar+y8QNoEqOY4TrRIdCWxR//Dw/oD21XI
5I4/m104QD5Wi9ayaLHEw6Q5WBOi7lPA0krdcLLYnheGoOqJig==
=e7Yx
-----END PGP SIGNATURE-----


H
H
Herman Rimm wrote on 6 Jan 20:42 +0100
(name . Efraim Flashner)(address . efraim@flashner.co.il)(address . 75283@debbugs.gnu.org)
2eezlodw3yan7gpi4cropxwhxi3weedvklvjviiboorgfmmaxk@fyrtzeepv34e
Hello,

On Sun, Jan 05, 2025 at 10:56:46AM +0200, Efraim Flashner wrote:
Toggle quote (4 lines)
> 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
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 75283@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 75283
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch