From 041b340da409078951267b6a8c43b27716e6b7ec Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 18 Mar 2020 22:17:39 +0100 Subject: store: Add 'with-build-handler'. * guix/store.scm (current-build-prompt): New variable. (call-with-build-handler, invoke-build-handler): New procedures. (with-build-handler): New macro. * tests/store.scm ("with-build-handler"): New test. --- tests/store.scm | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/store.scm b/tests/store.scm index 2b14a4af0a..b61a981b28 100644 --- a/tests/store.scm +++ b/tests/store.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -380,6 +380,38 @@ (equal? (valid-derivers %store o) (list (derivation-file-name d)))))) +(test-equal "with-build-handler" + 'success + (let* ((b (add-text-to-store %store "build" "echo $foo > $out" '())) + (s (add-to-store %store "bash" #t "sha256" + (search-bootstrap-binary "bash" + (%current-system)))) + (d1 (derivation %store "the-thing" + s `("-e" ,b) + #:env-vars `(("foo" . ,(random-text))) + #:sources (list b s))) + (d2 (derivation %store "the-thing" + s `("-e" ,b) + #:env-vars `(("foo" . ,(random-text)) + ("bar" . "baz")) + #:sources (list b s))) + (o1 (derivation->output-path d1)) + (o2 (derivation->output-path d2))) + (with-build-handler + (let ((counter 0)) + (lambda (continue store things mode) + (match things + ((drv) + (set! counter (+ 1 counter)) + (if (string=? drv (derivation-file-name d1)) + (continue #t) + (and (string=? drv (derivation-file-name d2)) + (= counter 2) + 'success)))))) + (build-derivations %store (list d1)) + (build-derivations %store (list d2)) + 'fail))) + (test-assert "topologically-sorted, one item" (let* ((a (add-text-to-store %store "a" "a")) (b (add-text-to-store %store "b" "b" (list a))) -- cgit v1.2.3 From 9acacb71c958218fd69cf0fb9df0b439a980a0f2 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 22 Mar 2020 15:58:49 +0100 Subject: Remove workaround for 'time-monotonic' in Guile 2.2.2. This is a followup to e688c2df3924423b67892cc9939ca099c729d1cb. * build-aux/hydra/evaluate.scm : Remove 'time-monotonic' definition. * guix/cache.scm: Likewise. * guix/progress.scm: Likewise. * guix/scripts/substitute.scm: Likewise. * guix/scripts/weather.scm: Likewise. * tests/cache.scm: Likewise. --- build-aux/hydra/evaluate.scm | 7 ------- guix/cache.scm | 9 +-------- guix/progress.scm | 9 +-------- guix/scripts/substitute.scm | 7 ------- guix/scripts/weather.scm | 7 ------- tests/cache.scm | 9 +-------- 6 files changed, 3 insertions(+), 45 deletions(-) (limited to 'tests') diff --git a/build-aux/hydra/evaluate.scm b/build-aux/hydra/evaluate.scm index 6e63a149bd..c74fcdb763 100644 --- a/build-aux/hydra/evaluate.scm +++ b/build-aux/hydra/evaluate.scm @@ -42,13 +42,6 @@ (beautify-user-module! m) m)) -(cond-expand - (guile-2.2 - ;; Guile 2.2.2 has a bug whereby 'time-monotonic' objects have seconds and - ;; nanoseconds swapped (fixed in Guile commit 886ac3e). Work around it. - (define time-monotonic time-tai)) - (else #t)) - (define (call-with-time thunk kont) "Call THUNK and pass KONT the elapsed time followed by THUNK's return values." diff --git a/guix/cache.scm b/guix/cache.scm index 1dc0083f1d..feff131068 100644 --- a/guix/cache.scm +++ b/guix/cache.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2020 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -33,13 +33,6 @@ ;;; ;;; Code: -(cond-expand - (guile-2.2 - ;; Guile 2.2.2 has a bug whereby 'time-monotonic' objects have seconds and - ;; nanoseconds swapped (fixed in Guile commit 886ac3e). Work around it. - (define time-monotonic time-tai)) - (else #t)) - (define (obsolete? date now ttl) "Return #t if DATE is obsolete compared to NOW + TTL seconds." (time>? (subtract-duration now (make-time time-duration 0 ttl)) diff --git a/guix/progress.scm b/guix/progress.scm index c7567a35fd..fec65b424c 100644 --- a/guix/progress.scm +++ b/guix/progress.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Sou Bunnbu ;;; Copyright © 2015 Steve Sprang -;;; Copyright © 2017, 2018, 2019 Ludovic Courtès +;;; Copyright © 2017, 2018, 2019, 2020 Ludovic Courtès ;;; Copyright © 2018 Clément Lassieur ;;; ;;; This file is part of GNU Guix. @@ -96,13 +96,6 @@ stopped." ;;; File download progress report. ;;; -(cond-expand - (guile-2.2 - ;; Guile 2.2.2 has a bug whereby 'time-monotonic' objects have seconds and - ;; nanoseconds swapped (fixed in Guile commit 886ac3e). Work around it. - (define time-monotonic time-tai)) - (else #t)) - (define (nearest-exact-integer x) "Given a real number X, return the nearest exact integer, with ties going to the nearest exact even integer." diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index dfb975a24a..95b47a7816 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -102,13 +102,6 @@ ;;; ;;; Code: -(cond-expand - (guile-2.2 - ;; Guile 2.2.2 has a bug whereby 'time-monotonic' objects have seconds and - ;; nanoseconds swapped (fixed in Guile commit 886ac3e). Work around it. - (define time-monotonic time-tai)) - (else #t)) - (define %narinfo-cache-directory ;; A local cache of narinfos, to avoid going to the network. Most of the ;; time, 'guix substitute' is called by guix-daemon as root and stores its diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm index a9e0cba92a..eb76771452 100644 --- a/guix/scripts/weather.scm +++ b/guix/scripts/weather.scm @@ -106,13 +106,6 @@ scope." '() packages))))) -(cond-expand - (guile-2.2 - ;; Guile 2.2.2 has a bug whereby 'time-monotonic' objects have seconds and - ;; nanoseconds swapped (fixed in Guile commit 886ac3e). Work around it. - (define time-monotonic time-tai)) - (else #t)) - (define (call-with-time thunk kont) "Call THUNK and pass KONT the elapsed time followed by THUNK's return values." diff --git a/tests/cache.scm b/tests/cache.scm index e46cdd816d..80b44d69aa 100644 --- a/tests/cache.scm +++ b/tests/cache.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2017 Ludovic Courtès +;;; Copyright © 2017, 2020 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -24,13 +24,6 @@ #:use-module ((guix utils) #:select (call-with-temporary-directory)) #:use-module (ice-9 match)) -(cond-expand - (guile-2.2 - ;; Guile 2.2.2 has a bug whereby 'time-monotonic' objects have seconds and - ;; nanoseconds swapped (fixed in Guile commit 886ac3e). Work around it. - (define time-monotonic time-tai)) - (else #t)) - (test-begin "cache") (test-equal "remove-expired-cache-entries" -- cgit v1.2.3 From c136da3fbd92a5db1f889d37f0a7c938ccd63648 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 25 Mar 2020 15:37:39 +0100 Subject: tests: Adjust to 'show-manifest-transaction' changes. This is a followup to 3e5ab0a7a9399bb098b9ced46bf3cbf4085c6bab. * tests/ui.scm ("show-manifest-transaction"): Update regexp. * tests/guix-package.sh: Adjust Emacs regexp in --with-source test. --- tests/guix-package.sh | 3 +-- tests/ui.scm | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/guix-package.sh b/tests/guix-package.sh index f9fb31033e..1f955257be 100644 --- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -189,8 +189,7 @@ emacs_tarball="$module_dir/emacs-42.5.9rc7.tar.gz" touch "$emacs_tarball" guix package -p "$profile" -i emacs --with-source="$emacs_tarball" -n \ 2> "$tmpfile" -grep -E 'emacs[[:blank:]]+42\.5\.9rc7[[:blank:]]+.*-emacs-42.5.9rc7' \ - "$tmpfile" +grep -E 'emacs[[:blank:]]+42\.5\.9rc7' "$tmpfile" rm "$emacs_tarball" "$tmpfile" rmdir "$module_dir" diff --git a/tests/ui.scm b/tests/ui.scm index 05eace6721..3dc6952e1f 100644 --- a/tests/ui.scm +++ b/tests/ui.scm @@ -252,12 +252,12 @@ Second line" 24)) (let* ((m (manifest (list guile-1.8.8))) (t (manifest-transaction (install (list guile-2.0.9))))) (with-store store - (and (string-match "guile\t1.8.8 → 2.0.9" + (and (string-match "guile +1.8.8 → 2.0.9" (with-fluids ((%default-port-encoding "UTF-8")) (with-error-to-string (lambda () (show-manifest-transaction store m t))))) - (string-match "guile\t1.8.8 -> 2.0.9" + (string-match "guile +1.8.8 -> 2.0.9" (with-error-to-string (lambda () ;; In Guile 2.2, %DEFAULT-PORT-ENCODING doesn't -- cgit v1.2.3