From c90ddc8f811496e9da9ea1e6832a662bf767d6d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 17 Aug 2014 21:08:06 +0200 Subject: [PATCH] monads: 'package-file' uses '%current-system' at '>>=' time. * guix/monads.scm (package-file): Leave #:system to #f by default. * tests/monads.scm ("package-file, default system"): New test. --- guix/monads.scm | 3 +-- tests/monads.scm | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/guix/monads.scm b/guix/monads.scm index 8909312a877cbbd24ae397a95bab64701fa02a57..c714941a0c466267ab5d55713778c82603a50088 100644 --- a/guix/monads.scm +++ b/guix/monads.scm @@ -379,8 +379,7 @@ permission bits are kept." (define* (package-file package #:optional file #:key - (system (%current-system)) - (output "out") target) + system (output "out") target) "Return as a monadic value the absolute file name of FILE within the OUTPUT directory of PACKAGE. When FILE is omitted, return the name of the OUTPUT directory of PACKAGE. When TARGET is true, use it as a diff --git a/tests/monads.scm b/tests/monads.scm index 78a014ea6ad05712f62f606de6312c28791027b2..b814b0f7c5018ec8b12b60a2f51938aadd2c73d6 100644 --- a/tests/monads.scm +++ b/tests/monads.scm @@ -109,6 +109,20 @@ guile))) #:guile-for-build (package-derivation %store %bootstrap-guile))) +(test-assert "package-file, default system" + ;; The default system should be the one at '>>=' time, not the one at + ;; invocation time. See . + (run-with-store %store + (mlet* %store-monad + ((system -> (%current-system)) + (file (parameterize ((%current-system "foobar64-linux")) + (package-file coreutils "bin/ls"))) + (cu (package->derivation coreutils))) + (return (string=? file + (string-append (derivation->output-path cu) + "/bin/ls")))) + #:guile-for-build (package-derivation %store %bootstrap-guile))) + (test-assert "package-file + package->cross-derivation" (run-with-store %store (mlet* %store-monad ((file (package-file coreutils "bin/ls"