summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-05-14 16:03:56 +0200
committerLudovic Courtès <ludo@gnu.org>2020-05-14 17:21:27 +0200
commitf52fbf7094c9c346d38ad469cc8d92d18387786e (patch)
tree954c567a163e6547aa7988063f9183c72112df40 /tests
parenta89df83c79340b5d0dfefcc6250dc69d502f3f5d (diff)
downloadguix-f52fbf7094c9c346d38ad469cc8d92d18387786e.tar.gz
packages: Ensure bags are insensitive to '%current-target-system'.
Fixes a bug whereby a bag's transitive dependencies would depend on the
global '%current-target-system' value.

Partly fixes <https://issues.guix.gnu.org/41182>.

* guix/packages.scm (bag-transitive-inputs)
(bag-transitive-build-inputs, bag-transitive-target-inputs):
Parameterize '%current-target-system'.
* tests/packages.scm ("package->bag, sensitivity to %current-target-system"):
New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/packages.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index 7a8b5e4a2d..c528d2080c 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -1000,6 +1000,19 @@
       (("dep" package)
        (eq? package dep)))))
 
+(test-assert "package->bag, sensitivity to %current-target-system"
+  (let* ((dep (dummy-package "dep"
+                (propagated-inputs (if (%current-target-system)
+                                       `(("libxml2" ,libxml2))
+                                       '()))))
+         (pkg (dummy-package "foo"
+                (native-inputs `(("dep" ,dep)))))
+         (bag (package->bag pkg (%current-system) "foo86-hurd")))
+    (equal? (parameterize ((%current-target-system "foo64-gnu"))
+              (bag-transitive-inputs bag))
+            (parameterize ((%current-target-system #f))
+              (bag-transitive-inputs bag)))))
+
 (test-assert "bag->derivation"
   (parameterize ((%graft? #f))
     (let ((bag (package->bag gnu-make))