tests: Pass #:guile to 'computed-file' & co.

Fixes a regression introduced in
af57d1bf6c whereby tests would end up
building the world.

* guix/gexp.scm (mixed-text-file): Add #:guile parameter and honor it.
* tests/gexp.scm ("mixed-text-file"): Pass #:guile to 'mixed-text-file'.
("file-union"): Pass #:guile to 'file-union'.
("lower-object, computed-file"): Pass #:guile to 'computed-file'.
("lower-object, computed-file + grafts"): Likewise.
* tests/packages.scm ("origin->derivation, single file with snippet"):
Likewise.
* tests/profiles.scm ("profile-derivation, ordering & collisions"):
Likewise.
* guix/tests.scm (test-file): Likewise.
This commit is contained in:
Ludovic Courtès 2022-02-11 23:17:00 +01:00
parent c334b7c52f
commit bc1ad69605
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
5 changed files with 23 additions and 15 deletions

View File

@ -2068,7 +2068,7 @@ resulting store file holds references to all these."
#:local-build? #t
#:substitutable? #f))
(define* (mixed-text-file name #:rest text)
(define* (mixed-text-file name #:key guile #:rest text)
"Return an object representing store file NAME containing TEXT. TEXT is a
sequence of strings and file-like objects, as in:
@ -2077,12 +2077,13 @@ sequence of strings and file-like objects, as in:
This is the declarative counterpart of 'text-file*'."
(define build
(gexp (call-with-output-file (ungexp output "out")
(lambda (port)
(set-port-encoding! port "UTF-8")
(display (string-append (ungexp-splicing text)) port)))))
(let ((text (if guile (drop text 2) text)))
(gexp (call-with-output-file (ungexp output "out")
(lambda (port)
(set-port-encoding! port "UTF-8")
(display (string-append (ungexp-splicing text)) port))))))
(computed-file name build))
(computed-file name build #:guile guile))
(define* (file-union name files #:key guile)
"Return a <computed-file> that builds a directory containing all of FILES.

View File

@ -472,7 +472,8 @@ to its file name extension. Return both its file name and its hash."
(format #t #+content)))
(when #+command
(invoke #+command #+name-sans-ext))
(copy-file #+name #$output)))))
(copy-file #+name #$output))
#:guile %bootstrap-guile)))
(file-drv (run-with-store store (lower-object f)))
(file (derivation->output-path file-drv))
(file-drv-outputs (derivation-outputs file-drv))

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014-2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;;
;;; This file is part of GNU Guix.
@ -1413,6 +1413,7 @@ importing.* \\(guix config\\) from the host"
(test-assertm "mixed-text-file"
(mlet* %store-monad ((file -> (mixed-text-file "mixed"
#:guile %bootstrap-guile
"export PATH="
%bootstrap-guile "/bin"))
(drv (lower-object file))
@ -1430,7 +1431,8 @@ importing.* \\(guix config\\) from the host"
(mlet* %store-monad ((union -> (file-union "union"
`(("a" ,(plain-file "a" "1"))
("b/c/d" ,(plain-file "d" "2"))
("e" ,(plain-file "e" "3")))))
("e" ,(plain-file "e" "3")))
#:guile %bootstrap-guile))
(drv (lower-object union))
(out -> (derivation->output-path drv)))
(define (contents=? file str)
@ -1469,7 +1471,8 @@ importing.* \\(guix config\\) from the host"
(symlink #$%bootstrap-guile
(string-append #$output "/guile"))
(symlink #$text (string-append #$output "/text"))))
(computed (computed-file "computed" exp)))
(computed (computed-file "computed" exp
#:guile %bootstrap-guile)))
(mlet* %store-monad ((text (lower-object text))
(guile-drv (lower-object %bootstrap-guile))
(comp-drv (lower-object computed))
@ -1504,7 +1507,8 @@ importing.* \\(guix config\\) from the host"
(display item port))))))
(computed (computed-file "computed" exp
#:options
`(#:references-graphs (("graph" ,pkg)))))
`(#:references-graphs (("graph" ,pkg)))
#:guile %bootstrap-guile))
(drv0 (package-derivation %store pkg #:graft? #t))
(drv1 (parameterize ((%graft? #t))
(run-with-store %store

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2012-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
@ -716,7 +716,8 @@
(use-modules (guix build utils))
(setenv "PATH" #+bin)
(invoke "tar" "xvf" #+out)
(copy-file #+name #$output)))))
(copy-file #+name #$output)))
#:guile %bootstrap-guile))
(drv (run-with-store %store (lower-object f)))
(_ (build-derivations %store (list drv))))
(call-with-input-file (derivation->output-path drv)

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
;;;
;;; This file is part of GNU Guix.
@ -302,7 +302,8 @@
(call-with-output-file
(string-append #$output "/bin/guile")
(lambda (port)
(display "Fake!\n" port))))))))
(display "Fake!\n" port))))
#:guile %bootstrap-guile))))
(guile (package->derivation %bootstrap-guile))
(drv (profile-derivation (manifest (list entry1 entry2))
#:hooks '()