From 6f4ca78761471602e3af37ee1a33de446114039f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 31 Oct 2021 00:02:27 +0200 Subject: home: import: Avoid duplication of 'manifest->code'. * guix/scripts/home/import.scm (manifest->code): Remove. (manifest+configuration-files->code): New procedure. (import-manifest): Use 'manifest+configuration-files->code' instead of 'manifest->code'. * tests/home-import.scm (eval-test-with-home-environment): Likewise. (match-home-environment-transformations): New procedure. ("manifest->code: No services, package transformations"): New test. --- tests/home-import.scm | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/home-import.scm b/tests/home-import.scm index dc413d8516..abd3cec43d 100644 --- a/tests/home-import.scm +++ b/tests/home-import.scm @@ -87,10 +87,8 @@ corresponding file." (create-temporary-home files-alist) (setenv "HOME" %temporary-home-directory) (mkdir-p %temporary-home-directory) - (let* ((home-environment (manifest->code manifest %destination-directory - #:entry-package-version - manifest-entry-version-prefix - #:home-environment? #t)) + (let* ((home-environment (manifest+configuration-files->code + manifest %destination-directory)) (result (matcher home-environment))) (delete-file-recursively %temporary-home-directory) result)) @@ -108,6 +106,22 @@ corresponding file." ('services ('list))))) +(define-home-environment-matcher match-home-environment-transformations + ('begin + ('use-modules + ('gnu 'home) + ('gnu 'packages) + ('gnu 'services) + ('guix 'transformations)) + + ('define transform ('options->transformation _)) + ('home-environment + ('packages + ('list (transform ('specification->package "guile@2.0.9")) + ('specification->package "gcc") + ('specification->package "glibc@2.19"))) + ('services ('list))))) + (define-home-environment-matcher match-home-environment-no-services-nor-packages ('begin ('use-modules @@ -141,12 +155,23 @@ corresponding file." ('list ('local-file "/tmp/guix-config/.bashrc" "bashrc")))))))))) + (test-assert "manifest->code: No services" (eval-test-with-home-environment '() (make-manifest (list guile-2.0.9 gcc glibc)) match-home-environment-no-services)) +(test-assert "manifest->code: No services, package transformations" + (eval-test-with-home-environment + '() + (make-manifest (list (manifest-entry + (inherit guile-2.0.9) + (properties `((transformations + . ((foo . "bar")))))) + gcc glibc)) + match-home-environment-transformations)) + (test-assert "manifest->code: No packages nor services" (eval-test-with-home-environment '() -- cgit 1.4.1