ui: 'show-what-to-build' uses 'derivation-build-plan'.

* guix/ui.scm (show-what-to-build)[build-or-substitutable?]: Remove.
Use 'derivation-build-plan' instead of
'derivation-prerequisites-to-build', passing it all of DRV at once, and
remove 'fold2' shenanigans and postprocessing of BUILD.
This commit is contained in:
Ludovic Courtès 2019-06-19 22:21:28 +02:00
parent ba04f80e2e
commit 9844d0091e
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 7 additions and 25 deletions

View File

@ -41,7 +41,6 @@
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix profiles) #:use-module (guix profiles)
#:use-module (guix derivations) #:use-module (guix derivations)
#:use-module (guix combinators)
#:use-module (guix build-system) #:use-module (guix build-system)
#:use-module (guix serialization) #:use-module (guix serialization)
#:use-module ((guix licenses) #:select (license? license-name)) #:use-module ((guix licenses) #:select (license? license-name))
@ -824,29 +823,12 @@ report what is prerequisites are available for download."
(substitution-oracle store drv #:mode mode) (substitution-oracle store drv #:mode mode)
(const #f))) (const #f)))
(define (built-or-substitutable? drv)
(or (null? (derivation-outputs drv))
(let ((out (derivation->output-path drv))) ;XXX: assume "out" exists
(or (valid-path? store out)
(substitutable-info out)))))
(let*-values (((build download) (let*-values (((build download)
(fold2 (lambda (drv build download) (derivation-build-plan store
(let-values (((b d) (map derivation-input drv)
(derivation-prerequisites-to-build
store drv
#:mode mode #:mode mode
#:substitutable-info #:substitutable-info
substitutable-info))) substitutable-info))
(values (append b build)
(append d download))))
'() '()
drv))
((build) ; add the DRV themselves
(delete-duplicates
(append (map derivation-file-name
(remove built-or-substitutable? drv))
(map derivation-input-path build))))
((download) ; add the references of DOWNLOAD ((download) ; add the references of DOWNLOAD
(if use-substitutes? (if use-substitutes?
(delete-duplicates (delete-duplicates
@ -860,8 +842,8 @@ report what is prerequisites are available for download."
download)))) download))))
download)) download))
((graft hook build) ((graft hook build)
(match (fold (lambda (file acc) (match (fold (lambda (drv acc)
(let ((drv (read-derivation-from-file file))) (let ((file (derivation-file-name drv)))
(match acc (match acc
((#:graft graft #:hook hook #:build build) ((#:graft graft #:hook hook #:build build)
(cond (cond