[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Ludovic Courtès |
Date: |
Thu, 5 Apr 2018 16:26:33 -0400 (EDT) |
branch: master
commit 2feb3b8100d7a6e1db042ef24e9f2a897c953346
Author: Ludovic Courtès <address@hidden>
Date: Thu Apr 5 17:45:12 2018 +0200
evaluate: Pass the file name and revision to the user procedure.
* bin/evaluate.in (main): Always pass an alist as the arguments to PROC,
containing at least 'file-name' and 'revision'.
* examples/random-jobs.scm (make-random-jobs): Display 'file-name' and
'revision' from ARGUMENTS.
---
bin/evaluate.in | 7 ++++++-
examples/random-jobs.scm | 4 ++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/bin/evaluate.in b/bin/evaluate.in
index 4c9efd5..c8d83e6 100644
--- a/bin/evaluate.in
+++ b/bin/evaluate.in
@@ -65,10 +65,15 @@ exec ${GUILE:address@hidden@} --no-auto-compile -e main -s
"$0" "$@"
(unless (string-null? guix-package-path)
(set-guix-package-path! guix-package-path))
;; Call the entry point of FILE and print the resulting job sexp.
+ ;; Among the arguments, always pass 'file-name' and 'revision' like
+ ;; Hydra does.
(let* ((proc-name (assq-ref spec #:proc))
(proc (module-ref %user-module proc-name))
- (thunks (proc store (assq-ref spec #:arguments)))
(commit (assq-ref spec #:current-commit))
+ (args `((revision . ,commit)
+ (file-name . ,source)
+ ,@(or (assq-ref spec #:arguments) '())))
+ (thunks (proc store args))
(eval `((#:specification . ,(assq-ref spec #:name))
(#:revision . ,commit))))
(pretty-print
diff --git a/examples/random-jobs.scm b/examples/random-jobs.scm
index 8fd895a..97ca150 100644
--- a/examples/random-jobs.scm
+++ b/examples/random-jobs.scm
@@ -42,6 +42,10 @@
(mkdir #$output))))))
(define (make-random-jobs store arguments)
+ (format (current-error-port)
+ "evaluating random jobs from directory ~s, commit ~s~%"
+ (assq-ref arguments 'file-name)
+ (assq-ref arguments 'revision))
(unfold (cut > <> 10)
(lambda (i)
(let ((suffix (number->string i)))