summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-03-04 10:57:46 +0100
committerLudovic Courtès <ludo@gnu.org>2021-03-05 12:49:27 +0100
commit90ea8b16eb519a88d8f739fea5a416c0b99de19f (patch)
treebc14a6d8b838ed86f173dd5d47abe43994cfda66 /tests
parentc9d42d611c43e485fe39ef0adc2b032a4aec8fae (diff)
downloadguix-90ea8b16eb519a88d8f739fea5a416c0b99de19f.tar.gz
profiles: 'package->manifest-entry' preserves transformations by default.
Previously, transformations applied from a manifest (rather than via
"guix install") would be lost.  This change fixes that and simplifies
things.

Reported by zimoun at
<https://lists.gnu.org/archive/html/guix-devel/2021-02/msg00153.html>.

* guix/profiles.scm (default-properties): New procedure.
(package->manifest-entry): Use it for #:properties.
* guix/scripts/pack.scm (guix-pack)[with-transformations]: Remove.
Remove caller.
* guix/scripts/package.scm (transaction-upgrade-entry): Remove calls to
'manifest-entry-with-transformations'.
* tests/guix-package.sh: Add test.
* tests/transformations.scm ("options->transformation + package->manifest-entry"):
New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/guix-package.sh15
-rw-r--r--tests/transformations.scm10
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/guix-package.sh b/tests/guix-package.sh
index 7eaad6823f..39e2b514c3 100644
--- a/tests/guix-package.sh
+++ b/tests/guix-package.sh
@@ -386,6 +386,21 @@ guix package -I
 # '--dry-run' is passed.
 GUIX_BUILD_OPTIONS="--no-grafts"
 
+# Install using the "imperative model", export a manifest, instantiate it, and
+# make sure we get the same profile.
+guix package --bootstrap -i guile-bootstrap --without-tests=foo
+profile_directory="$(readlink -f "$default_profile")"
+guix package --export-manifest > "$tmpfile"
+grep 'without-tests.*foo' "$tmpfile"
+guix package --rollback --bootstrap
+guix package --bootstrap -m "$tmpfile"
+test "$(readlink -f "$default_profile")" = "$profile_directory"
+guix package --export-manifest > "$tmpfile.2nd"
+cmp "$tmpfile" "$tmpfile.2nd"
+
+rm -f "$tmpfile.2nd"
+guix package --rollback --bootstrap
+
 # Applying a manifest file.
 cat > "$module_dir/manifest.scm"<<EOF
 (use-package-modules bootstrap)
diff --git a/tests/transformations.scm b/tests/transformations.scm
index 7877029486..902bd45a6a 100644
--- a/tests/transformations.scm
+++ b/tests/transformations.scm
@@ -20,6 +20,9 @@
   #:use-module (guix tests)
   #:use-module (guix store)
   #:use-module ((guix gexp) #:select (lower-object))
+  #:use-module ((guix profiles)
+                #:select (package->manifest-entry
+                          manifest-entry-properties))
   #:use-module (guix derivations)
   #:use-module (guix packages)
   #:use-module (guix git-download)
@@ -413,6 +416,13 @@
                    `((with-latest . "foo")))))
           (package-version (t p)))))
 
+(test-equal "options->transformation + package->manifest-entry"
+  '((transformations . ((without-tests . "foo"))))
+  (let* ((p (dummy-package "foo"))
+         (t (options->transformation '((without-tests . "foo"))))
+         (e (package->manifest-entry (t p))))
+    (manifest-entry-properties e)))
+
 (test-end)
 
 ;;; Local Variables: