unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 36351@debbugs.gnu.org
Subject: [bug#36351] [PATCH 03/10] ui: 'show-what-to-build' uses 'derivation-build-plan'.
Date: Mon, 24 Jun 2019 14:22:05 +0200	[thread overview]
Message-ID: <20190624122212.5932-3-ludo@gnu.org> (raw)
In-Reply-To: <20190624122212.5932-1-ludo@gnu.org>

* 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.
---
 guix/ui.scm | 32 +++++++-------------------------
 1 file changed, 7 insertions(+), 25 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index 0b4fe144b6..3c67fbaa24 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -41,7 +41,6 @@
   #:use-module (guix packages)
   #:use-module (guix profiles)
   #:use-module (guix derivations)
-  #:use-module (guix combinators)
   #:use-module (guix build-system)
   #:use-module (guix serialization)
   #:use-module ((guix licenses) #:select (license? license-name))
@@ -820,29 +819,12 @@ report what is prerequisites are available for download."
         (substitution-oracle store drv #:mode mode)
         (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)
-                 (fold2 (lambda (drv build download)
-                          (let-values (((b d)
-                                        (derivation-prerequisites-to-build
-                                         store drv
-                                         #:mode mode
-                                         #: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))))
+                 (derivation-build-plan store
+                                        (map derivation-input drv)
+                                        #:mode mode
+                                        #:substitutable-info
+                                        substitutable-info))
                 ((download)                   ; add the references of DOWNLOAD
                  (if use-substitutes?
                      (delete-duplicates
@@ -856,8 +838,8 @@ report what is prerequisites are available for download."
                                            download))))
                      download))
                 ((graft hook build)
-                 (match (fold (lambda (file acc)
-                                (let ((drv (read-derivation-from-file file)))
+                 (match (fold (lambda (drv acc)
+                                (let ((file (derivation-file-name drv)))
                                   (match acc
                                     ((#:graft graft #:hook hook #:build build)
                                      (cond
-- 
2.22.0

  parent reply	other threads:[~2019-06-24 12:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-24 12:18 [bug#36351] [PATCH 00/10] Add 'derivation-build-plan', improve (guix derivations) Ludovic Courtès
2019-06-24 12:22 ` [bug#36351] [PATCH 01/10] derivations: Add 'derivation-input' Ludovic Courtès
2019-06-24 12:22   ` [bug#36351] [PATCH 02/10] derivations: Rewrite and replace 'derivations-prerequisites-to-build' Ludovic Courtès
2019-06-24 12:22   ` Ludovic Courtès [this message]
2019-06-24 12:22   ` [bug#36351] [PATCH 04/10] graph: Use 'derivation-input-derivation' Ludovic Courtès
2019-06-24 12:22   ` [bug#36351] [PATCH 05/10] derivations: <derivation-input> now aggregates a <derivation> Ludovic Courtès
2019-06-24 12:22   ` [bug#36351] [PATCH 06/10] derivations: 'derivation' preserves pointer equality Ludovic Courtès
2019-06-24 12:22   ` [bug#36351] [PATCH 07/10] derivations: 'build-derivations' can be passed derivation inputs Ludovic Courtès
2019-06-24 12:22   ` [bug#36351] [PATCH 08/10] packages: 'specification->package+output' distinguishes "no output specified" Ludovic Courtès
2019-06-24 12:22   ` [bug#36351] [PATCH 09/10] ui: 'show-what-to-build' accepts derivation inputs Ludovic Courtès
2019-06-24 12:22   ` [bug#36351] [PATCH 10/10] ui: 'show-derivation-outputs' accepts <derivation-input> records Ludovic Courtès
2019-06-27  9:17 ` bug#36351: [PATCH 00/10] Add 'derivation-build-plan', improve (guix derivations) Ludovic Courtès

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190624122212.5932-3-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=36351@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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).