summary refs log tree commit diff
path: root/tests/profiles.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-01-20 01:33:25 +0100
committerLudovic Courtès <ludo@gnu.org>2019-01-20 01:42:11 +0100
commit38b77f34640ff8a491913d29abcd16a846f2d0e4 (patch)
treeb955ddead2a7d6e5106f15c7bc2c9424caf7f1c1 /tests/profiles.scm
parent2d17a904aca81ed91c5a33ba15d244bca78ac4b8 (diff)
downloadguix-38b77f34640ff8a491913d29abcd16a846f2d0e4.tar.gz
profiles: Allow a profile to be added as an entry of another profile.
* guix/build/profiles.scm (build-etc/profile): When 'OUTPUT/etc/profile'
already exists, delete it first.
(build-profile): Likewise for 'OUTPUT/manifest'.
* tests/profiles.scm ("profile in profile"): New test.
Diffstat (limited to 'tests/profiles.scm')
-rw-r--r--tests/profiles.scm32
1 files changed, 31 insertions, 1 deletions
diff --git a/tests/profiles.scm b/tests/profiles.scm
index 8816839d16..9a05030aff 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2014 Alex Kost <alezost@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -591,6 +591,36 @@
       (built-derivations (list drv))
       (return (readlink (readlink (string-append profile "/dangling")))))))
 
+(test-equalm "profile in profile"
+  '("foo" "0")
+
+  ;; Make sure we can build a profile that has another profile has one of its
+  ;; entries.  The new profile's /manifest and /etc/profile must override the
+  ;; other's.
+  (mlet* %store-monad
+      ((prof0 (profile-derivation
+               (manifest
+                (list (package->manifest-entry %bootstrap-guile)))
+               #:hooks '()
+               #:locales? #f))
+       (prof1 (profile-derivation
+               (manifest (list (manifest-entry
+                                 (name "foo")
+                                 (version "0")
+                                 (item prof0))))
+               #:hooks '()
+               #:locales? #f)))
+    (mbegin %store-monad
+      (built-derivations (list prof1))
+      (let ((out (derivation->output-path prof1)))
+        (return (and (file-exists?
+                      (string-append out "/bin/guile"))
+                     (let ((manifest (profile-manifest out)))
+                       (match (manifest-entries manifest)
+                         ((entry)
+                          (list (manifest-entry-name entry)
+                                (manifest-entry-version entry)))))))))))
+
 (test-end "profiles")
 
 ;;; Local Variables: