summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-10-19 16:39:06 +0200
committerLudovic Courtès <ludo@gnu.org>2023-10-28 00:17:24 +0200
commit344e39c928bdb8e6b7e5ac79d94535921a414a05 (patch)
treed342223b21fba1140d255b015c15852664266b62 /tests
parent9d4b720e1f9e7581e340e4c84c3781af4ee72fde (diff)
downloadguix-344e39c928bdb8e6b7e5ac79d94535921a414a05.tar.gz
profiles: Hooks honor the #:system parameter of ‘profile-derivation’.
Fixes <https://issues.guix.gnu.org/65225>.

* guix/profiles.scm (info-dir-file, package-cache-file)
(info-dir-file, ghc-package-cache-file, ca-certificate-bundle)
(emacs-subdirs, gdk-pixbuf-loaders-cache-file, glib-schemas)
(gtk-icon-themes, gtk-im-modules, linux-module-database)
(xdg-desktop-database, xdg-mime-database, fonts-dir-file)
(manual-database, manual-database/optional): Add optional #:system
parameter and pass it to ‘gexp->derivation’.
(profile-derivation): Pass HOOK a second parameter, SYSTEM.
* gnu/bootloader.scm (efi-bootloader-profile)[efi-bootloader-profile-hook]:
Add optional #:system parameter and pass it to ‘gexp->derivation’.
* guix/channels.scm (package-cache-file): Likewise.
* tests/profiles.scm ("profile-derivation, #:system, and hooks"): New
test.

Reported-by: Tobias Geerinckx-Rice <me@tobias.gr>
Diffstat (limited to 'tests')
-rw-r--r--tests/profiles.scm24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/profiles.scm b/tests/profiles.scm
index 9ad03f2b24..9c419ada93 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013-2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013-2023 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -382,6 +382,28 @@
        (_          (built-derivations (list drv))))
     (return (file-exists? (string-append bindir "/guile")))))
 
+(test-assertm "profile-derivation, #:system, and hooks"
+  ;; Make sure all the profile hooks are built for the system specified with
+  ;; #:system, even if that does not match (%current-system).
+  ;; See <https://issues.guix.gnu.org/65225>.
+  (mlet* %store-monad
+      ((system -> (if (string=? (%current-system) "riscv64-linux")
+                      "x86_64-linux"
+                      "riscv64-linux"))
+       (entry -> (package->manifest-entry packages:coreutils))
+       (_        (set-guile-for-build (default-guile) system))
+       (drv      (profile-derivation (manifest (list entry))
+                                     #:system system))
+       (refs     (references* (derivation-file-name drv))))
+    (return (and (string=? (derivation-system drv) system)
+                 (pair? refs)
+                 (every (lambda (ref)
+                          (or (not (string-suffix? ".drv" ref))
+                              (let ((drv (read-derivation-from-file ref)))
+                                (string=? (derivation-system drv)
+                                          system))))
+                        refs)))))
+
 (test-assertm "profile-derivation relative symlinks, one entry"
   (mlet* %store-monad
       ((entry ->   (package->manifest-entry %bootstrap-guile))