[PATCH core-updates 0/4] import: {utils, go, crate}: Emit new-style package inputs.

OpenSubmitted by Sarah Morgensen.
Details
3 participants
  • Efraim Flashner
  • Sarah Morgensen
  • Ludovic Courtès
Owner
unassigned
Severity
normal
S
S
Sarah Morgensen wrote on 12 Jul 07:35 +0200
(address . guix-patches@gnu.org)
cover.1626067919.git.iskarian@mgsn.dev
Hello Guix,
This should bring the go and crate importers into the new input-label-lessworld (they both use PACKAGE-NAMES->PACKAGE-INPUTS in import/utils.scm). Cargobuild system is correspondingly updated to accept both new- and old-stylepackage inputs. I successfully tested importing, building, and running'drill', a cargo-build-system package.
I think this leaves the hackage/stackage, egg, gem, and opam importers. Shouldwe open a bug to track them?
--Sarah Morgensen (4): import: utils: Emit new-style package inputs. import: go: Emit new-style package inputs. import: crate: Emit new-style package inputs. cargo-build-system: Accept new-style package inputs.
guix/build-system/cargo.scm | 9 ++++++--- guix/import/crate.scm | 5 +++-- guix/import/utils.scm | 13 ++++++------- guix/packages.scm | 2 ++ tests/crate.scm | 30 +++++++++++------------------- tests/go.scm | 3 ++- 6 files changed, 30 insertions(+), 32 deletions(-)

base-commit: 9b4c3c675c05870e5983c21ce4ff944e0b0bc2fa-- 2.31.1
S
S
Sarah Morgensen wrote on 12 Jul 07:48 +0200
[PATCH core-updates 1/4] import: utils: Emit new-style package inputs.
(address . 49531@debbugs.gnu.org)
e04ca693d1e9c9899701ba8868db639949e3cd78.1626067919.git.iskarian@mgsn.dev
* 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/utils.scm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
Toggle diff (40 lines)diff --git a/guix/import/utils.scm b/guix/import/utils.scmindex 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."-- 2.31.1
S
S
Sarah Morgensen wrote on 12 Jul 07:48 +0200
[PATCH core-updates 2/4] import: go: Emit new-style package inputs.
(address . 49531@debbugs.gnu.org)
d3001f0a5b110f928f1e7d2116a43b24757635b4.1626067919.git.iskarian@mgsn.dev
The actual change is completely contained in the previous import/utilscommit; this commit adjusts tests.
* tests/go.scm ("go-module->guix-package"): Adjust to new-style packageinputs.--- tests/go.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Toggle diff (22 lines)diff --git a/tests/go.scm b/tests/go.scmindex b088ab50d2..ae94a31425 100644--- a/tests/go.scm+++ b/tests/go.scm@@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright � 2021 Fran�ois Joulaud <francois.joulaud@radiofrance.com>+;;; Copyright � 2021 Sarah Morgensen <iskarian@mgsn.dev> ;;; ;;; This file is part of GNU Guix. ;;;@@ -265,7 +266,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 \-- 2.31.1
S
S
Sarah Morgensen wrote on 12 Jul 07:48 +0200
[PATCH core-updates 3/4] import: crate: Emit new-style package inputs.
(address . 49531@debbugs.gnu.org)
ce265e07cfa82c00e65d65296089d3a00b451c08.1626067919.git.iskarian@mgsn.dev
* guix/import/crate.scm (maybe-cargo-development-inputs)(maybe-cargo-inputs): Wrap PACKAGE-INPUTS in unquoted 'list'.* tests/crate.scm ("crate->guix-package")("cargo-recursive-import")("cargo-recursive-import-hoors-existing-packages"): Adjust accordingly.--- guix/import/crate.scm | 5 +++-- tests/crate.scm | 30 +++++++++++------------------- 2 files changed, 14 insertions(+), 21 deletions(-)
Toggle diff (107 lines)diff --git a/guix/import/crate.scm b/guix/import/crate.scmindex 287ffd2536..9c3bdfb9ab 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. ;;;@@ -137,14 +138,14 @@ record or #f if it was not found." (() '()) ((package-inputs ...)- `(#:cargo-inputs ,package-inputs))))+ `(#:cargo-inputs (,'unquote (list ,@package-inputs)))))) (define (maybe-cargo-development-inputs package-names) (match (package-names->package-inputs package-names) (() '()) ((package-inputs ...)- `(#:cargo-development-inputs ,package-inputs))))+ `(#:cargo-development-inputs (,'unquote (list ,@package-inputs)))))) (define (maybe-arguments arguments) (match argumentsdiff --git a/tests/crate.scm b/tests/crate.scmindex b6c3a7ee2e..50b46aa871 100644--- a/tests/crate.scm+++ b/tests/crate.scm@@ -3,6 +3,7 @@ ;;; Copyright © 2016 David Craven <david@craven.ch> ;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev> ;;; ;;; This file is part of GNU Guix. ;;;@@ -374,7 +375,7 @@ ('quasiquote (#:skip-build? #t #:cargo-inputs- (("rust-leaf-alice" ('unquote 'rust-leaf-alice-0.7))))))+ ('unquote (list rust-leaf-alice))))) (home-page "http://example.com") (synopsis "summary") (description "summary")@@ -494,8 +495,7 @@ (arguments ('quasiquote (#:skip-build? #t #:cargo-inputs- (("rust-leaf-bob"- ('unquote rust-leaf-bob-3))))))+ ('unquote (list rust-leaf-bob))))) (home-page "http://example.com") (synopsis "summary") (description "summary")@@ -517,12 +517,9 @@ (arguments ('quasiquote (#:skip-build? #t #:cargo-inputs- (("rust-intermediate-b"- ('unquote rust-intermediate-b-1))- ("rust-leaf-alice"- ('unquote 'rust-leaf-alice-0.7))- ("rust-leaf-bob"- ('unquote rust-leaf-bob-3))))))+ ('unquote (list rust-intermediate-b+ rust-leaf-alice+ rust-leaf-bob))))) (home-page "http://example.com") (synopsis "summary") (description "summary")@@ -543,14 +540,10 @@ (build-system cargo-build-system) (arguments ('quasiquote (#:cargo-inputs- (("rust-intermediate-a"- ('unquote rust-intermediate-a-1))- ("rust-intermediate-b"- ('unquote rust-intermediate-b-1))- ("rust-leaf-alice"- ('unquote 'rust-leaf-alice-0.7))- ("rust-leaf-bob"- ('unquote rust-leaf-bob-3))))))+ ('unquote (list rust-intermediate-a+ rust-intermediate-b+ rust-leaf-alice+ rust-leaf-bob))))) (home-page "http://example.com") (synopsis "summary") (description "summary")@@ -651,8 +644,7 @@ (build-system cargo-build-system) (arguments ('quasiquote (#:cargo-inputs- (("rust-docopt"- ('unquote 'rust-docopt-0.8))))))+ ('unquote (list rust-docopt))))) (home-page "http://example.com") (synopsis "summary") (description "summary")-- 2.31.1
S
S
Sarah Morgensen wrote on 12 Jul 07:48 +0200
[PATCH core-updates 4/4] cargo-build-system: Accept new-style package inputs.
(address . 49531@debbugs.gnu.org)
598b53d80d66a229502d235507047a7717a15e8d.1626067919.git.iskarian@mgsn.dev
Sanitize cargo's inputs here since the package field sanitizers don'tknow about them.
* guix/packages.scm (sanitize-inputs): Export procedure.* guix/build-system/cargo.scm (package-cargo-inputs)(package-cargo-development-inputs)(lower): Sanitize inputs before using them.--- guix/build-system/cargo.scm | 9 ++++++--- guix/packages.scm | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-)
Toggle diff (61 lines)diff --git a/guix/build-system/cargo.scm b/guix/build-system/cargo.scmindex 60c35eed07..a0aa9ad704 100644--- a/guix/build-system/cargo.scm+++ b/guix/build-system/cargo.scm@@ -6,6 +6,7 @@ ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com> ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> ;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev> ;;; ;;; This file is part of GNU Guix. ;;;@@ -128,13 +129,13 @@ to NAME and VERSION." (define (package-cargo-inputs p) (apply (lambda* (#:key (cargo-inputs '()) #:allow-other-keys)- cargo-inputs)+ (sanitize-inputs cargo-inputs)) (package-arguments p))) (define (package-cargo-development-inputs p) (apply (lambda* (#:key (cargo-development-inputs '()) #:allow-other-keys)- cargo-development-inputs)+ (sanitize-inputs cargo-development-inputs)) (package-arguments p))) (define (crate-closure inputs)@@ -259,7 +260,9 @@ any dependent crates. This can be a benefits: ,@(standard-packages))) (build-inputs `(("cargo" ,rust "cargo") ("rustc" ,rust)- ,@(expand-crate-sources cargo-inputs cargo-development-inputs)+ ,@(expand-crate-sources+ (sanitize-inputs cargo-inputs)+ (sanitize-inputs cargo-development-inputs)) ,@native-inputs)) (outputs outputs) (build cargo-build)diff --git a/guix/packages.scm b/guix/packages.scmindex dfb4c680be..56118edf16 100644--- a/guix/packages.scm+++ b/guix/packages.scm@@ -7,6 +7,7 @@ ;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com> ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev> ;;; ;;; This file is part of GNU Guix. ;;;@@ -117,6 +118,7 @@ prepend ;syntactic keyword replace ;syntactic keyword modify-inputs+ sanitize-inputs package-direct-sources package-transitive-sources-- 2.31.1
S
S
Sarah Morgensen wrote on 12 Jul 16:41 +0200
[PATCH core-updates v2 3/4] import: crate: Emit new-style package inputs.
(address . 49531@debbugs.gnu.org)
d9bea1dea220d8b9c400c2a5cb7b79120f65d50d.1626100499.git.iskarian@mgsn.dev
* guix/import/crate.scm (maybe-cargo-development-inputs)(maybe-cargo-inputs): Wrap PACKAGE-INPUTS in unquoted 'list'.* tests/crate.scm ("crate->guix-package")("cargo-recursive-import")("cargo-recursive-import-hoors-existing-packages"): Adjust accordingly.---
Looks like I missed the version in the test inputs. The tests passed before toothough; it looks like the expected output (or at least the symbols in theexpected output) needs to be quoted in some way, or else match just takes anyvalue in that slot.
guix/import/crate.scm | 5 +++-- tests/crate.scm | 30 +++++++++++------------------- 2 files changed, 14 insertions(+), 21 deletions(-)
Toggle diff (107 lines)diff --git a/guix/import/crate.scm b/guix/import/crate.scmindex 287ffd2536..9c3bdfb9ab 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. ;;;@@ -137,14 +138,14 @@ record or #f if it was not found." (() '()) ((package-inputs ...)- `(#:cargo-inputs ,package-inputs))))+ `(#:cargo-inputs (,'unquote (list ,@package-inputs)))))) (define (maybe-cargo-development-inputs package-names) (match (package-names->package-inputs package-names) (() '()) ((package-inputs ...)- `(#:cargo-development-inputs ,package-inputs))))+ `(#:cargo-development-inputs (,'unquote (list ,@package-inputs)))))) (define (maybe-arguments arguments) (match argumentsdiff --git a/tests/crate.scm b/tests/crate.scmindex b6c3a7ee2e..f09a3f6628 100644--- a/tests/crate.scm+++ b/tests/crate.scm@@ -3,6 +3,7 @@ ;;; Copyright © 2016 David Craven <david@craven.ch> ;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>+;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev> ;;; ;;; This file is part of GNU Guix. ;;;@@ -374,7 +375,7 @@ ('quasiquote (#:skip-build? #t #:cargo-inputs- (("rust-leaf-alice" ('unquote 'rust-leaf-alice-0.7))))))+ ('unquote (list rust-leaf-alice-0.7))))) (home-page "http://example.com") (synopsis "summary") (description "summary")@@ -494,8 +495,7 @@ (arguments ('quasiquote (#:skip-build? #t #:cargo-inputs- (("rust-leaf-bob"- ('unquote rust-leaf-bob-3))))))+ ('unquote (list rust-leaf-bob-3))))) (home-page "http://example.com") (synopsis "summary") (description "summary")@@ -517,12 +517,9 @@ (arguments ('quasiquote (#:skip-build? #t #:cargo-inputs- (("rust-intermediate-b"- ('unquote rust-intermediate-b-1))- ("rust-leaf-alice"- ('unquote 'rust-leaf-alice-0.7))- ("rust-leaf-bob"- ('unquote rust-leaf-bob-3))))))+ ('unquote (list rust-intermediate-b-1+ rust-leaf-alice-0.7+ rust-leaf-bob-3))))) (home-page "http://example.com") (synopsis "summary") (description "summary")@@ -543,14 +540,10 @@ (build-system cargo-build-system) (arguments ('quasiquote (#:cargo-inputs- (("rust-intermediate-a"- ('unquote rust-intermediate-a-1))- ("rust-intermediate-b"- ('unquote rust-intermediate-b-1))- ("rust-leaf-alice"- ('unquote 'rust-leaf-alice-0.7))- ("rust-leaf-bob"- ('unquote rust-leaf-bob-3))))))+ ('unquote (list rust-intermediate-a-1+ rust-intermediate-b-1+ rust-leaf-alice-0.7+ rust-leaf-bob-3))))) (home-page "http://example.com") (synopsis "summary") (description "summary")@@ -651,8 +644,7 @@ (build-system cargo-build-system) (arguments ('quasiquote (#:cargo-inputs- (("rust-docopt"- ('unquote 'rust-docopt-0.8))))))+ ('unquote (list rust-docopt-0.8))))) (home-page "http://example.com") (synopsis "summary") (description "summary")-- 2.31.1
L
L
Ludovic Courtès wrote on 20 Jul 23:22 +0200
Re: bug#49531: [PATCH core-updates 0/4] import: {utils, go, crate}: Emit new-style package inputs.
(name . Sarah Morgensen)(address . iskarian@mgsn.dev)(address . 49531@debbugs.gnu.org)
87sg08isu9.fsf_-_@gnu.org
Hi,
Sarah Morgensen <iskarian@mgsn.dev> skribis:
Toggle quote (4 lines)> * 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'.
Applied this patch squeezed with patch #2, which adjusts tests/go.scm,because tests should be modified in the same commit (ideally, one shouldbe able to take any commit and be sure that tests pass).
Thanks!
Ludo’.
L
L
Ludovic Courtès wrote on 20 Jul 23:29 +0200
Removing input labels for Rust #:cargo-inputs & co.?
(name . Sarah Morgensen)(address . iskarian@mgsn.dev)
87lf60isie.fsf_-_@gnu.org
Sarah Morgensen <iskarian@mgsn.dev> skribis:
Toggle quote (8 lines)> Sanitize cargo's inputs here since the package field sanitizers don't> know about them.>> * guix/packages.scm (sanitize-inputs): Export procedure.> * guix/build-system/cargo.scm (package-cargo-inputs)> (package-cargo-development-inputs)> (lower): Sanitize inputs before using them.
So, do we want to do that? :-)
I’d say yes, but what do Rust folks think? (Efraim?)
Are labels of #:cargo-inputs & co. used at all? If not, we can probablygo one step further and have sanitation remove input labels instead ofadding them.
And then, how do we handle the transition? I’m not enthusiastic aboutcustomizing ‘guix style’ for Rust packages; should we embark on manualchanges of the 2.4K Rust packages?
Toggle quote (15 lines)> +++ b/guix/packages.scm> @@ -7,6 +7,7 @@> ;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>> ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>> ;;; Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>> +;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>> ;;;> ;;; This file is part of GNU Guix.> ;;;> @@ -117,6 +118,7 @@> prepend ;syntactic keyword> replace ;syntactic keyword> modify-inputs> + sanitize-inputs
I’d rather not export it to make sure users don’t mistakenly view it aspart of the public interface; it’s really just an internal helper.
Thanks,Ludo’.
L
L
Ludovic Courtès wrote on 20 Jul 23:36 +0200
Re: bug#49531: [PATCH core-updates 0/4] import: {utils, go, crate}: Emit new-style package inputs.
(name . Sarah Morgensen)(address . iskarian@mgsn.dev)(address . 49531@debbugs.gnu.org)
87czrcis6e.fsf_-_@gnu.org
Ludovic Courtès <ludo@gnu.org> skribis:
Toggle quote (10 lines)> Sarah Morgensen <iskarian@mgsn.dev> skribis:>>> * 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'.>> Applied this patch squeezed with patch #2, which adjusts tests/go.scm,> because tests should be modified in the same commit (ideally, one should> be able to take any commit and be sure that tests pass).
Actually no, I didn’t apply it in the end, because that’s tied to theCrate/Cargo changes as well. :-/
Ludo’.
S
S
Sarah Morgensen wrote on 21 Jul 04:59 +0200
[PATCH core-updates v2] import: go: Emit new-style package inputs.
(address . 49531@debbugs.gnu.org)
21e16bafbc6af293e7916b92af8fa9ece38a7483.1626832035.git.iskarian@mgsn.dev
Since PACKAGE-NAMES->PACKAGE-INPUTS is used by both the go and crateimporters, give the crate importer a copy of the original so itcontinues 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 packageinputs.---This patch narrows the scope to just the go importer; the crate importer can behandled separately.
guix/import/crate.scm | 18 ++++++++++++++++++ guix/import/utils.scm | 13 ++++++------- tests/go.scm | 2 +- 3 files changed, 25 insertions(+), 8 deletions(-)
Toggle diff (91 lines)diff --git a/guix/import/crate.scm b/guix/import/crate.scmindex 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.scmindex 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.scmindex 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
S
S
Sarah Morgensen wrote on 21 Jul 05:03 +0200
Re: bug#49531: [PATCH core-updates 0/4] import: {utils, go, crate}: Emit new-style package inputs.
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 49531@debbugs.gnu.org)
867dhktlki.fsf_-_@mgsn.dev
Hi,
Ludovic Courtès <ludo@gnu.org> writes:
Toggle quote (17 lines)> Ludovic Courtès <ludo@gnu.org> skribis:>>> Sarah Morgensen <iskarian@mgsn.dev> skribis:>>>>> * 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'.>>>> Applied this patch squeezed with patch #2, which adjusts tests/go.scm,>> because tests should be modified in the same commit (ideally, one should>> be able to take any commit and be sure that tests pass).>> Actually no, I didn’t apply it in the end, because that’s tied to the> Crate/Cargo changes as well. :-/>> Ludo’.
Apologies for the trouble! I've sent a rebased v2 (in-reply-to theoriginal patch; forgot to CC you) that just takes care of the goimporter and lets crate continue to live in its own world until wedecide its fate.
--Sarah
S
S
Sarah Morgensen wrote on 21 Jul 09:50 +0200
(name . Ludovic Courtès)(address . ludo@gnu.org)
864kcot89u.fsf_-_@mgsn.dev
Hi all,
Ludovic Courtès <ludo@gnu.org> writes:
Toggle quote (4 lines)> And then, how do we handle the transition? I’m not enthusiastic about> customizing ‘guix style’ for Rust packages; should we embark on manual> changes of the 2.4K Rust packages?
I've attached a patch below that's a first pass at handling#:cargo-inputs in `guix style`. I didn't handle any input modificationshenanigans, but I don't think any packages do that with #:cargo-inputs& co., or if so it's just a few which can be manually updated.
The result of running it on #:cargo-inputs/#:cargo-development-inputspackages:
14 files changed, 9424 insertions(+), 12009 deletions(-)gnu/packages/crates-graphics.scm | 1006 +--gnu/packages/crates-gtk.scm | 658 +-gnu/packages/crates-io.scm | 17471 ++++++++++++++++---------------------gnu/packages/crypto.scm | 4 +-gnu/packages/gnome.scm | 90 +-gnu/packages/rust-apps.scm | 672 +-gnu/packages/security-token.scm | 30 +-gnu/packages/sequoia.scm | 124 +-gnu/packages/shells.scm | 1088 ++-gnu/packages/syndication.scm | 38 +-gnu/packages/terminals.scm | 50 +-gnu/packages/text-editors.scm | 60 +-gnu/packages/video.scm | 100 +-gnu/packages/web.scm | 42 +-
--Sarah
Toggle diff (130 lines)diff --git a/guix/packages.scm b/guix/packages.scmindex d3fa72fd09..26e82050f8 100644--- a/guix/packages.scm+++ b/guix/packages.scm@@ -108,6 +108,7 @@ package-superseded deprecated-package package-field-location+ package-argument-location this-package-input this-package-native-input@@ -515,9 +516,9 @@ object." (name old-name) (properties `((superseded . ,p))))) -(define (package-field-location package field)- "Return the source code location of the definition of FIELD for PACKAGE, or-#f if it could not be determined."+(define (package-part-location package proc)+ "Return the source code location of the part of PACKAGE returned by (PROC+PACKAGE), or #f if it could not be determined." (match (package-location package) (($ <location> file line column) (match (search-path %load-path file)@@ -530,17 +531,16 @@ object." (go-to-location port line column) (match (read port) (('package inits ...)- (let ((field (assoc field inits)))- (match field- ((_ value)- (let ((loc (and=> (source-properties value)- source-properties->location)))- (and loc- ;; Preserve the original file name, which may be a- ;; relative file name.- (set-field loc (location-file) file))))- (_- #f))))+ (match (proc inits)+ (#f+ #f)+ (value+ (let ((loc (and=> (source-properties value)+ source-properties->location)))+ (and loc+ ;; Preserve the original file name, which may be a+ ;; relative file name.+ (set-field loc (location-file) file)))))) (_ #f))))) (lambda _@@ -550,6 +550,29 @@ object." #f))) (_ #f))) +(define (package-field-location package field)+ "Return the source code location of the definition of FIELD for PACKAGE, or+#f if it could not be determined."+ (package-part-location+ package+ (lambda (p)+ (match (assoc field p)+ ((_ value) value)+ (_ #f)))))++(define (package-argument-location package argument)+ "Return the source code location of the definition of keyword ARGUMENT for+PACKAGE, or #f if it could not be determined."+ (package-part-location+ package+ (lambda (p)+ (match (assoc 'arguments p)+ ((_ ('quasiquote (arguments ..1)))+ (match (member argument arguments eq?)+ ((_ value . _) value)+ (_ #f)))+ (_ #f)))))+ (define (package-input package name) "Return the package input NAME of PACKAGE--i.e., an input from the ‘inputs’ or ‘propagated-inputs’ field. Native inputs are notdiff --git a/guix/scripts/style.scm b/guix/scripts/style.scmindex 3c100197a7..19185d924e 100644--- a/guix/scripts/style.scm+++ b/guix/scripts/style.scm@@ -371,7 +371,7 @@ bailing out~%") (delete ,@to-delete) (prepend ,@things))) (location-column location))))- (('quasiquote (exp ...))+ ((or ('quasiquote (exp ...)) ((or (exp ...) (? comment? exp)) ...)) (let/ec return (object->string* `(list ,@(simplify-expressions exp inputs return))@@ -389,6 +389,33 @@ POLICY is a symbol that defines whether to simplify inputs; it can one of 'silent (change only if the resulting derivation is the same), 'safe (change only if semantics are known to be unaffected), and 'always (fearlessly simplify inputs!)."+ (define (package-argument package argument)+ (match (member argument (package-arguments package) eq?)+ ((_ value . _) value)+ (_ #f)))++ ;; We know that the cargo build system does not use its special input labels,+ ;; so it is always safe to simplify, but it will change the derivation. Only+ ;; proceed if POLICY is 'safe or 'always.+ (when (member policy '(safe always))+ (for-each (lambda (argument)+ (match (package-argument package argument)+ (#f+ #f)+ (inputs+ (match (package-argument-location package argument)+ (#f+ #f)+ (location+ (edit-expression+ (location->source-properties location)+ (lambda (str)+ (simplify-inputs location+ (package-name package)+ str inputs+ #:label-matches? (const #t)))))))))+ (list #:cargo-inputs #:cargo-development-inputs)))+ (for-each (lambda (field-name field) (match (field package) (()
E
E
Efraim Flashner wrote on 22 Jul 08:44 +0200
Re: Removing input labels for Rust #:cargo-inputs & co.?
(name . Ludovic Courtès)(address . ludo@gnu.org)
YPkT5dNoqS4F1Ccu@3900XT
On Tue, Jul 20, 2021 at 11:29:13PM +0200, Ludovic Courtès wrote:
Toggle quote (18 lines)> Sarah Morgensen <iskarian@mgsn.dev> skribis:> > > Sanitize cargo's inputs here since the package field sanitizers don't> > know about them.> >> > * guix/packages.scm (sanitize-inputs): Export procedure.> > * guix/build-system/cargo.scm (package-cargo-inputs)> > (package-cargo-development-inputs)> > (lower): Sanitize inputs before using them.> > So, do we want to do that? :-)> > I’d say yes, but what do Rust folks think? (Efraim?)> > Are labels of #:cargo-inputs & co. used at all? If not, we can probably> go one step further and have sanitation remove input labels instead of> adding them.
I haven't done a thorough search, but the only code snippets I couldthink of it turns out were fixed when we managed to add snippets tocargo crates, and most of the logic was moved to thecargo-build-system.
Toggle quote (4 lines)> And then, how do we handle the transition? I’m not enthusiastic about> customizing ‘guix style’ for Rust packages; should we embark on manual> changes of the 2.4K Rust packages?
based on some of my previous work I would like to try to change 99% ofthe cargo-{development-,}inputs to regular-/native-inputs but I thinkafter the core-updates merge would be a better time to work on that.
-- Efraim Flashner <efraim@flashner.co.il> אפרים פלשנרGPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmD5E+IACgkQQarn3Mo9g1EtHhAAjwrWS+LADyZwQzQQWUvlj7rHVNBdJi4U5osdt+z3c7Uf9uqNQTNOeVwK9ZkZYoTPLTnll1z7q+7iriG3U7LJ9hObvogoYaGwAiy3CvzPMpe1JCzodxU5sz4Dy/hB3y8vFOe6HRj0HO5Zh43QR9A/8U4cV/xTIuIp0Uuic3IP7/T7wEIMs/6AtklbOLFbJPg5+ortWwvCdenPQBjaYj4A3GUAGnqtvKT0knXzhbpnBjgMuBt+q9V2IPvuIVCRcZt/tp8pf54H7pRpVwJUdRc2R2xrSR/u6AfYwpsEVMkEiUT9iht/Rnj2CizlYHPR2rpOZM72oXKmlqhNzYBVlw5FfcH1jIMwqqsXywU6QS6hDqGBG1yQG2s+uxSK5dL7L22ChhrwS84GhmAKYOrF+KFWPowgFkCgjosiKA9cDFEgHfPq8T4PNtzqU3oHzrHU5Zp+uS/gNGANrVzExVFQFKJmpyKe9xMGXyzLazJrQiJye0vdlaqICD3Ds5hy8E0JIUdoGJGmJgDbvUciJXsWgG5vek9+qRFJsw23fbi9pd9MgtioJYcCh0XeaG8UyG/lgPSMDXFlmkiplF5ATvKzWC4ZdT0VWap+BE704Bvm0aGStmBB5gsvax7SGYk4CbhHfG5V9Dwn3X4HebHasjfThx581NtmN0k2On76YaaDTJdRcjY==VsAH-----END PGP SIGNATURE-----

?
Your comment

Commenting via the web interface is currently disabled.

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