diff options
| -rw-r--r-- | guix/derivations.scm | 7 | ||||
| -rw-r--r-- | tests/derivations.scm | 25 |
2 files changed, 30 insertions, 2 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm index ffa69e924cf..d84d1a391c1 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2012-2021, 2023-2024 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2012-2021, 2023-2024 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2016, 2017 Mathieu Lirzin <mthl@gnu.org> | 3 | ;;; Copyright © 2016, 2017 Mathieu Lirzin <mthl@gnu.org> |
| 4 | ;;; Copyright © 2025 Sergio Pastor Pérez <sergio.pastorperez@gmail.com> | ||
| 4 | ;;; | 5 | ;;; |
| 5 | ;;; This file is part of GNU Guix. | 6 | ;;; This file is part of GNU Guix. |
| 6 | ;;; | 7 | ;;; |
| @@ -1074,8 +1075,10 @@ recursively." | |||
| 1074 | ((_ . replacement) | 1075 | ((_ . replacement) |
| 1075 | replacement) | 1076 | replacement) |
| 1076 | (#f | 1077 | (#f |
| 1077 | (substitute-file source | 1078 | (if (file-is-directory? source) |
| 1078 | initial replacements)))) | 1079 | source |
| 1080 | (substitute-file source | ||
| 1081 | initial replacements))))) | ||
| 1079 | (derivation-sources drv))) | 1082 | (derivation-sources drv))) |
| 1080 | 1083 | ||
| 1081 | ;; Now augment the lists of initials and replacements. | 1084 | ;; Now augment the lists of initials and replacements. |
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: |
