From: Herman Rimm via Guix-patches via <guix-patches@gnu.org>
To: 70923@debbugs.gnu.org
Cc: Laurent Gatto <laurent.gatto@gmail.com>,
Ricardo Wurmus <rekado@elephly.net>,
Simon Tournier <zimon.toutoune@gmail.com>
Subject: [bug#70923] [PATCH v4 08/11] import: cran: Use 'maybe-list-field' procedure.
Date: Mon, 9 Dec 2024 20:58:12 +0100 [thread overview]
Message-ID: <ffca10726eee00287a2f7470651c867486fae72a.1733774143.git.herman@rimm.ee> (raw)
In-Reply-To: <4b8cde409e17e4b9ab7ef591eff605b88235fb0a.1733774143.git.herman@rimm.ee>
* guix/import/cran.scm (format-inputs): Delete procedure.
(maybe-inputs): Use 'maybe-list-field' procedure.
Change-Id: I5148afcebdac1f7fa0f8cce9e82e8cebb56c36c8
---
guix/import/cran.scm | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index fe69cb87f7..11843703ac 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -6,6 +6,7 @@
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2022 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2024 Herman Rimm <herman@rimm.ee>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -86,21 +87,6 @@ (define-module (guix import cran)
(define %input-style
(make-parameter 'variable)) ; or 'specification
-(define (format-inputs inputs)
- "Generate a sorted list of package inputs from a list of upstream inputs."
- (map (lambda (input)
- (case (%input-style)
- ((specification)
- `(specification->package ,(upstream-input-downstream-name input)))
- (else
- ((compose string->symbol
- upstream-input-downstream-name)
- input))))
- (sort inputs
- (lambda (a b)
- (string-ci<? (upstream-input-name a)
- (upstream-input-name b))))))
-
(define (string->licenses license-string license-prefix)
(let ((licenses
(map string-trim-both
@@ -189,11 +175,21 @@ (define (description->alist description)
(define* (maybe-inputs package-inputs #:optional (input-type 'inputs))
"Given a list of PACKAGE-INPUTS, tries to generate the TYPE field of a
package definition."
- (match package-inputs
- (()
- '())
- ((package-inputs ...)
- `((,input-type (list ,@(format-inputs package-inputs)))))))
+ (define (format-input input)
+ (case (%input-style)
+ ((specification)
+ `(specification->package ,(upstream-input-downstream-name input)))
+ (else
+ ((compose string->symbol
+ upstream-input-downstream-name)
+ input))))
+
+ (define (upstream-input-name<? i1 i2)
+ (string-ci<? (upstream-input-name i1)
+ (upstream-input-name i2)))
+
+ (maybe-list-field input-type
+ (map format-input (sort package-inputs upstream-input-name<?))))
(define %cran-url "https://cloud.r-project.org/web/packages/")
(define %cran-canonical-url "https://cran.r-project.org/package=")
--
2.45.2
next prev parent reply other threads:[~2024-12-09 20:01 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-13 19:59 [bug#70923] [PATCH 00/13] Add (guix import utils) procedures Herman Rimm via Guix-patches via
2024-05-13 20:07 ` [bug#70923] [PATCH 01/13] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
2024-05-13 20:07 ` [bug#70923] [PATCH 02/13] import: utils: Emit new-style package inputs Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 03/13] tests: go: Adjust to " Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 04/13] tests: elm: " Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 05/13] import: crate: Emit " Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 06/13] import: utils: Add 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 07/13] import: pypi: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 08/13] import: elpa: Use maybe-propagated-inputs procedure Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 09/13] import: hackage: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 10/13] import: cran: " Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 11/13] import: cpan: Use 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 12/13] import: egg: Use maybe-*inputs procedures Herman Rimm via Guix-patches via
2024-05-13 20:08 ` [bug#70923] [PATCH 13/13] import: hexpm: Use (guix import utils) 'maybe-inputs' procedure Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 01/12] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 02/12] import: utils: Emit new-style inputs from maybe-*inputs procedures Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 03/12] tests: elm: Adjust to new-style package inputs Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 04/12] import: crate: Use (guix import utils) procedures Herman Rimm via Guix-patches via
2024-09-04 20:32 ` [bug#70923] [PATCH v2 05/12] import: utils: Add maybe-upstream-inputs Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 06/12] import: pypi: Use maybe-upstream-inputs Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 07/12] import: elpa: Use maybe-propagated-inputse Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 08/12] import: hackage: Use maybe-list-field Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 09/12] import: cran: Refactor format-inputs and use maybe-list-field Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 10/12] import: cpan: Use maybe-upstream-inputs Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 11/12] import: egg: Use maybe-*inputs procedures Herman Rimm via Guix-patches via
2024-09-04 20:33 ` [bug#70923] [PATCH v2 12/12] import: hexpm: Use maybe-inputs Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 00/11] Add (guix import utils) procedures Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 01/11] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 02/11] import: utils: Emit new-style package inputs Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 03/11] import: crate: " Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 04/11] import: utils: Add 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 05/11] import: pypi: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 06/11] import: elpa: Use maybe-propagated-inputs procedure Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 07/11] import: hackage: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 08/11] import: cran: " Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 09/11] import: cpan: Use 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 10/11] import: egg: Use maybe-*inputs procedures Herman Rimm via Guix-patches via
2024-09-24 20:13 ` [bug#70923] [PATCH v3 11/11] import: hexpm: Use (guix import utils) 'maybe-inputs' procedure Herman Rimm via Guix-patches via
2024-12-09 19:58 ` [bug#70923] [PATCH v4 01/11] build-system: cargo: Accept unlabeled #:cargo-inputs Herman Rimm via Guix-patches via
2024-12-09 19:58 ` [bug#70923] [PATCH v4 02/11] import: utils: Emit new-style package inputs Herman Rimm via Guix-patches via
2024-12-09 19:58 ` [bug#70923] [PATCH v4 03/11] import: crate: " Herman Rimm via Guix-patches via
2024-12-09 19:58 ` [bug#70923] [PATCH v4 04/11] import: utils: Add 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
2024-12-09 19:58 ` [bug#70923] [PATCH v4 05/11] import: pypi: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
2024-12-09 19:58 ` [bug#70923] [PATCH v4 06/11] import: elpa: Use maybe-propagated-inputs procedure Herman Rimm via Guix-patches via
2024-12-09 19:58 ` [bug#70923] [PATCH v4 07/11] import: hackage: Use 'maybe-list-field' procedure Herman Rimm via Guix-patches via
2024-12-10 17:35 ` Lars-Dominik Braun
2024-12-12 21:34 ` Herman Rimm via Guix-patches via
2024-12-09 19:58 ` Herman Rimm via Guix-patches via [this message]
2024-12-09 19:58 ` [bug#70923] [PATCH v4 09/11] import: cpan: Use 'maybe-upstream-inputs' procedure Herman Rimm via Guix-patches via
2024-12-09 19:58 ` [bug#70923] [PATCH v4 10/11] import: egg: Use maybe-*inputs procedures Herman Rimm via Guix-patches via
2024-12-09 19:58 ` [bug#70923] [PATCH v4 11/11] import: hexpm: Use (guix import utils) 'maybe-inputs' procedure Herman Rimm via Guix-patches via
2024-12-10 15:41 ` [bug#70923] [PATCH v4 01/11] build-system: cargo: Accept unlabeled #:cargo-inputs Efraim Flashner
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ffca10726eee00287a2f7470651c867486fae72a.1733774143.git.herman@rimm.ee \
--to=guix-patches@gnu.org \
--cc=70923@debbugs.gnu.org \
--cc=herman@rimm.ee \
--cc=laurent.gatto@gmail.com \
--cc=rekado@elephly.net \
--cc=zimon.toutoune@gmail.com \
/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 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).