1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

gexp: Leave grafting as is when lowering allowed/disallowed references.

Fixes <https://issues.guix.gnu.org/50676>.
Reported by Mathieu Othacehe <othacehe@gnu.org>.

Commit a779363b6a was partially incorrect:
references passed to #:allowed-references or #:references-graphs *can*
be lowered as references to grafted elements.  This is for example the
case when doing:

  (computed-file "partition.img" exp
                  #:options `(#:references-graphs ,inputs))

Here INPUTS must be lowered as a reference to suitably grafted elements.
Failing to do that, the reference graph will not match the actual
INPUTS.

However, when building a package, those references must indeed refer
only to ungrafted packages.  This commit preserves that by having build
systems pass #:graft? #f.

* guix/gexp.scm (lower-reference-graphs, lower-references): Remove uses
of 'without-grafting'.  This reverts
a779363b6a.
* guix/build-system/cmake.scm (cmake-build, cmake-cross-build):
Pass #:graft? #f.
* guix/build-system/glib-or-gtk.scm (glib-or-gtk-build)
(glib-or-gtk-cross-build): Likewise.
* guix/build-system/gnu.scm (gnu-build, gnu-cross-build): Likewise.
* guix/build-system/meson.scm (meson-build, meson-cross-build): Likewise.
* guix/build-system/trivial.scm (trivial-build, trivial-cross-build):
Likewise.
* tests/gexp.scm ("lower-object, computed-file + grafts"): New test.
* tests/packages.scm ("trivial with #:allowed-references + grafts"): New
test.
This commit is contained in:
Ludovic Courtès
2021-09-24 23:00:11 +02:00
parent 9fbe4b88c2
commit df46bef48e
8 changed files with 77 additions and 10 deletions

View File

@@ -882,6 +882,28 @@
(build-derivations %store (list d))
#f)))
(test-assert "trivial with #:allowed-references + grafts"
(let* ((g (package
(inherit %bootstrap-guile)
(replacement (package
(inherit %bootstrap-guile)
(version "9.9")))))
(p (package
(inherit (dummy-package "trivial"))
(build-system trivial-build-system)
(inputs (list g))
(arguments
`(#:guile ,g
#:allowed-references (,g)
#:builder (mkdir %output)))))
(d0 (package-derivation %store p #:graft? #f))
(d1 (parameterize ((%graft? #t))
(package-derivation %store p #:graft? #t))))
;; D1 should be equal to D2 because there's nothing to graft. In
;; particular, its #:disallowed-references should be lowered in the same
;; way (ungrafted) whether or not #:graft? is true.
(string=? (derivation-file-name d1) (derivation-file-name d0))))
(test-assert "search paths"
(let* ((p (make-prompt-tag "return-search-paths"))
(t (make-parameter "guile-0"))