all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 33515@debbugs.gnu.org
Subject: [bug#33515] [PATCH 3/5] hydra: evaluate: Add the checkout to the store.
Date: Mon, 26 Nov 2018 17:45:22 +0100	[thread overview]
Message-ID: <20181126164524.17680-3-ludo@gnu.org> (raw)
In-Reply-To: <20181126164524.17680-1-ludo@gnu.org>

* build-aux/hydra/evaluate.scm <top level>: Add call to 'add-to-store'.
Use that as the 'file-name' attribute.  Call 'primitive-load' in a
directory excursion to SOURCE.
---
 build-aux/hydra/evaluate.scm | 55 +++++++++++++++++++++---------------
 1 file changed, 33 insertions(+), 22 deletions(-)

diff --git a/build-aux/hydra/evaluate.scm b/build-aux/hydra/evaluate.scm
index 5793c022ff..adb14808fa 100644
--- a/build-aux/hydra/evaluate.scm
+++ b/build-aux/hydra/evaluate.scm
@@ -22,6 +22,8 @@
 ;;; arguments and outputs an sexp of the jobs on standard output.
 
 (use-modules (guix store)
+             (guix git-download)
+             ((guix build utils) #:select (with-directory-excursion))
              (srfi srfi-19)
              (ice-9 match)
              (ice-9 pretty-print)
@@ -81,11 +83,6 @@ Otherwise return THING."
    ;; Load FILE, a Scheme file that defines Hydra jobs.
    (let ((port (current-output-port))
          (real-build-things build-things))
-     (save-module-excursion
-      (lambda ()
-        (set-current-module %user-module)
-        (primitive-load file)))
-
      (with-store store
        ;; Make sure we don't resort to substitutes.
        (set-build-options store
@@ -104,23 +101,37 @@ Otherwise return THING."
                    "'build-things' arguments: ~s~%" args)
            (apply real-build-things store args)))
 
-       ;; Call the entry point of FILE and print the resulting job sexp.
-       (pretty-print
-        (match ((module-ref %user-module
-                            (if (equal? cuirass? "cuirass")
-                                'cuirass-jobs
-                                'hydra-jobs))
-                store `((guix
-                         . ((file-name . ,%top-srcdir)))))
-          (((names . thunks) ...)
-           (map (lambda (job thunk)
-                  (format (current-error-port) "evaluating '~a'... " job)
-                  (force-output (current-error-port))
-                  (cons job
-                        (assert-valid-job job
-                                          (call-with-time-display thunk))))
-                names thunks)))
-        port))))
+       ;; Add %TOP-SRCDIR to the store with a proper Git predicate so we work
+       ;; from a clean checkout
+       (let ((source (add-to-store store "guix-source" #t
+                                   "sha256" %top-srcdir
+                                   #:select? (git-predicate %top-srcdir))))
+         (with-directory-excursion source
+           (save-module-excursion
+            (lambda ()
+              (set-current-module %user-module)
+              (format (current-error-port)
+                      "loading '~a' relative to '~a'...~%"
+                      file source)
+              (primitive-load file))))
+
+         ;; Call the entry point of FILE and print the resulting job sexp.
+         (pretty-print
+          (match ((module-ref %user-module
+                              (if (equal? cuirass? "cuirass")
+                                  'cuirass-jobs
+                                  'hydra-jobs))
+                  store `((guix
+                           . ((file-name . ,source)))))
+            (((names . thunks) ...)
+             (map (lambda (job thunk)
+                    (format (current-error-port) "evaluating '~a'... " job)
+                    (force-output (current-error-port))
+                    (cons job
+                          (assert-valid-job job
+                                            (call-with-time-display thunk))))
+                  names thunks)))
+          port)))))
   ((command _ ...)
    (format (current-error-port) "Usage: ~a FILE [cuirass]
 Evaluate the Hydra or Cuirass jobs defined in FILE.~%"
-- 
2.19.1

  parent reply	other threads:[~2018-11-26 16:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-26 16:37 [bug#33515] [PATCH 0/5] Cuirass/Hydra: evaluate jobs in an inferior Ludovic Courtès
2018-11-26 16:45 ` [bug#33515] [PATCH 1/5] inferior: Add 'inferior-eval-with-store' Ludovic Courtès
2018-11-26 16:45   ` [bug#33515] [PATCH 2/5] hydra: Move job definitions to (gnu ci) Ludovic Courtès
2018-11-26 16:45   ` Ludovic Courtès [this message]
2018-11-26 16:45   ` [bug#33515] [PATCH 4/5] channels: Add 'checkout->channel-instance' Ludovic Courtès
2018-11-26 16:45   ` [bug#33515] [PATCH 5/5] hydra: Compute jobs in an inferior Ludovic Courtès
2018-11-28  9:51 ` [bug#33515] [PATCH 0/5] Cuirass/Hydra: evaluate " Ludovic Courtès
2018-12-27 17:27 ` Ludovic Courtès
2018-12-28  4:21   ` Mark H Weaver
2018-12-28 23:19     ` Ludovic Courtès
2019-01-06 20:44       ` bug#33515: " 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

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

  git send-email \
    --in-reply-to=20181126164524.17680-3-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=33515@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.