aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2016-07-24 12:49:32 +0200
committerMathieu Lirzin <mthl@gnu.org>2016-07-25 02:37:06 +0200
commitefb249b056fe7ff6a4788de510cf6c344f20612c (patch)
tree1820968952146bc8720dae4bb88429983ac36f16 /bin
parent69e9709b33f05c167b17b7eb3455961e46dcee95 (diff)
downloadcuirass-efb249b056fe7ff6a4788de510cf6c344f20612c.tar
cuirass-efb249b056fe7ff6a4788de510cf6c344f20612c.tar.gz
evaluate: Use (cuirass ...) modules.
This avoids code duplication.
Diffstat (limited to 'bin')
-rw-r--r--bin/evaluate.in35
1 files changed, 4 insertions, 31 deletions
diff --git a/bin/evaluate.in b/bin/evaluate.in
index 2f38358..99124f3 100644
--- a/bin/evaluate.in
+++ b/bin/evaluate.in
@@ -1,6 +1,6 @@
#!/bin/sh
# -*- scheme -*-
-GUILE_LOAD_PATH="$1"
+GUILE_LOAD_PATH="$1${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
export GUILE_LOAD_PATH
exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
!#
@@ -23,38 +23,11 @@ exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
;;; You should have received a copy of the GNU General Public License
;;; along with Cuirass. If not, see <http://www.gnu.org/licenses/>.
-(use-modules (ice-9 format)
+(use-modules (cuirass base)
+ (cuirass utils)
(ice-9 match)
(ice-9 pretty-print)
- (guix store)
- (srfi srfi-19))
-
-(define-syntax-rule (with-directory-excursion dir body ...)
- "Run BODY with DIR as the process's current directory."
- (let ((init (getcwd)))
- (dynamic-wind
- (λ () (chdir dir))
- (λ () body ...)
- (λ () (chdir init)))))
-
-(define (call-with-time thunk kont)
- "Call THUNK and pass KONT the elapsed time followed by THUNK's return
-value."
- (let* ((start (current-time time-monotonic))
- (result (thunk))
- (end (current-time time-monotonic)))
- (kont (time-difference end start) result)))
-
-(define (call-with-time-display thunk)
- "Call THUNK and write to the current output port its duration."
- (call-with-time thunk
- (λ (time result)
- (let ((duration (+ (time-second time)
- (/ (time-nanosecond time) 1e9))))
- (format (current-error-port) "evaluate '~A': ~,3f seconds~%"
- (assq-ref result #:job-name)
- duration)
- (acons #:duration duration result)))))
+ (guix store))
(define* (main #:optional (args (command-line)))
(match args