From a7bb45b39d7d698e0868c2b3ac9097b70ef9d401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 15 Sep 2024 21:55:45 +0200 Subject: [PATCH] =?UTF-8?q?gexp:=20=E2=80=98imported-files=E2=80=99=20does?= =?UTF-8?q?=20not=20create=20symlinks.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes . This is presumably what e529d46828c359b449fc570bdc293fc12534647c meant to do, except that it wrongfully pass #:symlink? a true value instead, most likely due to a typo. * guix/gexp.scm (imported-files): Pass #:symlink? #f. * tests/gexp.scm ("imported-files does not create symlinks"): New test. Change-Id: Ic31be56a2adf4dfa55e1ec390c53cc9ba5f8a96c --- guix/gexp.scm | 2 +- tests/gexp.scm | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/guix/gexp.scm b/guix/gexp.scm index 871e59cfdc..e44aea6420 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -1629,7 +1629,7 @@ as returned by 'local-file' for example." (_ #f)) files) (imported-files/derivation files #:name name - #:symlink? derivation? + #:symlink? #f ;like 'interned-file-tree' #:system system #:guile guile) (interned-file-tree `(,name directory ,@(file-mapping->tree files))))) diff --git a/tests/gexp.scm b/tests/gexp.scm index ab99e19daa..e066076c5c 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -944,6 +944,33 @@ (and (file=? (string-append dir "/a/b/c") q-scm* stat) (file=? (string-append dir "/p/q") plain* stat))))))) +(test-assert "imported-files does not create symlinks" + ;; 'imported-files' should always produce a directory with regular files, + ;; whether or not it's going through 'imported-files/derivation'. + ;; See . + (call-with-temporary-directory + (lambda (directory) + (symlink (search-path %load-path "guix/store.scm") + (in-vicinity directory "store.scm")) + + (run-with-store %store + (mlet* %store-monad + ((files1 -> `(("x" . ,(in-vicinity directory "store.scm")))) + (files2 -> `(,@files1 + ("y" . ,(plain-file "foo.scm" "#t")))) + (import1 (imported-files files1)) + (import2-drv (imported-files files2)) + (import2 -> (derivation->output-path import2-drv)) + (_ (built-derivations (list import2-drv)))) + (return (and (eq? (stat:type (lstat (in-vicinity import1 "x"))) + 'regular) + (eq? (stat:type (lstat (in-vicinity import2 "x"))) + 'regular) + (file=? (in-vicinity import1 "x") + (search-path %load-path "guix/store.scm")) + (file=? (in-vicinity import2 "x") + (search-path %load-path "guix/store.scm"))))))))) + (test-equal "gexp-modules & ungexp" '((bar) (foo)) ((@@ (guix gexp) gexp-modules)