summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSergio Pastor Pérez <sergio.pastorperez@gmail.com>2025-03-01 19:06:08 +0100
committerLudovic Courtès <ludo@gnu.org>2026-03-20 22:43:11 +0100
commitcf2a11b9661ed4b83012a533ef355eab4cbc238e (patch)
treed94e9959cba36fe3dda55317f9127841564e272c /tests
parent2d5ba988d586fdc981cc3ca7195db36b1133def8 (diff)
derivations: Let ‘map-derivation’ correctly handle directories.
The 'map-derivation' procedure was trying to process directories as files. When a derivation had a 'module import' directory as input, it threw an exception since it tried to open it as a file. * guix/derivations.scm (map-derivation): In ‘sources’, add ‘file-is-directory?’ case. * tests/derivations.scm ("map-derivation, modules"): New test. Fixes: https://issues.guix.gnu.org/71941 Change-Id: I9b766f9aaa03ea9307f73e8abb36bc347af4b5e6 Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/derivations.scm25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm
index b0d74ca50d1..a5e82238a48 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -1,5 +1,6 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012-2026 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2012-2026 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2025 Sergio Pastor Pérez <sergio.pastorperez@gmail.com>
3;;; 4;;;
4;;; This file is part of GNU Guix. 5;;; This file is part of GNU Guix.
5;;; 6;;;
@@ -20,6 +21,7 @@
20 21
21(define-module (test-derivations) 22(define-module (test-derivations)
22 #:use-module (guix derivations) 23 #:use-module (guix derivations)
24 #:use-module (guix gexp)
23 #:use-module (guix store) 25 #:use-module (guix store)
24 #:use-module (guix utils) 26 #:use-module (guix utils)
25 #:use-module ((gcrypt hash) #:prefix gcrypt:) 27 #:use-module ((gcrypt hash) #:prefix gcrypt:)
@@ -1606,6 +1608,29 @@
1606 (and (build-derivations %store (list (pk 'remapped* drv2))) 1608 (and (build-derivations %store (list (pk 'remapped* drv2)))
1607 (call-with-input-file out get-string-all)))) 1609 (call-with-input-file out get-string-all))))
1608 1610
1611(test-assert "map-derivation, modules"
1612 (let* ((bash-drv (package-derivation %store (@ (gnu packages bash) bash)))
1613 (bash-input (car (derivation-inputs bash-drv)))
1614 (bash-input-drv (derivation-input-derivation bash-input))
1615 (drv-with-modules (run-with-store %store
1616 (gexp->derivation "derivation-with-modules"
1617 (with-imported-modules '((guix build utils))
1618 #~(begin
1619 (use-modules (guix build utils))
1620 (mkdir-p (string-append #$output
1621 "/bin")))))))
1622 (bash-mapped-1 (map-derivation %store bash-drv
1623 `((,bash-input-drv . ,drv-with-modules))))
1624 (bash-mapped-2 (map-derivation %store bash-mapped-1
1625 `((,drv-with-modules . ,bash-input-drv))))
1626 (is-input? (lambda (in drv)
1627 (not (null? (filter (lambda (input)
1628 (eq? in (derivation-input-derivation input)))
1629 (derivation-inputs drv)))))))
1630 (and
1631 (not (is-input? bash-input-drv bash-mapped-1))
1632 (is-input? bash-input-drv bash-mapped-2))))
1633
1609(test-end) 1634(test-end)
1610 1635
1611;; Local Variables: 1636;; Local Variables: