me
/
guix
Archived
1
0
Fork 0

import: utils: Skip not found packages.

* guix/import/utils.scm (recursive-import): Skip packages when the
package returned by 'repo->guix-package' is false.
* tests/import-utils.scm: New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
master
Sarah Morgensen 2021-08-06 11:05:16 -07:00 committed by Ludovic Courtès
parent 16579a7c57
commit f95bdeb93a
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 42 additions and 12 deletions

View File

@ -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.
;;;
@ -489,15 +490,16 @@ to obtain the Guix package name corresponding to the upstream name."
(name (list name #f))) dependencies)))
(make-node name version package normalized-deps)))
(map node-package
(topological-sort (list (lookup-node package-name version))
(lambda (node)
(map (lambda (name-version)
(apply lookup-node name-version))
(remove (lambda (name-version)
(apply exists? name-version))
(node-dependencies node))))
(lambda (node)
(string-append
(node-name node)
(or (node-version node) ""))))))
(filter-map
node-package
(topological-sort (list (lookup-node package-name version))
(lambda (node)
(map (lambda (name-version)
(apply lookup-node name-version))
(remove (lambda (name-version)
(apply exists? name-version))
(node-dependencies node))))
(lambda (node)
(string-append
(node-name node)
(or (node-version node) ""))))))

View File

@ -2,6 +2,7 @@
;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
;;;
;;; This file is part of GNU Guix.
;;;
@ -64,6 +65,33 @@
'())))
#:guix-name identity))
(test-equal "recursive-import: skip false packages (toplevel)"
'()
(recursive-import "foo"
#:repo 'repo
#:repo->guix-package
(match-lambda*
(("foo" #:version #f #:repo 'repo)
(values #f '())))
#:guix-name identity))
(test-equal "recursive-import: skip false packages (dependency)"
'((package
(name "foo")
(inputs `(("bar" ,bar)))))
(recursive-import "foo"
#:repo 'repo
#:repo->guix-package
(match-lambda*
(("foo" #:version #f #:repo 'repo)
(values '(package
(name "foo")
(inputs `(("bar" ,bar))))
'("bar")))
(("bar" #:version #f #:repo 'repo)
(values #f '())))
#:guix-name identity))
(test-assert "alist->package with simple source"
(let* ((meta '(("name" . "hello")
("version" . "2.10")