From: Sarah Morgensen <iskarian@mgsn.dev>
To: 49531@debbugs.gnu.org
Subject: [bug#49531] [PATCH core-updates v2] import: go: Emit new-style package inputs.
Date: Tue, 20 Jul 2021 19:59:21 -0700 [thread overview]
Message-ID: <21e16bafbc6af293e7916b92af8fa9ece38a7483.1626832035.git.iskarian@mgsn.dev> (raw)
In-Reply-To: <cover.1626067919.git.iskarian@mgsn.dev>
Since PACKAGE-NAMES->PACKAGE-INPUTS is used by both the go and crate
importers, give the crate importer a copy of the original so it
continues to use old-style inputs until it is updated.
* guix/import/utils.scm (package-names->package-inputs)[make-input]:
Return new-style package inputs.
(maybe-inputs): Wrap PACKAGE-INPUTS in 'list' instead of 'quasiquote'.
* guix/import/crate.scm (package-names->package-inputs): New variable.
* tests/go.scm ("go-module->guix-package"): Adjust to new-style package
inputs.
---
This patch narrows the scope to just the go importer; the crate importer can be
handled separately.
guix/import/crate.scm | 18 ++++++++++++++++++
guix/import/utils.scm | 13 ++++++-------
tests/go.scm | 2 +-
3 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/guix/import/crate.scm b/guix/import/crate.scm
index 287ffd2536..fa8f7bf096 100644
--- a/guix/import/crate.scm
+++ b/guix/import/crate.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2019, 2020 Martin Becze <mjbecze@riseup.net>
;;; Copyright © 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -132,6 +133,23 @@ record or #f if it was not found."
;;; Converting crates to Guix packages.
;;;
+(define* (package-names->package-inputs names #:optional (output #f))
+ "Given a list of PACKAGE-NAMES or (PACKAGE-NAME VERSION) pairs, and an
+optional OUTPUT, tries to generate a quoted list of inputs, as suitable to
+use in an 'inputs' field of a package definition."
+ (define (make-input input version)
+ (cons* input (list 'unquote (string->symbol
+ (if version
+ (string-append input "-" version)
+ input)))
+ (or (and output (list output))
+ '())))
+
+ (map (match-lambda
+ ((input version) (make-input input version))
+ (input (make-input input #f)))
+ names))
+
(define (maybe-cargo-inputs package-names)
(match (package-names->package-inputs package-names)
(()
diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index d817318a91..8fa017e18f 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -8,6 +8,7 @@
;;; Copyright © 2020 Helio Machado <0x2b3bfa0+guix@googlemail.com>
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -237,12 +238,10 @@ into a proper sentence and by using two spaces between sentences."
optional OUTPUT, tries to generate a quoted list of inputs, as suitable to
use in an 'inputs' field of a package definition."
(define (make-input input version)
- (cons* input (list 'unquote (string->symbol
- (if version
- (string-append input "-" version)
- input)))
- (or (and output (list output))
- '())))
+ (let ((name (if version (string-append input "-" version) input)))
+ (if output
+ (list (string->symbol name) output)
+ (string->symbol name))))
(map (match-lambda
((input version) (make-input input version))
@@ -263,7 +262,7 @@ snippet generated is for regular inputs."
(()
'())
((package-inputs ...)
- `((,field-name (,'quasiquote ,package-inputs)))))))
+ `((,field-name (list ,@package-inputs)))))))
(define* (maybe-native-inputs package-names #:optional (output #f))
"Same as MAYBE-INPUTS, but for native inputs."
diff --git a/tests/go.scm b/tests/go.scm
index 6749f4585f..743cffb023 100644
--- a/tests/go.scm
+++ b/tests/go.scm
@@ -389,7 +389,7 @@ require github.com/kr/pretty v0.2.1
(arguments
'(#:import-path "github.com/go-check/check"))
(propagated-inputs
- `(("go-github-com-kr-pretty" ,go-github-com-kr-pretty)))
+ (list go-github-com-kr-pretty))
(home-page "https://github.com/go-check/check")
(synopsis "Instructions")
(description "Package check is a rich testing extension for Go's testing \
base-commit: b15c3dd9b0e9cf6858f730e1d46c35ed9ab6a758
--
2.31.1
prev parent reply other threads:[~2021-07-21 3:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-12 5:35 [bug#49531] [PATCH core-updates 0/4] import: {utils, go, crate}: Emit new-style package inputs Sarah Morgensen via Guix-patches via
2021-07-12 5:48 ` [bug#49531] [PATCH core-updates 1/4] import: utils: " Sarah Morgensen via Guix-patches via
2021-07-20 21:22 ` [bug#49531] [PATCH core-updates 0/4] import: {utils, go, crate}: " Ludovic Courtès
2021-07-20 21:36 ` Ludovic Courtès
2021-07-21 3:03 ` Sarah Morgensen
2021-07-12 5:48 ` [bug#49531] [PATCH core-updates 2/4] import: go: " Sarah Morgensen via Guix-patches via
2021-07-12 5:48 ` [bug#49531] [PATCH core-updates 3/4] import: crate: " Sarah Morgensen via Guix-patches via
2021-07-12 14:41 ` [bug#49531] [PATCH core-updates v2 " Sarah Morgensen via Guix-patches via
2021-07-12 5:48 ` [bug#49531] [PATCH core-updates 4/4] cargo-build-system: Accept " Sarah Morgensen via Guix-patches via
2021-07-20 21:29 ` [bug#49531] Removing input labels for Rust #:cargo-inputs & co.? Ludovic Courtès
2021-07-21 7:50 ` [bug#49531] [PATCH core-updates 0/4] import: {utils, go, crate}: Emit new-style package inputs Sarah Morgensen
2021-07-22 6:44 ` [bug#49531] Removing input labels for Rust #:cargo-inputs & co.? Efraim Flashner
2024-01-20 21:06 ` bug#49531: " Maxim Cournoyer
2021-07-21 2:59 ` Sarah Morgensen [this message]
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=21e16bafbc6af293e7916b92af8fa9ece38a7483.1626832035.git.iskarian@mgsn.dev \
--to=iskarian@mgsn.dev \
--cc=49531@debbugs.gnu.org \
/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.