diff options
| author | Sergio Pastor Pérez <sergio.pastorperez@gmail.com> | 2025-03-01 19:06:08 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2026-03-20 22:43:11 +0100 |
| commit | cf2a11b9661ed4b83012a533ef355eab4cbc238e (patch) | |
| tree | d94e9959cba36fe3dda55317f9127841564e272c /tests | |
| parent | 2d5ba988d586fdc981cc3ca7195db36b1133def8 (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.scm | 25 |
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 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012-2026 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2025 Sergio Pastor Pérez <sergio.pastorperez@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -20,6 +21,7 @@ (define-module (test-derivations) #:use-module (guix derivations) + #:use-module (guix gexp) #:use-module (guix store) #:use-module (guix utils) #:use-module ((gcrypt hash) #:prefix gcrypt:) @@ -1606,6 +1608,29 @@ (and (build-derivations %store (list (pk 'remapped* drv2))) (call-with-input-file out get-string-all)))) +(test-assert "map-derivation, modules" + (let* ((bash-drv (package-derivation %store (@ (gnu packages bash) bash))) + (bash-input (car (derivation-inputs bash-drv))) + (bash-input-drv (derivation-input-derivation bash-input)) + (drv-with-modules (run-with-store %store + (gexp->derivation "derivation-with-modules" + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (mkdir-p (string-append #$output + "/bin"))))))) + (bash-mapped-1 (map-derivation %store bash-drv + `((,bash-input-drv . ,drv-with-modules)))) + (bash-mapped-2 (map-derivation %store bash-mapped-1 + `((,drv-with-modules . ,bash-input-drv)))) + (is-input? (lambda (in drv) + (not (null? (filter (lambda (input) + (eq? in (derivation-input-derivation input))) + (derivation-inputs drv))))))) + (and + (not (is-input? bash-input-drv bash-mapped-1)) + (is-input? bash-input-drv bash-mapped-2)))) + (test-end) ;; Local Variables: |
