import: egg: Emit new-style package inputs.

* guix/import/egg.scm (egg->guix-package): Generate dependency list from
a list of symbols.
[egg-parse-dependency]: Return a list of symbols.
[maybe-inputs]: Wrap INPUTS in 'list' instead of 'quasiquote'.
* tests/egg.scm (match-chicken-foo): Adjust accordingly.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Sarah Morgensen 2021-07-14 18:40:34 -07:00 committed by Ludovic Courtès
parent db5962c680
commit 5b6285518b
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 13 additions and 28 deletions

View file

@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz> ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -246,12 +247,9 @@ (define (prettify-name name)
(let ((name (prettify-name (extract-name name)))) (let ((name (prettify-name (extract-name name))))
;; Dependencies are sometimes specified as symbols and sometimes ;; Dependencies are sometimes specified as symbols and sometimes
;; as strings ;; as strings
(list (string-append (if system? "" package-name-prefix)
name)
(list 'unquote
(string->symbol (string-append (string->symbol (string-append
(if system? "" package-name-prefix) (if system? "" package-name-prefix)
name)))))) name))))
(define egg-propagated-inputs (define egg-propagated-inputs
(let ((dependencies (assoc-ref egg-content 'dependencies))) (let ((dependencies (assoc-ref egg-content 'dependencies)))
@ -290,7 +288,7 @@ (define (maybe-inputs input-type inputs)
'()) '())
((inputs ...) ((inputs ...)
(list (list input-type (list (list input-type
(list 'quasiquote inputs)))))) `(list ,@inputs))))))
(values (values
`(package `(package
@ -318,7 +316,7 @@ (define (maybe-inputs input-type inputs)
(license ,egg-licenses)) (license ,egg-licenses))
(filter (lambda (name) (filter (lambda (name)
(not (member name '("srfi-4")))) (not (member name '("srfi-4"))))
(map (compose guix-name->egg-name first) (map (compose guix-name->egg-name symbol->string)
(append egg-propagated-inputs (append egg-propagated-inputs
egg-native-inputs))))))) egg-native-inputs)))))))

View file

@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz> ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -86,16 +87,9 @@ (define-package-matcher match-chicken-foo
('build-system 'chicken-build-system) ('build-system 'chicken-build-system)
('arguments ('quasiquote ('#:egg-name "foo"))) ('arguments ('quasiquote ('#:egg-name "foo")))
('native-inputs ('native-inputs
('quasiquote ('list 'chicken-test 'chicken-srfi-1 'chicken-begin-syntax))
(("chicken-test" ('unquote chicken-test)) ('inputs ('list 'libgit2))
("chicken-srfi-1" ('unquote chicken-srfi-1)) ('propagated-inputs ('list 'chicken-datatype))
("chicken-begin-syntax" ('unquote chicken-begin-syntax)))))
('inputs
('quasiquote
(("libgit2" ('unquote libgit2)))))
('propagated-inputs
('quasiquote
(("chicken-datatype" ('unquote chicken-datatype)))))
('home-page "https://wiki.call-cc.org/egg/foo") ('home-page "https://wiki.call-cc.org/egg/foo")
('synopsis "Example egg") ('synopsis "Example egg")
('description #f) ('description #f)
@ -108,16 +102,9 @@ (define-package-matcher match-chicken-bar
('source (? file-like? source)) ('source (? file-like? source))
('build-system 'chicken-build-system) ('build-system 'chicken-build-system)
('arguments ('quasiquote ('#:egg-name "bar"))) ('arguments ('quasiquote ('#:egg-name "bar")))
('native-inputs ('native-inputs ('list 'chicken-test 'chicken-begin-syntax))
('quasiquote ('inputs ('list 'libgit2))
(("chicken-test" ('unquote chicken-test)) ('propagated-inputs ('list 'chicken-datatype))
("chicken-begin-syntax" ('unquote chicken-begin-syntax)))))
('inputs
('quasiquote
(("libgit2" ('unquote libgit2)))))
('propagated-inputs
('quasiquote
(("chicken-datatype" ('unquote chicken-datatype)))))
('home-page "https://wiki.call-cc.org/egg/bar") ('home-page "https://wiki.call-cc.org/egg/bar")
('synopsis "Example egg") ('synopsis "Example egg")
('description #f) ('description #f)